Skip to content

Commit 737fc33

Browse files
authored
Update docusaurus to v3 (#3077)
1 parent 4d30546 commit 737fc33

File tree

75 files changed

+8237
-7227
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+8237
-7227
lines changed

website/blog/2020-09-03-Hydra_1.0.md

Lines changed: 227 additions & 221 deletions
Large diffs are not rendered by default.

website/docs/advanced/defaults_list.md

Lines changed: 62 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,19 @@ OPTION : CONFIG_NAME|CONFIG_NAMES|null
2626

2727
*GROUP_DEFAULT* : An *overridable* config. e.g. `db: mysql`, `db@backup: mysql`.
2828
- ***override*** : Overrides the option of a previously defined GROUP_DEFAULT.
29-
- ***optional*** : By default, an OPTION that do not exist causes an error; optional suppresses the error.
29+
- ***optional*** : By default, an OPTION that do not exist causes an error; optional suppresses the error.
3030
- ***null*** : A place-holder for a future override. If it is not overridden the entry is ignored.
3131

3232
*CONFIG_NAME*: The name of a config, without the file system extension. e.g. `mysql` and not `mysql.yaml`.
3333

3434
*CONFIG_NAMES* : A list of config names. e.g. `[mysql, sqlite]`
3535

36-
*CONFIG_GROUP* : A path to a set of configs.
37-
The path is relative to the containing config.
38-
It can be made absolute by prefixing it with a `/`.
36+
*CONFIG_GROUP* : A path to a set of configs.
37+
The path is relative to the containing config.
38+
It can be made absolute by prefixing it with a `/`.
3939
The path separator is `/` regardless of the operating system.
4040

41-
*OPTION*: The currently selected *CONFIG_NAME* or *CONFIG_NAMES* from a *CONFIG_GROUP*.
41+
*OPTION*: The currently selected *CONFIG_NAME* or *CONFIG_NAMES* from a *CONFIG_GROUP*.
4242

4343
*PACKAGE* : Where to place the content of the config within the output config.
4444
It is relative to the Package of the containing config by default. See [Packages](overriding_packages.md).
@@ -130,7 +130,7 @@ debug: false
130130
</div>
131131
</div>
132132
133-
A Config Group's option can also be overridden via the command line. e.g:
133+
A Config Group's option can also be overridden via the command line. e.g:
134134
```
135135
$ python my_app.py server/db=sqlite
136136
```
@@ -147,7 +147,7 @@ By default, the content of a config is overriding the content of configs in the
147147

148148
```yaml title="config.yaml" {5}
149149
defaults:
150-
- db: mysql
150+
- db: mysql
151151

152152
db:
153153
host: backup
@@ -168,7 +168,7 @@ db:
168168
</div>
169169
</div>
170170

171-
The `_self_` entry determines the relative position of **this** config in the Defaults List.
171+
The `_self_` entry determines the relative position of **this** config in the Defaults List.
172172
If it is not specified, it is added automatically as the last item.
173173

174174
<div className="row">
@@ -177,7 +177,7 @@ If it is not specified, it is added automatically as the last item.
177177
```yaml title="config.yaml" {2,6}
178178
defaults:
179179
- _self_
180-
- db: mysql # Overrides this config
180+
- db: mysql # Overrides this config
181181

182182
db:
183183
host: backup
@@ -196,7 +196,7 @@ db:
196196
</div>
197197
</div>
198198

199-
With `_self_` at the top of the Defaults List, the host field defined in *config.yaml* now precedes the host field defined
199+
With `_self_` at the top of the Defaults List, the host field defined in *config.yaml* now precedes the host field defined
200200
in *db/mysql.yaml*, and as a result is overridden.
201201

202202
## Interpolation in the Defaults List
@@ -208,10 +208,10 @@ defaults:
208208
- db: mysql
209209
- combination_specific_config: ${server}_${db} # apache_mysql
210210
```
211-
Interpolation keys can be config groups with any @package overrides.
211+
Interpolation keys can be config groups with any @package overrides.
212212
For example: `${db/engine}`, `${db@backup}`
213213

214-
The selected option for *combination_specific_config* depends on the final selected options for *db* and *server*.
214+
The selected option for *combination_specific_config* depends on the final selected options for *db* and *server*.
215215
e.g., If *db* is overridden to *sqlite*, *combination_specific_config* will become *apache_sqlite*.
216216

217217
#### Restrictions:
@@ -236,61 +236,63 @@ You can inspect these artifacts via command line flags:
236236
- `--cfg job|hydra|all` Shows the Output Config.
237237

238238
Example outputs:
239-
<details><summary>python my_app.py <b>--info defaults-tree</b></summary>
240-
241-
```yaml title=""
242-
<root>:
243-
hydra/config:
244-
hydra/hydra_logging: default
245-
hydra/job_logging: default
246-
hydra/launcher: basic
247-
hydra/sweeper: basic
248-
hydra/output: default
249-
hydra/help: default
250-
hydra/hydra_help: default
251-
_self_
252-
config:
253-
server/apache:
254-
server/db: mysql
239+
240+
<details>
241+
<summary>python my_app.py <b>--info defaults-tree</b></summary>
242+
```yaml title=""
243+
<root>:
244+
hydra/config:
245+
hydra/hydra_logging: default
246+
hydra/job_logging: default
247+
hydra/launcher: basic
248+
hydra/sweeper: basic
249+
hydra/output: default
250+
hydra/help: default
251+
hydra/hydra_help: default
255252
_self_
256-
_self_
257-
```
253+
config:
254+
server/apache:
255+
server/db: mysql
256+
_self_
257+
_self_
258+
```
258259
</details>
259-
<details><summary>python my_app.py <b>--info defaults</b></summary>
260-
261-
```text
262-
Defaults List
263-
*************
264-
| Config path | Package | _self_ | Parent |
265-
-------------------------------------------------------------------------------
266-
| hydra/hydra_logging/default | hydra.hydra_logging | False | hydra/config |
267-
| hydra/job_logging/default | hydra.job_logging | False | hydra/config |
268-
| hydra/launcher/basic | hydra.launcher | False | hydra/config |
269-
| hydra/sweeper/basic | hydra.sweeper | False | hydra/config |
270-
| hydra/output/default | hydra | False | hydra/config |
271-
| hydra/help/default | hydra.help | False | hydra/config |
272-
| hydra/hydra_help/default | hydra.hydra_help | False | hydra/config |
273-
| hydra/config | hydra | True | <root> |
274-
| server/db/mysql | server.db | False | server/apache |
275-
| server/apache | server | True | config |
276-
| config | | True | <root> |
277-
-------------------------------------------------------------------------------
278-
```
260+
<details>
261+
<summary>python my_app.py <b>--info defaults</b></summary>
262+
263+
```text
264+
Defaults List
265+
*************
266+
| Config path | Package | _self_ | Parent |
267+
-------------------------------------------------------------------------------
268+
| hydra/hydra_logging/default | hydra.hydra_logging | False | hydra/config |
269+
| hydra/job_logging/default | hydra.job_logging | False | hydra/config |
270+
| hydra/launcher/basic | hydra.launcher | False | hydra/config |
271+
| hydra/sweeper/basic | hydra.sweeper | False | hydra/config |
272+
| hydra/output/default | hydra | False | hydra/config |
273+
| hydra/help/default | hydra.help | False | hydra/config |
274+
| hydra/hydra_help/default | hydra.hydra_help | False | hydra/config |
275+
| hydra/config | hydra | True | <root> |
276+
| server/db/mysql | server.db | False | server/apache |
277+
| server/apache | server | True | config |
278+
| config | | True | <root> |
279+
-------------------------------------------------------------------------------
280+
```
279281
</details>
280-
<details><summary>python my_app.py <b>--cfg job</b></summary>
281-
282-
```yaml
283-
server:
284-
db:
285-
name: mysql
286-
name: apache
287-
debug: false
288-
```
282+
<details>
283+
<summary>python my_app.py <b>--cfg job</b></summary>
284+
285+
```yaml
286+
server:
287+
db:
288+
name: mysql
289+
name: apache
290+
debug: false
291+
```
289292
</details>
290293

291294
## Related topics
292295
- [Packages](overriding_packages.md)
293296
- [Common Patterns/Extending Configs](patterns/extending_configs.md)
294297
- [Common Patterns/Configuring Experiments](patterns/configuring_experiments.md)
295298
- [Selecting multiple configs from a Config Group](patterns/select_multiple_configs_from_config_group.md)
296-

website/docs/advanced/instantiate_objects/overview.md

Lines changed: 40 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -28,45 +28,46 @@ HYDRA_INSTANTIATE_ALLOWLIST_OVERRIDE with a colon-separated list of modules to a
2828
eg. `HYDRA_INSTANTIATE_ALLOWLIST_OVERRIDE=os.rename:shutil.move`
2929
:::
3030

31-
<details><summary>Instantiate API (Expand for details)</summary>
32-
33-
```python
34-
def instantiate(config: Any, *args: Any, **kwargs: Any) -> Any:
35-
"""
36-
:param config: An config object describing what to call and what params to use.
37-
In addition to the parameters, the config must contain:
38-
_target_ : target class or callable name (str)
39-
And may contain:
40-
_args_: List-like of positional arguments to pass to the target
41-
_recursive_: Construct nested objects as well (bool).
42-
True by default.
43-
may be overridden via a _recursive_ key in
44-
the kwargs
45-
_convert_: Conversion strategy
46-
none : Passed objects are DictConfig and ListConfig, default
47-
partial : Passed objects are converted to dict and list, with
48-
the exception of Structured Configs (and their fields).
49-
object : Passed objects are converted to dict and list.
50-
Structured Configs are converted to instances of the
51-
backing dataclass / attr class.
52-
all : Passed objects are dicts, lists and primitives without
53-
a trace of OmegaConf containers. Structured configs
54-
are converted to dicts / lists too.
55-
_partial_: If True, return functools.partial wrapped method or object
56-
False by default. Configure per target.
57-
:param args: Optional positional parameters pass-through
58-
:param kwargs: Optional named parameters to override
59-
parameters in the config object. Parameters not present
60-
in the config objects are being passed as is to the target.
61-
IMPORTANT: dataclasses instances in kwargs are interpreted as config
62-
and cannot be used as passthrough
63-
:return: if _target_ is a class name: the instantiated object
64-
if _target_ is a callable: the return value of the call
65-
"""
66-
67-
# Alias for instantiate
68-
call = instantiate
69-
```
31+
<details>
32+
<summary>Instantiate API (Expand for details)</summary>
33+
34+
```python
35+
def instantiate(config: Any, *args: Any, **kwargs: Any) -> Any:
36+
"""
37+
:param config: An config object describing what to call and what params to use.
38+
In addition to the parameters, the config must contain:
39+
_target_ : target class or callable name (str)
40+
And may contain:
41+
_args_: List-like of positional arguments to pass to the target
42+
_recursive_: Construct nested objects as well (bool).
43+
True by default.
44+
may be overridden via a _recursive_ key in
45+
the kwargs
46+
_convert_: Conversion strategy
47+
none : Passed objects are DictConfig and ListConfig, default
48+
partial : Passed objects are converted to dict and list, with
49+
the exception of Structured Configs (and their fields).
50+
object : Passed objects are converted to dict and list.
51+
Structured Configs are converted to instances of the
52+
backing dataclass / attr class.
53+
all : Passed objects are dicts, lists and primitives without
54+
a trace of OmegaConf containers. Structured configs
55+
are converted to dicts / lists too.
56+
_partial_: If True, return functools.partial wrapped method or object
57+
False by default. Configure per target.
58+
:param args: Optional positional parameters pass-through
59+
:param kwargs: Optional named parameters to override
60+
parameters in the config object. Parameters not present
61+
in the config objects are being passed as is to the target.
62+
IMPORTANT: dataclasses instances in kwargs are interpreted as config
63+
and cannot be used as passthrough
64+
:return: if _target_ is a class name: the instantiated object
65+
if _target_ is a callable: the return value of the call
66+
"""
67+
68+
# Alias for instantiate
69+
call = instantiate
70+
```
7071

7172
</details><br/>
7273

website/docs/advanced/override_grammar/basic.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ $ python my_app.py 'dir=A\[B' # ok
212212
- `float`: 3.14, -10e6, inf, -inf, nan.
213213
- `bool`: true, false
214214
- `dot_path`: foo.bar
215-
- `interpolation`: ${foo.bar}, ${oc.env:USER,me}
215+
- `interpolation`: $\{foo.bar}, $\{oc.env:USER,me}
216216

217217
Constants (null, true, false, inf, nan) are case-insensitive.
218218

website/docs/advanced/override_grammar/extended.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -404,17 +404,17 @@ Input are grouped by type.
404404
| “true” | error | error | “true” | true | '“true”' |
405405
| “false” | error | error | “false” | false | '“false”' |
406406
| “[1,2,3]” | error | error | “[1,2,3]” | error | '“[1,2,3]”' |
407-
| “{a:10}” | error | error | “{a:10}” | error | '“{a:10}”' |
407+
| “\{a:10}” | error | error | “\{a:10}” | error | '“\{a:10}”' |
408408
| true | 1 | 1.0 | “true” | true | “true” |
409409
| false | 0 | 0.0 | “false” | false | “false” |
410410
| [] | [] | [] | [] | [] | “[]” |
411411
| [0,1,2] | [0,1,2] | [0.0,1.0,2.0] | [“0”,”1”,”2”] | [false,true,true] | “[1, 2, 3]” |
412412
| [1,[2]] | [1,[2]] | [1.0,[2.0]] | [“1”,[“2”]] | [true,[true]] | “[1, [2]]” |
413413
| [a,1] | error | error | [“a”,”1”] | error | '[“a”, 1]' |
414-
| {} | {} | {} | {} | {} | “{}” |
415-
| {a:10} | {a:10} | {a:10.0} | {a:”10”} | {a: true} | '{“a”: 10}' |
416-
| {a:[0,1,2]} | {a:[0,1,2]} | {a:[0.0,1.0,2.-]} | {a:[“0”,”1”,”2”]} | {a:[false,true,true]} | '{“a”: [1, 2, 3]}' |
417-
| {a:10,b:xyz} | error | error | {a:”10”,b:”xyz”} | error | '{“a”: 10, “b”: “xyz”}'|
414+
| \{} | \{} | \{} | \{} | \{} | “\{}” |
415+
| \{a:10} | \{a:10} | \{a:10.0} | \{a:”10”} | \{a: true} | '\{“a”: 10}' |
416+
| \{a:[0,1,2]} | \{a:[0,1,2]} | \{a:[0.0,1.0,2.-]} | \{a:[“0”,”1”,”2”]} | \{a:[false,true,true]} | '\{“a”: [1, 2, 3]}' |
417+
| \{a:10,b:xyz} | error | error | \{a:”10”,b:”xyz”} | error | '\{“a”: 10, “b”: “xyz”}'|
418418
| choice(0,1) | choice(0,1) | choice(0.0,1.0) | choice(“0”,“1”) | choice(false,true) | choice(“0”, “1”) |
419419
| choice(a,b) | error | error | choice(“a”,”b”) | error | choice('“a”', '“b”') |
420420
| choice(1,a) | error | error | choice(“1”,”a”) | error | choice(“1”, '“a”') |

website/docs/advanced/overriding_packages.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ name: sqlite
6666

6767

6868
### An example using only default packages
69-
The default package of *config.yaml* is the global package, of *server/apache.yaml* is *server* and of *server/db/mysql.yaml* is *server.db*.
69+
The default package of *config.yaml* is the global package, of *server/apache.yaml* is *server* and of *server/db/mysql.yaml* is *server.db*.
7070
<div className="row">
7171
<div className="col col--6">
7272

@@ -80,8 +80,8 @@ debug: false
8080
</div></div>
8181
8282
### Overriding packages using the Defaults List
83-
By default, packages specified in the Defaults List are relative to the package of containing config.
84-
As a consequence, overriding a package relocates the entire subtree.
83+
By default, packages specified in the Defaults List are relative to the package of containing config.
84+
As a consequence, overriding a package relocates the entire subtree.
8585
8686
<div className="row">
8787
<div className="col col--4">
@@ -119,17 +119,17 @@ Note that content of *server/apache.yaml* is relocated to *admin*
119119
and the content of *server/db/mysql.yaml* to *admin.backup*.
120120
121121
#### Default List package keywords
122-
We will use this example, replacing *<@PACKAGE>* to demonstrate different cases:
122+
We will use this example, replacing *\<\@PACKAGE>* to demonstrate different cases:
123123
```yaml title="config_group/config.yaml"
124124
defaults:
125125
- /server/db<@PACKAGE>: mysql
126126
```
127127
128-
Without a package override, the resulting package is `config_group.server.db`.
129-
With the **@\_here\_** keyword, The resulting package is the same as the containing config (`config_group`).
128+
Without a package override, the resulting package is `config_group.server.db`.
129+
With the **@\_here\_** keyword, The resulting package is the same as the containing config (`config_group`).
130130
##### Absolute keywords:
131131
* **@\_group\_**: \_group\_ is the absolute default package of the config (`server.db`)
132-
* **@\_global\_**: The global package. Anything following \_global\_ is absolute.
132+
* **@\_global\_**: The global package. Anything following \_global\_ is absolute.
133133
e.g. **@\_global\_.foo** becomes `foo`.
134134

135135
### Overriding the package via the package directive
@@ -172,4 +172,3 @@ src:
172172
dst:
173173
name: mysql
174174
```
175-

0 commit comments

Comments
 (0)