From ad8c2a3ac8daf0b0c06579b6ba667e05feffa247 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?= Date: Sun, 6 Aug 2023 12:26:40 +0200 Subject: [PATCH 1/4] deps: Set upper bound on Griffe (0.33) The next Griffe version will be incompatible with our templates here, so we set an upper bound until we adapt our templates. Our next version will set the lower bound on Griffe 0.33. --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index ab51fb01..3f53308b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,7 +29,7 @@ classifiers = [ ] dependencies = [ "mkdocstrings>=0.20", - "griffe>=0.30", + "griffe>=0.30,<0.33", ] [project.urls] From b1651bbeebf7aa4ddae4e966953d3cb895c89cc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?= Date: Sun, 6 Aug 2023 12:38:39 +0200 Subject: [PATCH 2/4] tests: Fix tests for MkDocs 1.5 --- tests/conftest.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/conftest.py b/tests/conftest.py index b4f3e42e..58de9e0f 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -37,6 +37,7 @@ def fixture_mkdocs_conf(request: pytest.FixtureRequest, tmp_path: Path) -> Itera request = request._parent_request conf_dict = { + "config_file_path": "mkdocs.yml", "site_name": "foo", "site_url": "https://example.org/", "site_dir": str(tmp_path), From 55f08f3e2cece815dd79d35c82515ba8003ec64c Mon Sep 17 00:00:00 2001 From: Antoine Dechaume Date: Wed, 2 Aug 2023 16:55:40 +0200 Subject: [PATCH 3/4] feat: Show parameter default values within the "list" section style too MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR #92: https://github.com/mkdocstrings/python/pull/92 Co-authored-by: Timothée Mazzucotelli --- .../templates/material/_base/docstring/parameters.html | 9 +++++++-- .../python/templates/material/_base/languages/en.html | 1 + .../python/templates/material/_base/languages/ja.html | 1 + .../python/templates/material/_base/languages/zh.html | 1 + .../templates/readthedocs/docstring/parameters.html | 7 ++++++- .../python/templates/readthedocs/languages/en.html | 1 + .../python/templates/readthedocs/languages/ja.html | 1 + .../python/templates/readthedocs/languages/zh.html | 1 + 8 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html index 515be812..914e0a71 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html +++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html @@ -53,7 +53,12 @@ {{ parameter.name }} {% if parameter.annotation %} {% with expression = parameter.annotation %} - ({% include "expression.html" with context %}) + ({% include "expression.html" with context %} + {%- if parameter.default %}, {{ lang.t("default:") }} + {% with expression = parameter.default %} + {% include "expression.html" with context %} + {% endwith %} + {% endif %}) {% endwith %} {% endif %} – @@ -105,4 +110,4 @@ {% endblock spacy_style %} -{% endif %} \ No newline at end of file +{% endif %} diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/languages/en.html b/src/mkdocstrings_handlers/python/templates/material/_base/languages/en.html index 5836cccf..2e50607b 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/languages/en.html +++ b/src/mkdocstrings_handlers/python/templates/material/_base/languages/en.html @@ -4,6 +4,7 @@ "Attributes:": "Attributes:", "DEFAULT:": "DEFAULT:", "Default": "Default", + "default:": "default:", "DESCRIPTION": "DESCRIPTION", "Description": "Description", "Examples:": "Examples:", diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/languages/ja.html b/src/mkdocstrings_handlers/python/templates/material/_base/languages/ja.html index 6b52ebcd..3698b81a 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/languages/ja.html +++ b/src/mkdocstrings_handlers/python/templates/material/_base/languages/ja.html @@ -4,6 +4,7 @@ "Attributes:": "属性:", "DEFAULT:": "デフォルト:", "Default": "デフォルト", + "default:": "デフォルト:", "DESCRIPTION": "デスクリプション", "Description": "デスクリプション", "Examples:": "例:", diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/languages/zh.html b/src/mkdocstrings_handlers/python/templates/material/_base/languages/zh.html index a1516f15..e66fa2e2 100644 --- a/src/mkdocstrings_handlers/python/templates/material/_base/languages/zh.html +++ b/src/mkdocstrings_handlers/python/templates/material/_base/languages/zh.html @@ -4,6 +4,7 @@ "Attributes:": "属性:", "DEFAULT:": "默认:", "Default": "默认", + "default:": "默认:", "DESCRIPTION": "描述", "Description": "描述", "Examples:": "示例:", diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/parameters.html b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/parameters.html index 461fe2a1..30a8be16 100644 --- a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/parameters.html +++ b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/parameters.html @@ -17,7 +17,12 @@ {{ parameter.name }} {% if parameter.annotation %} {% with expression = parameter.annotation %} - ({% include "expression.html" with context %}) + ({% include "expression.html" with context %} + {%- if parameter.default %}, {{ lang.t("default:") }} + {% with expression = parameter.default %} + {% include "expression.html" with context %} + {% endwith %} + {% endif %}) {% endwith %} {% endif %} – diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/languages/en.html b/src/mkdocstrings_handlers/python/templates/readthedocs/languages/en.html index acc6d5a7..9c59b431 100644 --- a/src/mkdocstrings_handlers/python/templates/readthedocs/languages/en.html +++ b/src/mkdocstrings_handlers/python/templates/readthedocs/languages/en.html @@ -3,6 +3,7 @@ "Attributes:": "Attributes:", "Other parameters:": "Other parameters:", "Parameters:": "Parameters:", + "default:": "default:", "Raises:" : "Raises:", "Receives:": "Receives:", "Returns:": "Returns:", diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/languages/ja.html b/src/mkdocstrings_handlers/python/templates/readthedocs/languages/ja.html index 9ae4a568..41b079dc 100644 --- a/src/mkdocstrings_handlers/python/templates/readthedocs/languages/ja.html +++ b/src/mkdocstrings_handlers/python/templates/readthedocs/languages/ja.html @@ -3,6 +3,7 @@ "Attributes:": "属性:", "Other Parameters:": "他の引数:", "Parameters:": "引数:", + "default:": "デフォルト:", "Raises:" : "発生:", "Receives:": "取得:", "Returns:": "戻り値:", diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/languages/zh.html b/src/mkdocstrings_handlers/python/templates/readthedocs/languages/zh.html index 42184f9c..3cd7b9dc 100644 --- a/src/mkdocstrings_handlers/python/templates/readthedocs/languages/zh.html +++ b/src/mkdocstrings_handlers/python/templates/readthedocs/languages/zh.html @@ -3,6 +3,7 @@ "Attributes:": "属性:", "Other Parameters:": "其他参数:", "Parameters:": "参数:", + "default:": "默认:", "Raises:" : "引发:", "Receives:": "接收:", "Returns:": "返回:", From c5efc652284fc364fee64ca9ba36413af5b9dc40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?= Date: Sun, 6 Aug 2023 12:42:18 +0200 Subject: [PATCH 4/4] chore: Prepare release 1.3.0 --- CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ad7209c1..faed7fef 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.3.0](https://github.com/mkdocstrings/python/releases/tag/1.3.0) - 2023-08-06 + +[Compare with 1.2.1](https://github.com/mkdocstrings/python/compare/1.2.1...1.3.0) + +### Dependencies + +- Set upper bound on Griffe (0.33) ([ad8c2a3](https://github.com/mkdocstrings/python/commit/ad8c2a3ac8daf0b0c06579b6ba667e05feffa247) by Timothée Mazzucotelli). See https://github.com/mkdocstrings/griffe/discussions/195. + +### Features + +- Show parameter default values within the "list" section style too ([55f08f3](https://github.com/mkdocstrings/python/commit/55f08f3e2cece815dd79d35c82515ba8003ec64c) by Antoine Dechaume). [PR #92](https://github.com/mkdocstrings/python/pull/92), Co-authored-by: Timothée Mazzucotelli + ## [1.2.1](https://github.com/mkdocstrings/python/releases/tag/1.2.1) - 2023-07-20 [Compare with 1.2.0](https://github.com/mkdocstrings/python/compare/1.2.0...1.2.1)