From 81d698e5073e6158b2e269c279ee546163fd6ce8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?= Date: Fri, 30 Aug 2024 19:36:34 +0200 Subject: [PATCH 1/4] chore: Clean up check duty --- duties.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/duties.py b/duties.py index 56c54aa6..f1909cc1 100644 --- a/duties.py +++ b/duties.py @@ -53,8 +53,8 @@ def changelog(ctx: Context, bump: str = "") -> None: ctx.run(tools.git_changelog(bump=bump or None), title="Updating changelog") -@duty(pre=["check_quality", "check_types", "check_docs", "check_dependencies", "check-api"]) -def check(ctx: Context) -> None: # noqa: ARG001 +@duty(pre=["check_quality", "check_types", "check_docs", "check-api"]) +def check(ctx: Context) -> None: """Check it all!""" From 2299ab55641585d65babe0e116a6465b4736dcd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?= Date: Fri, 30 Aug 2024 19:36:58 +0200 Subject: [PATCH 2/4] build: Explicitly depend on mkdocs-autorefs to be able to specify lower bound --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index fcc1022c..f1ff7334 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,6 +30,7 @@ classifiers = [ ] dependencies = [ "mkdocstrings>=0.25", + "mkdocs-autorefs>=1.0", "griffe>=0.49", ] From 68cb72f62253f54146ece621345b36c90d712913 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?= Date: Fri, 30 Aug 2024 19:55:02 +0200 Subject: [PATCH 3/4] refactor: Use new autorefs syntax --- docs/usage/configuration/docstrings.md | 12 ++++++------ docs/usage/configuration/general.md | 2 +- docs/usage/configuration/members.md | 12 ++++++------ src/mkdocstrings_handlers/python/rendering.py | 7 +++++-- .../material/_base/docstring/attributes.html.jinja | 6 +++--- .../material/_base/docstring/classes.html.jinja | 6 +++--- .../material/_base/docstring/functions.html.jinja | 6 +++--- .../material/_base/docstring/modules.html.jinja | 6 +++--- .../templates/material/_base/expression.html.jinja | 4 ++-- 9 files changed, 32 insertions(+), 29 deletions(-) diff --git a/docs/usage/configuration/docstrings.md b/docs/usage/configuration/docstrings.md index dcb35f5e..027ebaed 100644 --- a/docs/usage/configuration/docstrings.md +++ b/docs/usage/configuration/docstrings.md @@ -208,8 +208,8 @@ In that case, the Spacy tables can help. **Type** | **Name** | **Description** | **Default** ---------- | ----------- | ------------------------ | ----------- -list[int \| float] | `gravity_forces` | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. | *required* -VacuumType \| Literal["regular"] | `vacuum_type` | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. | `VacuumType.PLASMA` +list[int \| float] | `gravity_forces` | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. | *required* +VacuumType \| Literal["regular"] | `vacuum_type` | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. | `VacuumType.PLASMA` //// //// tab | List @@ -222,8 +222,8 @@ Lists work well whatever the length of names, type annotations, descriptions, et **Other Parameters:** -- `gravity_forces` (list[int \| float]) — Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. -- `vacuum_type` (VacuumType \| Literal["regular"]) — Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. +- `gravity_forces` (list[int \| float]) — Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. +- `vacuum_type` (VacuumType \| Literal["regular"]) — Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. //// //// tab | Spacy @@ -241,8 +241,8 @@ by reserving more horizontal space on the second column. **Name** | **Description** ----------- | --------------- -`gravity_forces` | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
**TYPE:** list[int \| float] DEFAULT: required -`vacuum_type` | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
**TYPE:**VacuumType \| Literal["regular"] DEFAULT: VacuumType.PLASMA +`gravity_forces` | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
**TYPE:** list[int \| float] DEFAULT: required +`vacuum_type` | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
**TYPE:**VacuumType \| Literal["regular"] DEFAULT: VacuumType.PLASMA //// /// diff --git a/docs/usage/configuration/general.md b/docs/usage/configuration/general.md index e4ddaec1..d8d7f250 100644 --- a/docs/usage/configuration/general.md +++ b/docs/usage/configuration/general.md @@ -139,7 +139,7 @@ def some_function(): ## `preload_modules` -- **:octicons-package-24: Type list[str] | None :material-equal: `None`{ title="default value" }** +- **:octicons-package-24: Type list[str] | None :material-equal: `None`{ title="default value" }** Pre-load modules that are not specified directly in [autodoc instructions][autodoc syntax] (`::: identifier`). diff --git a/docs/usage/configuration/members.md b/docs/usage/configuration/members.md index 1e5ff771..119d8294 100644 --- a/docs/usage/configuration/members.md +++ b/docs/usage/configuration/members.md @@ -2,8 +2,8 @@ ## `members` -- **:octicons-package-24: Type list[str] | - bool | None :material-equal: `None`{ title="default value" }** +- **:octicons-package-24: Type list[str] | + bool | None :material-equal: `None`{ title="default value" }** An explicit list of members to render. @@ -97,8 +97,8 @@ INFO: **The default behavior (with unspecified `members` or `members: null`) is ## `inherited_members` -- **:octicons-package-24: Type list[str] | - bool :material-equal: `False`{ title="default value" }** +- **:octicons-package-24: Type list[str] | + bool :material-equal: `False`{ title="default value" }** An explicit list of inherited members (for classes) to render. @@ -331,7 +331,7 @@ def function_c(): ## `filters` -- **:octicons-package-24: Type list[str] | None :material-equal: `["!^_[^_]"]`{ title="default value" }** +- **:octicons-package-24: Type list[str] | None :material-equal: `["!^_[^_]"]`{ title="default value" }** A list of filters applied to filter objects based on their name. @@ -555,7 +555,7 @@ package [:octicons-heart-fill-24:{ .pulse } Sponsors only](../../insiders/index.md){ .insiders } — [:octicons-tag-24: Insiders 1.2.0](../../insiders/changelog.md#1.2.0) -- **:octicons-package-24: Type bool | dict[str, bool] :material-equal: `False`{ title="default value" }** +- **:octicons-package-24: Type bool | dict[str, bool] :material-equal: `False`{ title="default value" }** Whether to render summaries of modules, classes, functions (methods) and attributes. diff --git a/src/mkdocstrings_handlers/python/rendering.py b/src/mkdocstrings_handlers/python/rendering.py index b7fe3ad6..d5a88699 100644 --- a/src/mkdocstrings_handlers/python/rendering.py +++ b/src/mkdocstrings_handlers/python/rendering.py @@ -295,7 +295,10 @@ def do_crossref(path: str, *, brief: bool = True) -> Markup: full_path = path if brief: path = full_path.split(".")[-1] - return Markup("{path}").format(full_path=full_path, path=path) + return Markup("{path}").format( + full_path=full_path, + path=path, + ) @lru_cache @@ -327,7 +330,7 @@ def repl(match: Match) -> str: path = match.group() path_var = f"path{group_number}" variables[path_var] = path - return f"{{{path_var}}}" + return f"{{{path_var}}}" text = re.sub(r"([\w.]+)", repl, text) if code: diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html.jinja index 396e36dd..34aa0119 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html.jinja @@ -33,7 +33,7 @@ Context: {% for attribute in section.value %} - {{ attribute.name }} + {{ attribute.name }} {% if attribute.annotation %} {% with expression = attribute.annotation %} @@ -58,7 +58,7 @@ Context:
    {% for attribute in section.value %}
  • - {{ attribute.name }} + {{ attribute.name }} {% if attribute.annotation %} {% with expression = attribute.annotation %} ({% include "expression"|get_template with context %}) @@ -85,7 +85,7 @@ Context: {% for attribute in section.value %} - {{ attribute.name }} + {{ attribute.name }}
    {{ attribute.description|convert_markdown(heading_level, html_id) }} diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html.jinja index d21db25e..a3b494c9 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html.jinja @@ -32,7 +32,7 @@ Context: {% for class in section.value %} - {{ class.name }} + {{ class.name }}
    {{ class.description|convert_markdown(heading_level, html_id) }} @@ -50,7 +50,7 @@ Context:
      {% for class in section.value %}
    • - {{ class.name }} + {{ class.name }}
      {{ class.description|convert_markdown(heading_level, html_id) }} @@ -72,7 +72,7 @@ Context: {% for class in section.value %} - {{ class.name }} + {{ class.name }}
      {{ class.description|convert_markdown(heading_level, html_id) }} diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html.jinja index 89ce923f..efaf9a37 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html.jinja @@ -33,7 +33,7 @@ Context: {% for function in section.value %} {% if not function.name == "__init__" or not config.merge_init_into_class %} - {{ function.name }} + {{ function.name }}
      {{ function.description|convert_markdown(heading_level, html_id) }} @@ -53,7 +53,7 @@ Context: {% for function in section.value %} {% if not function.name == "__init__" or not config.merge_init_into_class %}
    • - {{ function.name }} + {{ function.name }}
      {{ function.description|convert_markdown(heading_level, html_id) }} @@ -77,7 +77,7 @@ Context: {% for function in section.value %} {% if not function.name == "__init__" or not config.merge_init_into_class %} - {{ function.name }} + {{ function.name }}
      {{ function.description|convert_markdown(heading_level, html_id) }} diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html.jinja index 49fc9d80..caec690f 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html.jinja @@ -32,7 +32,7 @@ Context: {% for module in section.value %} - {{ module.name }} + {{ module.name }}
      {{ module.description|convert_markdown(heading_level, html_id) }} @@ -50,7 +50,7 @@ Context:
        {% for module in section.value %}
      • - {{ module.name }} + {{ module.name }}
        {{ module.description|convert_markdown(heading_level, html_id) }} @@ -72,7 +72,7 @@ Context: {% for module in section.value %} - {{ module.name }} + {{ module.name }}
        {{ module.description|convert_markdown(heading_level, html_id) }} diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/expression.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/expression.html.jinja index 67f02bb3..f150afd1 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/expression.html.jinja +++ b/src/mkdocstrings_handlers/python/templates/material/_base/expression.html.jinja @@ -21,7 +21,7 @@ which is a tree-like structure representing a Python expression. annotation_path (str): Either "brief", "source", or "full". Returns: - Either a cross-reference (using an autorefs span) or the name itself. + Either a cross-reference (using an autoref element) or the name itself. -#} {%- with full = name.canonical_path -%} {%- if annotation_path == "brief" -%} @@ -34,7 +34,7 @@ which is a tree-like structure representing a Python expression. {%- for title, path in annotation|split_path(full) -%} {%- if not signature or config.signature_crossrefs -%} {%- filter stash_crossref(length=title|length) -%} - {{ title }} + {{ title }} {%- endfilter -%} {%- else -%} {{ title }} From 2d59cdbc497c7cfd69ddcfc316db287889c0e6f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?= Date: Fri, 30 Aug 2024 20:04:40 +0200 Subject: [PATCH 4/4] chore: Prepare release 1.10.9 --- CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 13c080cb..947cfe99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,18 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [1.10.9](https://github.com/mkdocstrings/python/releases/tag/1.10.9) - 2024-08-30 + +[Compare with 1.10.8](https://github.com/mkdocstrings/python/compare/1.10.8...1.10.9) + +### Build + +- Explicitly depend on mkdocs-autorefs to be able to specify lower bound ([2299ab5](https://github.com/mkdocstrings/python/commit/2299ab55641585d65babe0e116a6465b4736dcd9) by Timothée Mazzucotelli). + +### Code Refactoring + +- Use new autorefs syntax ([68cb72f](https://github.com/mkdocstrings/python/commit/68cb72f62253f54146ece621345b36c90d712913) by Timothée Mazzucotelli). + ## [1.10.8](https://github.com/mkdocstrings/python/releases/tag/1.10.8) - 2024-08-14 [Compare with 1.10.7](https://github.com/mkdocstrings/python/compare/1.10.7...1.10.8)