Skip to content

Commit 941b153

Browse files
committed
mkdocs: Improve API reference signatures formatting
This commit improves the API reference formatting of signatures by adding the following options to the `mkdocstrings` plugin: - `separate_signature`: Separate the signature from the description. - `show_signature_annotations`: Show the signature annotations. - `signature_crossrefs`: Show cross-references in the signature (this is added only to be prepared for the future, as this is an insiders only feature for now). We also add `black` as a dependency to generate the docs because it is used to format the signatures nicely. Signed-off-by: Leandro Lucarella <[email protected]>
1 parent 1b305b6 commit 941b153

File tree

14 files changed

+28
-0
lines changed

14 files changed

+28
-0
lines changed

cookiecutter/{{cookiecutter.github_repo_name}}/mkdocs.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,13 @@ plugins:
108108
docstring_section_style: spacy
109109
inherited_members: true
110110
merge_init_into_class: false
111+
separate_signature: true
111112
show_category_heading: true
112113
show_root_heading: true
113114
show_root_members_full_path: true
115+
show_signature_annotations: true
114116
show_source: true
117+
signature_crossrefs: true
115118
import:
116119
# TODO(cookiecutter): You might want to add other external references here
117120
# See https://mkdocstrings.github.io/python/usage/#import for details

cookiecutter/{{cookiecutter.github_repo_name}}/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ dev-flake8 = [
6969
]
7070
dev-formatting = ["black == 23.9.1", "isort == 5.12.0"]
7171
dev-mkdocs = [
72+
"black == 23.9.1",
7273
"Markdown==3.4.4",
7374
"mike == 1.1.2",
7475
"mkdocs-gen-files == 0.5.0",

mkdocs.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,13 @@ plugins:
104104
docstring_section_style: spacy
105105
inherited_members: true
106106
merge_init_into_class: false
107+
separate_signature: true
107108
show_category_heading: true
108109
show_root_heading: true
109110
show_root_members_full_path: true
111+
show_signature_annotations: true
110112
show_source: true
113+
signature_crossrefs: true
111114
import:
112115
- https://cookiecutter.readthedocs.io/en/stable/objects.inv
113116
- https://docs.python.org/3/objects.inv

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ dev-flake8 = [
7575
]
7676
dev-formatting = ["black == 23.9.1", "isort == 5.12.0"]
7777
dev-mkdocs = [
78+
"black == 23.9.1",
7879
"Markdown==3.4.4",
7980
"mike == 1.1.2",
8081
"mkdocs-gen-files == 0.5.0",

tests_golden/integration/test_cookiecutter_generation/actor/frequenz-actor-test/mkdocs.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,13 @@ plugins:
108108
docstring_section_style: spacy
109109
inherited_members: true
110110
merge_init_into_class: false
111+
separate_signature: true
111112
show_category_heading: true
112113
show_root_heading: true
113114
show_root_members_full_path: true
115+
show_signature_annotations: true
114116
show_source: true
117+
signature_crossrefs: true
115118
import:
116119
# TODO(cookiecutter): You might want to add other external references here
117120
# See https://mkdocstrings.github.io/python/usage/#import for details

tests_golden/integration/test_cookiecutter_generation/actor/frequenz-actor-test/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ dev-flake8 = [
5151
]
5252
dev-formatting = ["black == 23.9.1", "isort == 5.12.0"]
5353
dev-mkdocs = [
54+
"black == 23.9.1",
5455
"Markdown==3.4.4",
5556
"mike == 1.1.2",
5657
"mkdocs-gen-files == 0.5.0",

tests_golden/integration/test_cookiecutter_generation/api/frequenz-api-test/mkdocs.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,13 @@ plugins:
108108
docstring_section_style: spacy
109109
inherited_members: true
110110
merge_init_into_class: false
111+
separate_signature: true
111112
show_category_heading: true
112113
show_root_heading: true
113114
show_root_members_full_path: true
115+
show_signature_annotations: true
114116
show_source: true
117+
signature_crossrefs: true
115118
import:
116119
# TODO(cookiecutter): You might want to add other external references here
117120
# See https://mkdocstrings.github.io/python/usage/#import for details

tests_golden/integration/test_cookiecutter_generation/api/frequenz-api-test/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ dev-flake8 = [
4949
]
5050
dev-formatting = ["black == 23.9.1", "isort == 5.12.0"]
5151
dev-mkdocs = [
52+
"black == 23.9.1",
5253
"Markdown==3.4.4",
5354
"mike == 1.1.2",
5455
"mkdocs-gen-files == 0.5.0",

tests_golden/integration/test_cookiecutter_generation/app/frequenz-app-test/mkdocs.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,13 @@ plugins:
108108
docstring_section_style: spacy
109109
inherited_members: true
110110
merge_init_into_class: false
111+
separate_signature: true
111112
show_category_heading: true
112113
show_root_heading: true
113114
show_root_members_full_path: true
115+
show_signature_annotations: true
114116
show_source: true
117+
signature_crossrefs: true
115118
import:
116119
# TODO(cookiecutter): You might want to add other external references here
117120
# See https://mkdocstrings.github.io/python/usage/#import for details

tests_golden/integration/test_cookiecutter_generation/app/frequenz-app-test/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ dev-flake8 = [
5050
]
5151
dev-formatting = ["black == 23.9.1", "isort == 5.12.0"]
5252
dev-mkdocs = [
53+
"black == 23.9.1",
5354
"Markdown==3.4.4",
5455
"mike == 1.1.2",
5556
"mkdocs-gen-files == 0.5.0",

0 commit comments

Comments
 (0)