Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

📚 DOCS: Move config #4

Merged
merged 3 commits into from
Feb 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,18 +167,18 @@ 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:
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]":
Expand Down
29 changes: 29 additions & 0 deletions docs/config.md
Original file line number Diff line number Diff line change
@@ -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)=
## By 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}
```
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@ Or checkout the the [Example API Documentation](apidocs/index.rst) ✨
:maxdepth: 2

quickstart
config
apidocs/index
```
27 changes: 0 additions & 27 deletions docs/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -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}
```