Skip to content

Commit 32e82d3

Browse files
authored
Refactor titles of the structured configs documentation (omry#790)
The objective is to make it easier to understand that all content in the `structured_config.rst` file is related to structured configs, when looking at the left navigation pane. More precisely, the main changes are that: - The "Lists" and "Dicts" sections are now moved inside the "Structured configs" main section (getting rid of the intermediate "Containers" section to reduce nesting) - The "Misc" section is also moved inside the "Structured Configs" main section (and is also renamed to give a better idea of what's inside it, now that its detailed content isn't shown anymore in the left navigation pane) - Finally the "Merging with other configs" section is also moved inside the "Structured Configs" main section so as to make it clear that it is related to structured configs.
1 parent c6130e7 commit 32e82d3

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

docs/source/structured_config.rst

+11-16
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.. _structured_config:
1+
.. _structured_configs:
22

33
.. testsetup:: *
44

@@ -11,8 +11,8 @@
1111
import sys
1212
os.environ['USER'] = 'omry'
1313

14-
Structured config
15-
-----------------
14+
Structured configs
15+
------------------
1616
Structured configs are used to create OmegaConf configuration object with runtime type safety.
1717
In addition, they can be used with tools like mypy or your IDE for static type checking.
1818

@@ -199,11 +199,6 @@ You can assign subclasses:
199199
>>> assert conf.manager.duper == True
200200

201201

202-
Containers
203-
----------
204-
205-
Python container types are fully supported in Structured configs.
206-
207202
Lists
208203
^^^^^
209204
Structured Config fields annotated with ``typing.List`` or ``typing.Tuple`` can hold any type
@@ -275,8 +270,8 @@ Like with Lists, the types of values contained in Dicts are verified at runtime.
275270
>>> with raises(ValidationError):
276271
... conf.users["Joe"] = 10
277272

278-
Misc
279-
----
273+
Other special features
274+
^^^^^^^^^^^^^^^^^^^^^^
280275
OmegaConf supports field modifiers such as ``MISSING`` and ``Optional``.
281276

282277
.. doctest::
@@ -293,7 +288,7 @@ OmegaConf supports field modifiers such as ``MISSING`` and ``Optional``.
293288
>>> conf: Modifiers = OmegaConf.structured(Modifiers)
294289

295290
Mandatory missing values
296-
^^^^^^^^^^^^^^^^^^^^^^^^
291+
++++++++++++++++++++++++
297292

298293
Fields assigned the constant ``MISSING`` do not have a value and the value must be set prior to accessing the field.
299294
Otherwise a ``MissingMandatoryValue`` exception is raised.
@@ -307,7 +302,7 @@ Otherwise a ``MissingMandatoryValue`` exception is raised.
307302

308303

309304
Optional fields
310-
^^^^^^^^^^^^^^^
305+
+++++++++++++++
311306

312307
.. doctest::
313308

@@ -321,7 +316,7 @@ Optional fields
321316

322317

323318
Interpolations
324-
^^^^^^^^^^^^^^
319+
++++++++++++++
325320

326321
:ref:`interpolation` works normally with Structured configs, but static type checkers may object to you assigning a string to another type.
327322
To work around this, use the special functions ``omegaconf.SI`` and ``omegaconf.II`` described below.
@@ -380,8 +375,8 @@ Note however that this validation step is currently skipped for container node i
380375
>>> assert cfg.some_dict == 0 # type mismatch, but no error
381376

382377

383-
Frozen
384-
^^^^^^
378+
Frozen classes
379+
++++++++++++++
385380

386381
Frozen dataclasses and attr classes are supported via OmegaConf :ref:`read-only-flag`, which makes the entire config node and all if it's child nodes read-only.
387382

@@ -404,7 +399,7 @@ The read-only flag is recursive:
404399
... conf.list[0] = 20
405400

406401
Merging with other configs
407-
----------------------------
402+
^^^^^^^^^^^^^^^^^^^^^^^^^^
408403

409404
Once an OmegaConf object is created, it can be merged with others regardless of its source.
410405
OmegaConf configs created from Structured configs contains type information that is enforced at runtime.

0 commit comments

Comments
 (0)