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) 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] 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:": "返回:", 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),