Skip to content

Commit 5e15069

Browse files
authored
Fix problems when building the doc (#245)
1 parent db49612 commit 5e15069

14 files changed

Lines changed: 152 additions & 112 deletions

File tree

docs/source/reference/_autoapi/docbuild/cli/cmd_cli/index.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ Functions
1515
.. autoapisummary::
1616

1717
docbuild.cli.cmd_cli.handle_validation_error
18+
docbuild.cli.cmd_cli.load_app_config
19+
docbuild.cli.cmd_cli.load_env_config
1820
docbuild.cli.cmd_cli.cli
1921

2022

@@ -37,6 +39,23 @@ Module Contents
3739
status code after handling the error.
3840

3941

42+
.. py:function:: load_app_config(ctx: click.Context, app_config: pathlib.Path, max_workers: str | None) -> None
43+
44+
Load and validate Application configuration.
45+
46+
:param ctx: The Click context object. The result will be added to ``ctx.obj.appconfig``.
47+
:param app_config: The path to the application config file provided via CLI.
48+
:param max_workers: The max_workers value from CLI options.
49+
50+
51+
.. py:function:: load_env_config(ctx: click.Context, env_config: pathlib.Path) -> None
52+
53+
Load and validate Environment configuration.
54+
55+
:param ctx: The Click context object. The result will be added to ``ctx.obj.envconfig``.
56+
:param env_config: The path to the environment config file provided via CLI.
57+
58+
4059
.. py:function:: cli(ctx: click.Context, verbose: int, dry_run: bool, debug: bool, app_config: pathlib.Path, env_config: pathlib.Path, max_workers: str | None, **kwargs: dict) -> None
4160
4261
Acts as a main entry point for CLI tool.

docs/source/reference/_autoapi/docbuild/cli/cmd_config/application/index.rst

Lines changed: 0 additions & 29 deletions
This file was deleted.

docs/source/reference/_autoapi/docbuild/cli/cmd_config/environment/index.rst

Lines changed: 0 additions & 29 deletions
This file was deleted.

docs/source/reference/_autoapi/docbuild/cli/cmd_config/index.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ docbuild.cli.cmd_config
55
66
.. autoapi-nested-parse::
77

8-
CLI interface to shows config files how docbuild sees it.
8+
CLI interface to manage and view configuration.
99

1010

1111

@@ -15,8 +15,8 @@ Submodules
1515
.. toctree::
1616
:maxdepth: 1
1717

18-
/reference/_autoapi/docbuild/cli/cmd_config/application/index
19-
/reference/_autoapi/docbuild/cli/cmd_config/environment/index
18+
/reference/_autoapi/docbuild/cli/cmd_config/list/index
19+
/reference/_autoapi/docbuild/cli/cmd_config/validate/index
2020

2121

2222
Functions
@@ -32,6 +32,6 @@ Package Contents
3232

3333
.. py:function:: config(ctx: click.Context) -> None
3434
35-
Subcommand to show the configuration files and their content.
35+
Subcommand to manage the configuration files and their content.
3636

3737

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
docbuild.cli.cmd_config.list
2+
============================
3+
4+
.. py:module:: docbuild.cli.cmd_config.list
5+
6+
.. autoapi-nested-parse::
7+
8+
CLI interface to list the configuration.
9+
10+
11+
12+
Functions
13+
---------
14+
15+
.. autoapisummary::
16+
17+
docbuild.cli.cmd_config.list.print_section
18+
docbuild.cli.cmd_config.list.list_config
19+
20+
21+
Module Contents
22+
---------------
23+
24+
.. py:function:: print_section(title: str, data: dict[str, Any], prefix: str, flat: bool, color: str) -> None
25+
26+
Print a configuration section in either flat or JSON format.
27+
28+
29+
.. py:function:: list_config(ctx: click.Context, app: bool, env: bool, flat: bool) -> None
30+
31+
List the configuration as JSON or flat text.
32+
33+
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
docbuild.cli.cmd_config.validate
2+
================================
3+
4+
.. py:module:: docbuild.cli.cmd_config.validate
5+
6+
.. autoapi-nested-parse::
7+
8+
CLI interface to validate the configuration files.
9+
10+
11+
12+
Functions
13+
---------
14+
15+
.. autoapisummary::
16+
17+
docbuild.cli.cmd_config.validate.validate
18+
19+
20+
Module Contents
21+
---------------
22+
23+
.. py:function:: validate(ctx: click.Context) -> None
24+
25+
Validate TOML configuration files.
26+
27+
This checks the syntax and schema of application and environment files.
28+
29+
:param ctx: The Click context object, which should already have loaded configurations.
30+
31+

docs/source/reference/_autoapi/docbuild/config/app/PlaceholderResolver.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ docbuild.config.app.PlaceholderResolver
1414

1515

1616

17+
.. py:method:: validate_brace_syntax(text: str, original_text: str) -> None
18+
19+
Validate that curly braces are balanced and properly ordered.
20+
21+
22+
1723
.. py:method:: get_container_name() -> str
1824
1925
Public accessor for the current container/key name.
@@ -31,5 +37,6 @@ docbuild.config.app.PlaceholderResolver
3137
:return: The configuration with all placeholders resolved.
3238
:raises PlaceholderResolutionError: If a placeholder cannot be resolved.
3339
:raises CircularReferenceError: If a circular reference is detected.
40+
:raises PlaceholderSyntaxError: If a placeholder has invalid syntax.
3441

3542

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
docbuild.config.app.PlaceholderSyntaxError
2+
==========================================
3+
4+
.. py:exception:: docbuild.config.app.PlaceholderSyntaxError
5+
6+
Bases: :py:obj:`ValueError`
7+
8+
.. autoapi-inheritance-diagram:: docbuild.config.app.PlaceholderSyntaxError
9+
:parts: 1
10+
11+
12+
Exception raised when a placeholder has invalid syntax.
13+

docs/source/reference/_autoapi/docbuild/config/app/index.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@ Exceptions
2626

2727
/reference/_autoapi/docbuild/config/app/PlaceholderResolutionError
2828
/reference/_autoapi/docbuild/config/app/CircularReferenceError
29+
/reference/_autoapi/docbuild/config/app/PlaceholderSyntaxError
2930

3031
.. autoapisummary::
3132

3233
docbuild.config.app.PlaceholderResolutionError
3334
docbuild.config.app.CircularReferenceError
35+
docbuild.config.app.PlaceholderSyntaxError
3436

3537

3638
Classes
@@ -85,5 +87,6 @@ Module Contents
8587
:return: A new dictionary with placeholders replaced.
8688
:raises PlaceholderResolutionError: If a placeholder cannot be resolved.
8789
:raises CircularReferenceError: If a circular reference is detected.
90+
:raises PlaceholderSyntaxError: If a placeholder has invalid syntax.
8891

8992

docs/source/reference/_autoapi/docbuild/utils/errors/index.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Functions
1515
.. autoapisummary::
1616

1717
docbuild.utils.errors.format_pydantic_error
18+
docbuild.utils.errors.format_toml_error
1819

1920

2021
Module Contents
@@ -31,3 +32,12 @@ Module Contents
3132
:param console: Optional Rich console object. If None, creates a stderr console.
3233

3334

35+
.. py:function:: format_toml_error(error: tomllib.TOMLDecodeError, config_file: str, console: rich.console.Console | None = None) -> None
36+
37+
Format TOML syntax errors using Rich.
38+
39+
:param error: The caught TOMLDecodeError object.
40+
:param config_file: The name/path of the config file with the syntax error.
41+
:param console: Optional Rich console object.
42+
43+

0 commit comments

Comments
 (0)