From 47b4115d1b843e2c2f11fa0887a10d1d98be9732 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?= Date: Tue, 5 Sep 2023 15:00:34 +0200 Subject: [PATCH 1/6] chore: Template upgrade --- .copier-answers.yml | 2 +- docs/css/mkdocstrings.css | 1 + duties.py | 8 ++------ mkdocs.yml | 2 ++ scripts/insiders.py | 11 +++++++---- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/.copier-answers.yml b/.copier-answers.yml index 9869a311..9c4832f4 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,5 +1,5 @@ # Changes here will be overwritten by Copier -_commit: 0.16.5 +_commit: 0.16.9 _src_path: gh:pawamoy/copier-pdm author_email: pawamoy@pm.me author_fullname: Timothée Mazzucotelli diff --git a/docs/css/mkdocstrings.css b/docs/css/mkdocstrings.css index fe191c8c..727a614c 100644 --- a/docs/css/mkdocstrings.css +++ b/docs/css/mkdocstrings.css @@ -9,6 +9,7 @@ a.external::after, a.autorefs-external::after { /* https://primer.style/octicons/arrow-up-right-24 */ mask-image: url('data:image/svg+xml,'); + -webkit-mask-image: url('data:image/svg+xml,'); content: ' '; display: inline-block; diff --git a/duties.py b/duties.py index 1e37569f..8e3dbf64 100644 --- a/duties.py +++ b/duties.py @@ -4,21 +4,17 @@ import os import sys +from importlib.metadata import version as pkgversion from pathlib import Path from typing import TYPE_CHECKING, Any from duty import duty from duty.callables import black, blacken_docs, coverage, lazy, mkdocs, mypy, pytest, ruff, safety -if sys.version_info < (3, 8): - from importlib_metadata import version as pkgversion -else: - from importlib.metadata import version as pkgversion - - if TYPE_CHECKING: from duty.context import Context + PY_SRC_PATHS = (Path(_) for _ in ("src", "tests", "duties.py", "scripts")) PY_SRC_LIST = tuple(str(_) for _ in PY_SRC_PATHS) PY_SRC = " ".join(PY_SRC_LIST) diff --git a/mkdocs.yml b/mkdocs.yml index 4bf8abe1..31544367 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -148,6 +148,7 @@ plugins: docstring_options: ignore_init_summary: true docstring_section_style: list + filters: ["!^_"] heading_level: 1 inherited_members: true merge_init_into_class: true @@ -159,6 +160,7 @@ plugins: show_symbol_type_heading: true show_symbol_type_toc: true signature_crossrefs: true + summary: true - git-committers: enabled: !ENV [DEPLOY, false] repository: mkdocstrings/python diff --git a/scripts/insiders.py b/scripts/insiders.py index 6f8d0d84..28ca1c87 100644 --- a/scripts/insiders.py +++ b/scripts/insiders.py @@ -39,11 +39,13 @@ class Feature: """Class representing an Insiders feature.""" name: str - ref: str + ref: str | None since: date | None project: Project | None - def url(self, rel_base: str = "..") -> str: # noqa: D102 + def url(self, rel_base: str = "..") -> str | None: # noqa: D102 + if not self.ref: + return None if self.project: rel_base = self.project.url return posixpath.join(rel_base, self.ref.lstrip("/")) @@ -56,7 +58,8 @@ def render(self, rel_base: str = "..", *, badge: bool = False) -> None: # noqa: ft_date = self.since.strftime("%B %d, %Y") # type: ignore[union-attr] new = f' :material-alert-decagram:{{ .new-feature .vibrate title="Added on {ft_date}" }}' project = f"[{self.project.name}]({self.project.url}) — " if self.project else "" - print(f"- [{'x' if self.since else ' '}] {project}[{self.name}]({self.url(rel_base)}){new}") + feature = f"[{self.name}]({self.url(rel_base)})" if self.ref else self.name + print(f"- [{'x' if self.since else ' '}] {project}{feature}{new}") @dataclass @@ -99,7 +102,7 @@ def load_goals(data: str, funding: int = 0, project: Project | None = None) -> d features=[ Feature( name=feature_data["name"], - ref=feature_data["ref"], + ref=feature_data.get("ref"), since=feature_data.get("since") and datetime.strptime(feature_data["since"], "%Y/%m/%d").date(), # noqa: DTZ007 project=project, From 1ae8dd89cddd67c09d7d30c59b9013516cea2924 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?= Date: Sun, 10 Sep 2023 16:51:47 +0200 Subject: [PATCH 2/6] refactor: Wrap docstring section elements (list style) in code tags to prevent spell checker errors --- .../python/templates/material/_base/docstring/attributes.html | 2 +- .../python/templates/material/_base/docstring/classes.html | 2 +- .../python/templates/material/_base/docstring/functions.html | 2 +- .../python/templates/material/_base/docstring/modules.html | 2 +- .../templates/material/_base/docstring/other_parameters.html | 2 +- .../python/templates/material/_base/docstring/parameters.html | 2 +- .../python/templates/material/_base/docstring/receives.html | 2 +- .../python/templates/material/_base/docstring/returns.html | 2 +- .../python/templates/material/_base/docstring/yields.html | 2 +- .../python/templates/readthedocs/docstring/attributes.html | 2 +- .../templates/readthedocs/docstring/other_parameters.html | 2 +- .../python/templates/readthedocs/docstring/parameters.html | 2 +- .../python/templates/readthedocs/docstring/receives.html | 2 +- .../python/templates/readthedocs/docstring/returns.html | 2 +- .../python/templates/readthedocs/docstring/yields.html | 2 +- 15 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html index 296f1557..6dc82d66 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html @@ -40,7 +40,7 @@