Skip to content

Commit 9a284e5

Browse files
authored
Docs: fix mkdocstings config and improve api autodoc (#357)
2 parents 7ba4bd5 + b188451 commit 9a284e5

File tree

7 files changed

+50
-24
lines changed

7 files changed

+50
-24
lines changed

docs/api.md

+18-4
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,32 @@ icon: fontawesome/solid/code
1212

1313
::: mkdocs_rss_plugin.config.RssPluginConfig
1414

15+
::: mkdocs_rss_plugin.config._DateFromMeta
16+
17+
::: mkdocs_rss_plugin.config._FeedsFilenamesConfig
18+
1519
----
1620

1721
::: mkdocs_rss_plugin.constants
1822

19-
----
23+
## Models
2024

2125
::: mkdocs_rss_plugin.models.PageInformation
2226

23-
----
24-
25-
::: mkdocs_rss_plugin.util.Util
27+
::: mkdocs_rss_plugin.models.RssFeedBase
2628

2729
## Integrations
2830

31+
::: mkdocs_rss_plugin.integrations.theme_material_base.IntegrationMaterialThemeBase
32+
33+
::: mkdocs_rss_plugin.integrations.theme_material_blog_plugin.IntegrationMaterialBlog
34+
2935
::: mkdocs_rss_plugin.integrations.theme_material_social_plugin.IntegrationMaterialSocialCards
36+
37+
## Utils
38+
39+
::: mkdocs_rss_plugin.git_manager.ci.CiHandler
40+
41+
::: mkdocs_rss_plugin.timezoner
42+
43+
::: mkdocs_rss_plugin.util.Util

mkdocs.yml

+8-4
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,17 @@ plugins:
9191
handlers:
9292
python:
9393
options:
94+
docstring_options:
95+
ignore_init_summary: false
96+
trim_doctest_flags: true
9497
docstring_style: google
98+
find_stubs_package: true
9599
heading_level: 3
96-
ignore_init_summary: false
100+
show_bases: true
101+
show_inheritance_diagram: true
102+
show_root_heading: true
97103
show_source: false
98-
merge_init_into_class: true
99-
paths: [.]
100-
show_root_heading: true
104+
merge_init_into_class: true
101105

102106
- privacy:
103107
enabled: !ENV [MKDOCS_ENABLE_PLUGIN_PRIVACY, true]

mkdocs_rss_plugin/constants.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
# ########## Globals #############
1515
# ################################
1616

17-
DEFAULT_CACHE_FOLDER = Path(".cache/plugins/rss")
18-
DEFAULT_TEMPLATE_FOLDER = Path(__file__).parent / "templates"
19-
DEFAULT_TEMPLATE_FILENAME = DEFAULT_TEMPLATE_FOLDER / "rss.xml.jinja2"
20-
MKDOCS_LOGGER_NAME = "[RSS-plugin]"
21-
REMOTE_REQUEST_HEADERS = {
17+
DEFAULT_CACHE_FOLDER: Path = Path(".cache/plugins/rss")
18+
DEFAULT_TEMPLATE_FOLDER: Path = Path(__file__).parent / "templates"
19+
DEFAULT_TEMPLATE_FILENAME: Path = DEFAULT_TEMPLATE_FOLDER / "rss.xml.jinja2"
20+
MKDOCS_LOGGER_NAME: str = "[RSS-plugin]"
21+
REMOTE_REQUEST_HEADERS: dict[str, str] = {
2222
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
2323
"User-Agent": f"{__about__.__title__}/{__about__.__version__}",
2424
}

mkdocs_rss_plugin/git_manager/ci.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,14 @@
2727

2828

2929
class CiHandler:
30-
def __init__(self, repo: Git):
30+
"""Helper class to handle CI specific warnings."""
31+
32+
def __init__(self, repo: Git) -> None:
33+
"""Initialize the CI handler.
34+
35+
Args:
36+
repo (Git): Git repository object
37+
"""
3138
self.repo = repo
3239

3340
def raise_ci_warnings(self) -> None:

mkdocs_rss_plugin/models.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
@dataclass
2222
class PageInformation:
23-
"""Data type to set and get page information in order to produce the RSS feed."""
23+
"""Object describing a page information gathered from Mkdocs and used as feed's item."""
2424

2525
abs_path: Optional[Path] = None
2626
categories: Optional[list] = None
@@ -37,6 +37,8 @@ class PageInformation:
3737

3838
@dataclass
3939
class RssFeedBase:
40+
"""Object describing a feed."""
41+
4042
author: Optional[str] = None
4143
buildDate: Optional[str] = None
4244
copyright: Optional[str] = None

mkdocs_rss_plugin/timezoner.py

+7-8
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,13 @@ def set_datetime_zoneinfo(
3838
) -> datetime:
3939
"""Apply timezone to a naive datetime.
4040
41-
:param input_datetime: offset-naive datetime
42-
:type input_datetime: datetime
43-
:param config_timezone: name of timezone as registered in IANA database,
44-
defaults to "UTC". Example : Europe/Paris.
45-
:type config_timezone: str, optional
46-
47-
:return: offset-aware datetime
48-
:rtype: datetime
41+
Args:
42+
input_datetime (datetime): offset-naive datetime
43+
config_timezone (str, optional): name of timezone as registered in IANA
44+
database. Defaults to "UTC". Example : Europe/Paris.
45+
46+
Returns:
47+
datetime: offset-aware datetime
4948
"""
5049
if input_datetime.tzinfo:
5150
return input_datetime

requirements/documentation.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ mkdocs-git-committers-plugin-2>=2.4.1,<2.6
55
mkdocs-git-revision-date-localized-plugin>=1.3,<1.4
66
mkdocs-material[imaging]>=9.5.47,<10
77
mkdocs-minify-plugin>=0.8,<0.9
8-
mkdocstrings[python]>=0.27,<1
8+
mkdocstrings-python>=1.16.2,<1.17
99
termynal>=0.12.2,<0.13

0 commit comments

Comments
 (0)