From 38ba116711647754bbfb3de5fc399858c69ac2af Mon Sep 17 00:00:00 2001 From: Chris Sewell Date: Fri, 24 Feb 2023 05:14:44 +0100 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=93=9A=20DOCS:=20Move=20config?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/conf.py | 10 +++++----- docs/config.md | 29 +++++++++++++++++++++++++++++ docs/index.md | 1 + docs/quickstart.md | 27 --------------------------- 4 files changed, 35 insertions(+), 32 deletions(-) create mode 100644 docs/config.md diff --git a/docs/conf.py b/docs/conf.py index 6938c71..101eb34 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -170,15 +170,15 @@ def run(self) -> t.List[nodes.Node]: def type_to_string(type_: t.Type[t.Any]) -> str: """Convert a type to a string.""" # TODO just keeping it simple for now but can we do this with astroid!? - if type_ is str: + if type_ is str or type_ is (str,): return "``str``" - if type_ is int: + if type_ is int or type_ is (int,): return "``int``" - if type_ is bool: + if type_ is bool or type_ is (bool,): return "``bool``" - if type_ is float: + if type_ is float or type_ is (float,): return "``float``" - if type_ is list: + if type_ is list or type_ is (list,): return "``list``" type_string = str(type_) if type_string == "typing.Optional[str]": diff --git a/docs/config.md b/docs/config.md new file mode 100644 index 0000000..f603d41 --- /dev/null +++ b/docs/config.md @@ -0,0 +1,29 @@ +# Configuration + +(config:global)= +## Global + +This section describes the configuration options for `sphinx-autodoc2`, that you can set in the `conf.py` file. + +```{autodoc2-config} +``` + +(config:package)= +## Package + +In the `autodoc2_packages` configuration option, an item can be a string, or a dictionary such as: + +```python +autodoc2_packages = [ + "../src/autodoc2", + { + "path": "../src/other/module", + "module": "other.module", + }, +] +``` + +The following are keys allowed in the dictionary: + +```{autodoc2-config-package} +``` diff --git a/docs/index.md b/docs/index.md index ff28ee2..c583249 100644 --- a/docs/index.md +++ b/docs/index.md @@ -33,5 +33,6 @@ Or checkout the the [Example API Documentation](apidocs/index.rst) ✨ :maxdepth: 2 quickstart +config apidocs/index ``` diff --git a/docs/quickstart.md b/docs/quickstart.md index 9203763..2505129 100644 --- a/docs/quickstart.md +++ b/docs/quickstart.md @@ -213,30 +213,3 @@ since this version introduces improvements to the `fieldlist` extension ``` ```` - -## Global Configuration - -This section describes the configuration options for `sphinx-autodoc2`, that you can set in the `conf.py` file. - -```{autodoc2-config} -``` - -(config:package)= -## Package Configuration - -In the `autodoc2_packages` configuration option, an item can be a string, or a dictionary such as: - -```python -autodoc2_packages = [ - "../src/autodoc2", - { - "path": "../src/other/module", - "module": "other.module", - }, -] -``` - -The following are keys allowed in the dictionary: - -```{autodoc2-config-package} -``` From 898d80f1216fe0cac751bbe047c2bb6160075d76 Mon Sep 17 00:00:00 2001 From: Chris Sewell Date: Fri, 24 Feb 2023 05:16:13 +0100 Subject: [PATCH 2/3] Update conf.py --- docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 101eb34..79199cf 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -167,7 +167,7 @@ def run(self) -> t.List[nodes.Node]: return base_node.children # type: ignore -def type_to_string(type_: t.Type[t.Any]) -> str: +def type_to_string(type_: t.Any) -> str: """Convert a type to a string.""" # TODO just keeping it simple for now but can we do this with astroid!? if type_ is str or type_ is (str,): From f8e579c00856fb3905880029f472ecae57142cf0 Mon Sep 17 00:00:00 2001 From: Chris Sewell Date: Fri, 24 Feb 2023 05:17:15 +0100 Subject: [PATCH 3/3] Update config.md --- docs/config.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/config.md b/docs/config.md index f603d41..85822f5 100644 --- a/docs/config.md +++ b/docs/config.md @@ -9,7 +9,7 @@ This section describes the configuration options for `sphinx-autodoc2`, that you ``` (config:package)= -## Package +## By package In the `autodoc2_packages` configuration option, an item can be a string, or a dictionary such as: