`
- sponsors.forEach(function (sponsor) {
- html += `
-
-
-
- `
- });
- html += '
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
@@ -228,8 +228,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
@@ -247,8 +247,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.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.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.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.VacuumType \| Literal \["regular"\] DEFAULT: VacuumType.PLASMA
////
///
@@ -327,9 +327,6 @@ class Thing:
[](){#option-relative_crossrefs}
## `relative_crossrefs`
-[:octicons-heart-fill-24:{ .pulse } Sponsors only](../../insiders/index.md){ .insiders } —
-[:octicons-tag-24: Insiders 1.9.0](../../insiders/changelog.md#1.9.0)
-
- **:octicons-package-24: Type [`bool`][] :material-equal: `False`{ title="default value" }**
@@ -440,9 +437,6 @@ INFO: **There is an alternative, third-party Python handler that handles relativ
[](){#option-scoped_crossrefs}
## `scoped_crossrefs`
-[:octicons-heart-fill-24:{ .pulse } Sponsors only](../../insiders/index.md){ .insiders } —
-[:octicons-tag-24: Insiders 1.9.0](../../insiders/changelog.md#1.9.0)
-
- **:octicons-package-24: Type [`bool`][] :material-equal: `False`{ title="default value" }**
@@ -623,7 +617,7 @@ class ClassWithoutDocstring:
- **:octicons-package-24: Type [`bool`][] :material-equal: `True`{ title="default value" }**
-Whether to render the "Attributes" sections of docstrings.
+Whether to render the "Attributes" section of docstrings.
```yaml title="in mkdocs.yml (global configuration)"
plugins:
@@ -676,7 +670,7 @@ class Class:
- **:octicons-package-24: Type [`bool`][] :material-equal: `True`{ title="default value" }**
-Whether to render the "Functions" or "Methods" sections of docstrings.
+Whether to render the "Functions" or "Methods" section of docstrings.
```yaml title="in mkdocs.yml (global configuration)"
plugins:
@@ -751,7 +745,7 @@ class Class:
- **:octicons-package-24: Type [`bool`][] :material-equal: `True`{ title="default value" }**
-Whether to render the "Classes" sections of docstrings.
+Whether to render the "Classes" section of docstrings.
```yaml title="in mkdocs.yml (global configuration)"
plugins:
@@ -804,13 +798,71 @@ class Class:
////
///
+[](){#option-show_docstring_type_aliases}
+## `show_docstring_type_aliases`
+
+- **:octicons-package-24: Type [`bool`][] :material-equal: `True`{ title="default value" }**
+
+Whether to render the "Type Aliases" section of docstrings.
+
+```yaml title="in mkdocs.yml (global configuration)"
+plugins:
+- mkdocstrings:
+ handlers:
+ python:
+ options:
+ show_docstring_type_aliases: true
+```
+
+```md title="or in docs/some_page.md (local configuration)"
+::: path.to.module
+ options:
+ show_docstring_type_aliases: false
+```
+
+```python
+"""Summary.
+
+Type Aliases:
+ TypeAlias: Some type alias.
+"""
+
+
+type TypeAlias = int
+"""Summary."""
+```
+
+/// admonition | Preview
+ type: preview
+
+//// tab | With type_aliases
+Summary.
+Type Aliases:
+ +**Name** | **Description** +------------ | ---------------- +`TypeAlias` | Some type alias. + +TypeAliasSummary.
+//// + +//// tab | Without classes +Summary.
+TypeAliasSummary.
+//// +/// + [](){#option-show_docstring_modules} ## `show_docstring_modules` - **:octicons-package-24: Type [`bool`][] :material-equal: `True`{ title="default value" }** -Whether to render the "Modules" sections of docstrings. +Whether to render the "Modules" section of docstrings. ```yaml title="in mkdocs.yml (global configuration)" plugins: @@ -1245,6 +1297,57 @@ def rand() -> int: //// /// +[](){#option-show_docstring_type_parameters} +## `show_docstring_type_parameters` + +- **:octicons-package-24: Type [`bool`][] :material-equal: `True`{ title="default value" }** + + +Whether to render the "Type Parameters" section of docstrings. + +```yaml title="in mkdocs.yml (global configuration)" +plugins: +- mkdocstrings: + handlers: + python: + options: + show_docstring_type_parameters: true +``` + +```md title="or in docs/some_page.md (local configuration)" +::: path.to.module + options: + show_docstring_type_parameters: false +``` + +```python +class AClass[X: (int, str) = str]: + """Represents something. + + Type Parameters: + X: Something. + """ +``` + +/// admonition | Preview + type: preview + +//// tab | With parameters +AClassRepresents something.
+Type Parameters:
+ +**Name** | **Bound or Constraints** | **Description** | **Default** +---------- | ------------------------ | --------------- | ----------- +`whatever` | `(int, str)` | Something. | `str` +//// + +//// tab | Without parameters +AClassRepresents something.
+//// +/// + [](){#option-show_docstring_warns} ## `show_docstring_warns` diff --git a/docs/usage/configuration/general.md b/docs/usage/configuration/general.md index 3983a616..f44f4ac1 100644 --- a/docs/usage/configuration/general.md +++ b/docs/usage/configuration/general.md @@ -60,10 +60,49 @@ plugins: //// /// +[](){#option-backlinks} +## `backlinks` + +- **:octicons-package-24: TypeLiteral \["flat", "tree", False\] :material-equal: `False`{ title="default value" }**
+
+The `backlinks` option enables rendering of backlinks within your API documentation.
+
+When an arbitrary section of your documentation links to an API symbol, this link will be collected as a backlink, and rendered below your API symbol. In short, the API symbol will link back to the section that links to it. Such backlinks will help your users navigate the documentation, as they will immediately which functions return a specific symbol, or where a specific symbol is accepted as parameter, etc..
+
+Each backlink is a list of breadcrumbs that represent the navigation, from the root page down to the given section.
+
+The available styles for rendering backlinks are **`flat`** and **`tree`**.
+
+- **`flat`** will render backlinks as a single-layer list. This can lead to repetition of breadcrumbs.
+- **`tree`** will combine backlinks into a tree, to remove repetition of breadcrumbs.
+
+WARNING: **Global-only option.** For now, the option only works when set globally in `mkdocs.yml`.
+
+```yaml title="in mkdocs.yml (global configuration)"
+plugins:
+- mkdocstrings:
+ handlers:
+ python:
+ options:
+ backlinks: tree
+```
+
+/// admonition | Preview
+ type: preview
+
+//// tab | Flat
+
+////
+
+//// tab | Tree
+
+////
+///
+
[](){#option-extensions}
## `extensions`
-- **:octicons-package-24: Type list [str | dict [str , dict [str , Any ]]] :material-equal: `[]`{ title="default value" }**
+- **:octicons-package-24: Type list \[str | dict \[str , dict \[str , Any \]\]\] :material-equal: `[]`{ title="default value" }**
The `extensions` option lets you enable [Griffe extensions](https://mkdocstrings.github.io/griffe/extensions/), which enhance or modify the data collected from Python sources (or compiled modules).
@@ -227,10 +266,147 @@ plugins:
WARNING: **Packages are loaded only once.** When mkdocstrings-python collects data from a Python package (thanks to [Griffe](https://mkdocstrings.github.io/griffe/)), it collects *the entire package* and *caches it*. Next time an object from the same package is rendered, the package is retrieved from the cache and not collected again. The `force_inspection` option will therefore only have an effect the first time a package is collected, and will do nothing for objects rendered afterwards.
+[](){#option-inheritance_diagram_direction}
+## `inheritance_diagram_direction`
+
+The direction of the Mermaid chart presenting the inheritance diagram of a class, `TD` by default.
+
+```yaml title="mkdocs.yml"
+extra_javascript:
+- https://unpkg.com/mermaid@10.9.0/dist/mermaid.min.js
+```
+
+```yaml title="in mkdocs.yml (global configuration)"
+plugins:
+- mkdocstrings:
+ handlers:
+ python:
+ options:
+ inheritance_diagram_direction: TD
+```
+
+```md title="or in docs/some_page.md (local configuration)"
+::: path.to.object
+ options:
+ inheritance_diagram_direction: TD
+```
+
+/// admonition | Preview
+ type: preview
+
+
+With the following classes:
+
+```python
+class SuperAbstract:
+ """Super abstract class."""
+class Mixin1:
+ """Mixin 1."""
+class Abstract(SuperAbstract, Mixin1):
+ """Abstract class."""
+class Mixin2A:
+ """Mixin 2A."""
+class Mixin2B(Mixin2A):
+ """Mixin 2B."""
+class Concrete(Abstract, Mixin2B):
+ """Concrete class."""
+class SuperConcrete(Concrete):
+ """Super concrete class."""
+```
+
+//// tab | `TD` (or `TB`)
+
+```mermaid
+flowchart TD
+SuperConcrete[SuperConcrete]
+Concrete[Concrete]
+Abstract[Abstract]
+SuperAbstract[SuperAbstract]
+Mixin1[Mixin1]
+Mixin2B[Mixin2B]
+Mixin2A[Mixin2A]
+
+Concrete --> SuperConcrete
+Abstract --> Concrete
+SuperAbstract --> Abstract
+Mixin1 --> Abstract
+Mixin2B --> Concrete
+Mixin2A --> Mixin2B
+```
+
+////
+
+//// tab | `BT`
+
+```mermaid
+flowchart BT
+SuperConcrete[SuperConcrete]
+Concrete[Concrete]
+Abstract[Abstract]
+SuperAbstract[SuperAbstract]
+Mixin1[Mixin1]
+Mixin2B[Mixin2B]
+Mixin2A[Mixin2A]
+
+Concrete --> SuperConcrete
+Abstract --> Concrete
+SuperAbstract --> Abstract
+Mixin1 --> Abstract
+Mixin2B --> Concrete
+Mixin2A --> Mixin2B
+```
+
+////
+
+//// tab | `RL`
+
+```mermaid
+flowchart RL
+SuperConcrete[SuperConcrete]
+Concrete[Concrete]
+Abstract[Abstract]
+SuperAbstract[SuperAbstract]
+Mixin1[Mixin1]
+Mixin2B[Mixin2B]
+Mixin2A[Mixin2A]
+
+Concrete --> SuperConcrete
+Abstract --> Concrete
+SuperAbstract --> Abstract
+Mixin1 --> Abstract
+Mixin2B --> Concrete
+Mixin2A --> Mixin2B
+```
+
+////
+
+//// tab | `LR`
+
+```mermaid
+flowchart LR
+SuperConcrete[SuperConcrete]
+Concrete[Concrete]
+Abstract[Abstract]
+SuperAbstract[SuperAbstract]
+Mixin1[Mixin1]
+Mixin2B[Mixin2B]
+Mixin2A[Mixin2A]
+
+Concrete --> SuperConcrete
+Abstract --> Concrete
+SuperAbstract --> Abstract
+Mixin1 --> Abstract
+Mixin2B --> Concrete
+Mixin2A --> Mixin2B
+```
+
+////
+///
+
[](){#option-preload_modules}
## `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`).
@@ -324,9 +500,6 @@ plugins:
[](){#option-show_inheritance_diagram}
## `show_inheritance_diagram`
-[:octicons-heart-fill-24:{ .pulse } Sponsors only](../../insiders/index.md){ .insiders } —
-[:octicons-tag-24: Insiders 1.7.0](../../insiders/changelog.md#1.7.0)
-
- **:octicons-package-24: Type [`bool`][] :material-equal: `False`{ title="default value" }**
@@ -452,3 +625,63 @@ def some_function():
Docstring of the function.
//// /// + +[](){#option-skip_local_inventory} +## `skip_local_inventory` + +- **:octicons-package-24: Type [`bool`][] :material-equal: `False`{ title="default value" }** + + +Whether to skip registering symbols in the objects inventory. + +With this option enabled, re-rendering docstrings for objects from external inventories is possible with their cross-references pointing to the original external inventory, not local. Similarly, it becomes possible to render the same symbol several times in the same documentation, with only one canonical location being used for cross-references (preventing confusion in mkdocs-autorefs). + +```yaml title="in mkdocs.yml (global configuration)" +plugins: +- mkdocstrings: + handlers: + python: + options: + skip_local_inventory: false +``` + +```md title="or in docs/some_page.md (local configuration)" +::: path.to.module + options: + skip_local_inventory: true +``` + +/// admonition | Preview + type: preview + + +//// tab | Without `skip_local_inventory` + +```md exec="on" +::: bisect.bisect_left + options: + heading_level: 3 + skip_local_inventory: false + show_docstring_description: false +``` + +Notice how [`bisect.bisect_left`][] now points to the section above. + +//// + +//// tab | With `skip_local_inventory` + +```md exec="on" +::: bisect.bisect_right + inventories: + - https://docs.python.org/3/objects.inv + options: + heading_level: 3 + skip_local_inventory: true + show_docstring_description: false +``` + +Notice how [`bisect.bisect_right`][] points to the original Python documentation. + +//// +/// diff --git a/docs/usage/configuration/headings.md b/docs/usage/configuration/headings.md index b4314b77..5d261807 100644 --- a/docs/usage/configuration/headings.md +++ b/docs/usage/configuration/headings.md @@ -77,8 +77,6 @@ plugins: [](){#option-parameter_headings} ## `parameter_headings` -[:octicons-tag-24: Insiders 1.6.0](../../insiders/changelog.md#1.6.0) - - **:octicons-package-24: Type [`bool`][] :material-equal: `False`{ title="default value" }** @@ -88,7 +86,7 @@ With this option enabled, each function/method parameter (including parameters of `__init__` methods merged in their parent class with the [`merge_init_into_class`][] option) gets a permalink, an entry in the Table of Contents, -and an entry in the generated objects inventory. +and an entry in the generated objects inventory (unless [`skip_local_inventory`][] is enabled). The permalink and inventory entry allow cross-references from internal and external pages. @@ -193,7 +191,7 @@ plugins: get_version dist
-To customize symbols, see [Customizing symbol types](../customization.md/#symbol-types).
+To customize symbols, see [Customizing symbol types](../customization.md#symbol-types).
///
@@ -305,6 +303,10 @@ More text.
/// admonition | Preview
type: preview
+[](){#permalink-to-some-heading}
+[](){#permalink-to-object}
+[](){#permalink-to-other-heading}
+
//// tab | With ToC entry
**Table of contents**
[Some heading](#permalink-to-some-heading){ title="#permalink-to-some-heading" }
@@ -537,8 +539,6 @@ plugins:
[](){#option-show_symbol_type_heading}
## `show_symbol_type_heading`
-[:octicons-tag-24: Insiders 1.1.0](../../insiders/changelog.md#1.1.0)
-
- **:octicons-package-24: Type [`bool`][] :material-equal: `False`{ title="default value" }**
@@ -552,7 +552,7 @@ This option will prefix headings with
types.
See also [`show_symbol_type_toc`][show_symbol_type_toc].
-To customize symbols, see [Customizing symbol types](../customization.md/#symbol-types).
+To customize symbols, see [Customizing symbol types](../customization.md#symbol-types).
```yaml title="in mkdocs.yml (global configuration)"
plugins:
@@ -602,8 +602,6 @@ plugins:
[](){#option-show_symbol_type_toc}
## `show_symbol_type_toc`
-[:octicons-tag-24: Insiders 1.1.0](../../insiders/changelog.md#1.1.0)
-
- **:octicons-package-24: Type [`bool`][] :material-equal: `False`{ title="default value" }**
@@ -617,7 +615,7 @@ This option will prefix items in the ToC with
types.
See also [`show_symbol_type_heading`][show_symbol_type_heading].
-To customize symbols, see [Customizing symbol types](../customization.md/#symbol-types).
+To customize symbols, see [Customizing symbol types](../customization.md#symbol-types).
```yaml title="in mkdocs.yml (global configuration)"
plugins:
@@ -682,3 +680,135 @@ NOTE: **Use with/without `heading`.** If you use this option without specifying
heading: "My fancy module"
toc_label: "My fancy module"
```
+
+[](){#option-type_parameter_headings}
+## `type_parameter_headings`
+
+- **:octicons-package-24: Type [`bool`][] :material-equal: `False`{ title="default value" }**
+
+Whether to render headings for generic class, function/method and type alias
+type parameters.
+
+With this option enabled, each type parameter of a generic object (including
+type parameters of `__init__` methods merged in their parent class with the
+[`merge_init_into_class`][] option) gets a permalink, an entry in the Table of
+Contents, and an entry in the generated objects inventory. The permalink and
+inventory entry allow cross-references from internal and external pages.
+
+
+
+Enabling this option along with [`signature_crossrefs`][] will automatically
+render cross-references to type parameters in class/function/method/type alias
+signatures.
+
+```yaml title="in mkdocs.yml (global configuration)"
+plugins:
+- mkdocstrings:
+ handlers:
+ python:
+ options:
+ type_parameter_headings: false
+```
+
+```md title="or in docs/some_page.md (local configuration)"
+::: path.to.module
+ options:
+ type_parameter_headings: true
+```
+
+/// admonition | Preview: Cross-references
+ type: preview
+
+```md exec="on"
+::: package.generics
+ options:
+ show_root_heading: false
+ heading_level: 3
+ docstring_section_style: list
+ show_bases: true
+ summary: false
+ separate_signature: true
+ show_signature_type_parameters: true
+ show_inheritance_diagram: false
+ type_parameter_headings: true
+```
+
+///
+
+/// admonition | Preview: Type parameter sections
+ type: preview
+
+//// tab | Table style
+```md exec="on"
+::: package.generics.MagicBag
+ options:
+ members: false
+ heading_level: 3
+ show_root_heading: false
+ show_root_toc_entry: false
+ parameter_headings: true
+ docstring_section_style: table
+ show_docstring_description: false
+ show_docstring_parameters: false
+ show_docstring_returns: false
+ show_inheritance_diagram: false
+```
+////
+
+//// tab | List style
+```md exec="on"
+::: package.generics.MagicBag
+ options:
+ members: false
+ heading_level: 3
+ show_root_heading: false
+ show_root_toc_entry: false
+ parameter_headings: true
+ docstring_section_style: list
+ show_docstring_description: false
+ show_docstring_parameters: false
+ show_docstring_returns: false
+ show_inheritance_diagram: false
+```
+////
+
+//// tab | Spacy style
+```md exec="on"
+::: package.generics.MagicBag
+ options:
+ members: false
+ heading_level: 3
+ show_root_heading: false
+ show_root_toc_entry: false
+ parameter_headings: true
+ docstring_section_style: spacy
+ show_docstring_description: false
+ show_docstring_parameters: false
+ show_docstring_returns: false
+ show_inheritance_diagram: false
+```
+////
+///
+
+/// admonition | Preview: Table of contents (with symbol types)
+ type: preview
+
+ mutate U
+
+To customize symbols, see [Customizing symbol types](../customization.md/#symbol-types).
+
+///
diff --git a/docs/usage/configuration/members.md b/docs/usage/configuration/members.md
index 363f7e0a..b6a65c30 100644
--- a/docs/usage/configuration/members.md
+++ b/docs/usage/configuration/members.md
@@ -3,7 +3,7 @@
[](){#option-members}
## `members`
-- **:octicons-package-24: Type list [str ] |
+- **:octicons-package-24: Type list \[str \] |
bool | None :material-equal: `None`{ title="default value" }**
@@ -99,7 +99,7 @@ INFO: **The default behavior (with unspecified `members` or `members: null`) is
[](){#option-inherited_members}
## `inherited_members`
-- **:octicons-package-24: Type list [str ] |
+- **:octicons-package-24: Type list \[str \] |
bool :material-equal: `False`{ title="default value" }**
@@ -264,13 +264,14 @@ class Main(Base):
[](){#option-members_order}
## `members_order`
-- **:octicons-package-24: Type [`str`][] :material-equal: `"alphabetical"`{ title="default value" }**
+- **:octicons-package-24: Type `str | list[str]` :material-equal: `"alphabetical"`{ title="default value" }**
The members ordering to use. Possible values:
-- `alphabetical`: order by the members names.
-- `source`: order members as they appear in the source file.
+- `__all__`: Order according to `__all__` attributes. Since classes do not define `__all__` attributes, you can specify a second ordering method by using a list.
+- `alphabetical`: Order by the members names.
+- `source`: Order members as they appear in the source file.
The order applies for all members, recursively.
The order will be ignored for members that are explicitely sorted using the [`members`][] option.
@@ -292,6 +293,12 @@ plugins:
members_order: source
```
+```md title="or in docs/some_page.md (local configuration)"
+::: package.module
+ options:
+ members_order: [__all__, source]
+```
+
```python title="package/module.py"
"""Module docstring."""
@@ -335,10 +342,18 @@ def function_c():
[](){#option-filters}
## `filters`
-- **:octicons-package-24: Type list [str ] | None :material-equal: `["!^_[^_]"]`{ title="default value" }**
+- **:octicons-package-24: Type list \[str \] | Literal \["public"\] | None :material-equal: `["!^_[^_]"]`{ title="default value" }**
-A list of filters applied to filter objects based on their name.
+A list of filters, or `"public"`.
+
+**Filtering methods**
+
+[](){#option-filters-public}
+
+The `public` filtering method will include only public objects: those added to the `__all__` attribute of modules, or not starting with a single underscore. Special methods and attributes ("dunder" methods/attributes, starting and ending with two underscores), like `__init__`, `__call__`, `__mult__`, etc., are always considered public.
+
+**List of filters**
Filters are regular expressions. These regular expressions are evaluated by Python
and so must match the syntax supported by the [`re`][] module.
@@ -379,13 +394,13 @@ plugins:
python:
options:
filters:
- - "!^_"
+ - "!^_[^_]"
```
```md title="or in docs/some_page.md (local configuration)"
::: package.module
options:
- filters: []
+ filters: public
```
```python title="package/module.py"
@@ -559,15 +574,13 @@ package
[](){#option-summary}
## `summary`
-[: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.
This option accepts a boolean (`yes`, `true`, `no`, `false` in YAML)
-or a dictionary with one or more of the following keys: `attributes`, `functions`, `classes`, `modules`,
+or a dictionary with one or more of the following keys: `attributes`, `functions`, `classes`, `modules`, `type_aliases`,
with booleans as values. Class methods summary is (de)activated with the `functions` key.
By default, `summary` is false, and by extension all values are false.
diff --git a/docs/usage/configuration/signatures.md b/docs/usage/configuration/signatures.md
index 98c865e5..c9ac917b 100644
--- a/docs/usage/configuration/signatures.md
+++ b/docs/usage/configuration/signatures.md
@@ -64,6 +64,8 @@ def convert(text: str, md: markdown.Markdown) -> markupsafe.Markup:
Convert text to Markdown.
Parameters:
+[](){#ref-to-markdown}
+
**Type** | **Description** | **Default**
---------- | ------------------------ | -----------
[`str`][] | The text to convert. | *required*
@@ -71,6 +73,8 @@ def convert(text: str, md: markdown.Markdown) -> markupsafe.Markup:
Returns:
+[](){#ref-to-markup}
+
**Type** | **Name** | **Description**
---------- | ----------- | ---------------
[`Markup`](#ref-to-markup){ .external title="markupsafe.Markup" } | `text` | Converted markup.
@@ -203,12 +207,6 @@ plugins:
[](){#option-modernize_annotations}
## `modernize_annotations`
-[:octicons-heart-fill-24:{ .pulse } Sponsors only](../../insiders/index.md){ .insiders } —
-[:octicons-tag-24: Insiders 1.8.0](../../insiders/changelog.md#1.8.0) —
-**This feature also requires
-[Griffe Insiders](https://mkdocstrings.github.io/griffe/insiders/)
-to be installed.**
-
- **:octicons-package-24: Type [`bool`][] :material-equal: `False`{ title="default value" }**
@@ -286,6 +284,58 @@ plugins:
///
+[](){#option-overloads_only}
+## `overloads_only`
+
+- **:octicons-package-24: Type [`bool`][] :material-equal: `False`{ title="default value" }**
+
+Whether to hide the implementation signature if the overloads are shown with [`show_overloads`][].
+
+```yaml title="in mkdocs.yml (global configuration)"
+plugins:
+- mkdocstrings:
+ handlers:
+ python:
+ options:
+ overloads_only: false
+```
+
+```md title="or in docs/some_page.md (local configuration)"
+::: path.to.module
+ options:
+ overloads_only: true
+```
+
+/// admonition | Preview
+ type: preview
+//// tab | With overloads only
+function
+
+```python
+@overload
+function(param1: int): ...
+@overload
+function(param1: str): ...
+```
+Function docstring.
+
+////
+//// tab | Without overloads only
+function
+
+```python
+@overload
+function(param1: int): ...
+@overload
+function(param1: str): ...
+function(param1: str | int)
+```
+Function docstring.
+
+////
+
+///
+
[](){#option-show_signature}
## `show_signature`
@@ -380,6 +430,61 @@ function(param1, param2=None)
////
///
+[](){#option-show_signature_type_parameters}
+## `show_signature_type_parameters`
+
+- **:octicons-package-24: Type [`bool`][] :material-equal: `False`{ title="default value" }**
+
+
+Show the type parameters in generic classes, methods, functions and type aliases
+signatures.
+
+Since the heading can become quite long when type parameters are rendered, it is
+usually best to [separate the signature][separate_signature] from the heading.
+
+```yaml title="in mkdocs.yml (global configuration)"
+plugins:
+- mkdocstrings:
+ handlers:
+ python:
+ options:
+ separate_signature: true
+ show_signature_annotations: true
+ show_signature_type_parameters: true
+```
+
+```md title="or in docs/some_page.md (local configuration)"
+::: path.to.module
+ options:
+ separate_signature: true
+ show_signature_annotations: true
+ show_signature_type_parameters: false
+```
+
+/// admonition | Preview
+ type: preview
+
+//// tab | With signature type parameters
+function
+
+```python
+function[T, *R](param: T) -> tuple[*R]
+```
+
+Function docstring.
+////
+
+//// tab | Without signature type parameters
+function
+
+```python
+function(param: T) -> tuple[*R]
+```
+
+Function docstring.
+////
+///
+
[](){#option-separate_signature}
## `separate_signature`
@@ -433,9 +538,54 @@ function(param1, param2=None)
////
///
+[](){#option-show_attribute_values}
+## `show_attribute_values`
+
+- **:octicons-package-24: Type [`bool`][] :material-equal: `True`{ title="default value" }**
+
+
+Show initial values of attributes in classes.
+
+```yaml title="in mkdocs.yml (global configuration)"
+plugins:
+- mkdocstrings:
+ handlers:
+ python:
+ options:
+ show_attribute_values: true
+```
+
+```md title="or in docs/some_page.md (local configuration)"
+::: path.to.object
+ options:
+ show_attribute_values: true
+```
+
+```python title="package/module.py"
+class SomeClass:
+ def __init__(self):
+ self.some_attr = 1
+```
+
+/// admonition | Preview
+ type: preview
+
+//// tab | With attribute values visible
+SomeClass
+some_attr = 1
+////
+
+//// tab | With attribute values hidden
+SomeClass
+some_attr
+////
+///
+
[](){#option-show_overloads}
## `show_overloads`
+- **:octicons-package-24: Type [`bool`][] :material-equal: `True`{ title="default value" }**
+
Whether to render function / method overloads.
```yaml title="in mkdocs.yml (global configuration)"
@@ -485,8 +635,6 @@ Function docstring.
[](){#option-signature_crossrefs}
## `signature_crossrefs`
-[:octicons-tag-24: Insiders 1.0.0](../../insiders/changelog.md#1.0.0)
-
Whether to render cross-references for type annotations in signatures.
When signatures are separated from headings with the [`separate_signature`][] option
diff --git a/docs/usage/customization.md b/docs/usage/customization.md
index 9e13da66..d1e66b31 100644
--- a/docs/usage/customization.md
+++ b/docs/usage/customization.md
@@ -34,9 +34,10 @@ The following CSS classes are used in the generated HTML:
- `doc-class`: on `div`s containing a class
- `doc-function`: on `div`s containing a function
- `doc-module`: on `div`s containing a module
+ - `doc-type_alias`: on `div`s containing a type alias
- `doc-heading`: on objects headings
- `doc-object-name`: on `span`s wrapping objects names/paths in the heading
- - `doc-KIND-name`: as above, specific to the kind of object (module, class, function, attribute)
+ - `doc-KIND-name`: as above, specific to the kind of object (module, class, function, attribute, type_alias)
- `doc-contents`: on `div`s wrapping the docstring then the children (if any)
- `first`: same, but only on the root object's contents `div`
- `doc-labels`: on `span`s wrapping the object's labels
@@ -48,7 +49,7 @@ The following CSS classes are used in the generated HTML:
- `doc-symbol`: on `code` tags of symbol types
- `doc-symbol-heading`: on symbol types in headings
- `doc-symbol-toc`: on symbol types in the ToC
- - `doc-symbol-KIND`: specific to the kind of object (`module`, `class`, `function`, `method`, `attribute`)
+ - `doc-symbol-KIND`: specific to the kind of object (`module`, `class`, `function`, `method`, `attribute`, `type_alias`)
/// admonition | Example with colorful labels
type: example
@@ -90,33 +91,41 @@ by overriding the values of our CSS variables, for example:
```css title="docs/css/mkdocstrings.css"
[data-md-color-scheme="default"] {
--doc-symbol-parameter-fg-color: #df50af;
+ --doc-symbol-type_parameter-fg-color: #df50af;
--doc-symbol-attribute-fg-color: #0079ff;
--doc-symbol-function-fg-color: #00dfa2;
--doc-symbol-method-fg-color: #00dfa2;
--doc-symbol-class-fg-color: #d1b619;
+ --doc-symbol-type_alias-fg-color: #d1b619;
--doc-symbol-module-fg-color: #ff0060;
--doc-symbol-parameter-bg-color: #df50af1a;
+ --doc-symbol-type_parameter-bg-color: #df50af1a;
--doc-symbol-attribute-bg-color: #0079ff1a;
--doc-symbol-function-bg-color: #00dfa21a;
--doc-symbol-method-bg-color: #00dfa21a;
--doc-symbol-class-bg-color: #d1b6191a;
+ --doc-symbol-type_alias-bg-color: #d1b6191a;
--doc-symbol-module-bg-color: #ff00601a;
}
[data-md-color-scheme="slate"] {
--doc-symbol-parameter-fg-color: #ffa8cc;
+ --doc-symbol-type_parameter-fg-color: #ffa8cc;
--doc-symbol-attribute-fg-color: #963fb8;
--doc-symbol-function-fg-color: #6d67e4;
--doc-symbol-method-fg-color: #6d67e4;
--doc-symbol-class-fg-color: #46c2cb;
+ --doc-symbol-type_alias-fg-color: #46c2cb;
--doc-symbol-module-fg-color: #f2f7a1;
--doc-symbol-parameter-bg-color: #ffa8cc1a;
+ --doc-symbol-type_parameter-bg-color: #ffa8cc1a;
--doc-symbol-attribute-bg-color: #963fb81a;
--doc-symbol-function-bg-color: #6d67e41a;
--doc-symbol-method-bg-color: #6d67e41a;
--doc-symbol-class-bg-color: #46c2cb1a;
+ --doc-symbol-type_alias-bg-color: #46c2cb1a;
--doc-symbol-module-bg-color: #f2f7a11a;
}
```
@@ -129,17 +138,21 @@ otherwise just override the variables at root level:
```css title="docs/css/mkdocstrings.css"
:root {
--doc-symbol-parameter-fg-color: #df50af;
+ --doc-symbol-type_parameter-fg-color: #df50af;
--doc-symbol-attribute-fg-color: #0079ff;
--doc-symbol-function-fg-color: #00dfa2;
--doc-symbol-method-fg-color: #00dfa2;
--doc-symbol-class-fg-color: #d1b619;
+ --doc-symbol-type_alias-fg-color: #d1b619;
--doc-symbol-module-fg-color: #ff0060;
--doc-symbol-parameter-bg-color: #df50af1a;
+ --doc-symbol-type_parameter-bg-color: #df50af1a;
--doc-symbol-attribute-bg-color: #0079ff1a;
--doc-symbol-function-bg-color: #00dfa21a;
--doc-symbol-method-bg-color: #00dfa21a;
--doc-symbol-class-bg-color: #d1b6191a;
+ --doc-symbol-type_alias-bg-color: #d1b6191a;
--doc-symbol-module-bg-color: #ff00601a;
}
```
@@ -151,33 +164,41 @@ otherwise just override the variables at root level:
@@ -204,6 +225,10 @@ For example, to use single letters instead of truncated types:
content: "P";
}
+.doc-symbol-type_parameter::after {
+ content: "P";
+}
+
.doc-symbol-attribute::after {
content: "A";
}
@@ -220,6 +245,10 @@ For example, to use single letters instead of truncated types:
content: "C";
}
+.doc-symbol-type_alias::after {
+ content: "T";
+}
+
.doc-symbol-module::after {
content: "M";
}
@@ -234,6 +263,10 @@ For example, to use single letters instead of truncated types:
content: "P";
}
+ #preview-symbol-names .doc-symbol-type_parameter::after {
+ content: "P";
+ }
+
#preview-symbol-names .doc-symbol-attribute::after {
content: "A";
}
@@ -250,16 +283,22 @@ For example, to use single letters instead of truncated types:
content: "C";
}
+ #preview-symbol-names .doc-symbol-type_alias::after {
+ content: "T";
+ }
+
#preview-symbol-names .doc-symbol-module::after {
content: "M";
}
- Parameter:
+ - Type Parameter:
- Attribute:
- Function:
- Method:
- Class:
+ - Type Alias:
- Module:
@@ -283,7 +322,7 @@ for filepath in sorted(path for path in Path(basedir).rglob("*") if "_base" not
)
```
-See them [in the repository](https://github.com/mkdocstrings/python/tree/master/src/mkdocstrings_handlers/python/templates/).
+See them [in the repository](https://github.com/mkdocstrings/python/tree/main/src/mkdocstrings_handlers/python/templates/).
See the general *mkdocstrings* documentation to learn how to override them: https://mkdocstrings.github.io/theming/#templates.
Each one of these templates extends a base version in `theme/_base`. Example:
@@ -324,6 +363,19 @@ Available context:
- `config`: The handler configuration (dictionary).
- `module`: The [Module][griffe.Module] instance.
+#### `type_alias.html`
+
+- `heading`: The class heading.
+- `labels`: The class labels.
+- `signature`: The class signature.
+- `contents`: The class contents: bases, docstring, source and children blocks.
+- `docstring`: The class docstring.
+
+Available context:
+
+- `config`: The handler configuration (dictionary).
+- `type_alias`: The [TypeAlias][griffe.TypeAlias] instance.
+
#### `class.html`
- `heading`: The class heading.
@@ -379,6 +431,8 @@ In `docstring/attributes.html`,
`docstring/raises.html`,
`docstring/receives.html`,
`docstring/returns.html`,
+`docstring/type_aliases.html`,
+`docstring/type_parameters.html`,
`docstring/warns.html`,
and `docstring/yields.html`:
@@ -439,4 +493,4 @@ div.doc-contents:not(.first) {
padding-left: 25px;
border-left: .05rem solid rgba(200, 200, 200, 0.2);
}
-```
\ No newline at end of file
+```
diff --git a/docs/usage/index.md b/docs/usage/index.md
index 84110936..3348a627 100644
--- a/docs/usage/index.md
+++ b/docs/usage/index.md
@@ -87,8 +87,8 @@ plugins:
- mkdocstrings:
handlers:
python:
- import:
- - https://docs.python-requests.org/en/master/objects.inv
+ inventories:
+ - https://docs.python.org/3/objects.inv
```
When loading an inventory, you enable automatic cross-references
@@ -150,9 +150,11 @@ plugins:
[__all__]: https://docs.python.org/3/tutorial/modules.html#importing-from-a-package
[](){#setting-locale}
-#### `locale`
+#### ~~`locale`~~
+
+**Deprecated.** Use mkdocstrings' own `locale` setting.
-The locale to use when translating template strings. The translation system is not fully ready yet, so we don't recommend setting the option for now.
+~~The locale to use when translating template strings.~~
[](){#setting-paths}
#### `paths`
@@ -378,3 +380,107 @@ poetry install
poetry run mkdocs build
```
///
+
+## Recommended settings
+
+If you're in a hurry, here is the configuration we recommend for the Python handler.
+
+```yaml
+- mkdocstrings:
+ handlers:
+ python:
+
+ # Where to find your sources, see "Finding modules".
+ paths: [src]
+
+ # Load object inventories to enable cross-references to other projects.
+ inventories:
+ - https://docs.python.org/3/objects.inv
+ # Also load inventories of your dependencies, generally served at
+ # https://docs-url-for-your-dependency/objects.inv.
+
+ options:
+
+ # DOCSTRINGS -------------------------------------------------------------
+ docstring_options:
+ # Discard first line of `__init__` method docstrings,
+ # useful when merging such docstrings into their parent class'.
+ ignore_init_summary: true
+
+ # Tables are generally too large, lists will fix this.
+ docstring_section_style: list
+
+ # CROSS-REFERENCES -------------------------------------------------------
+ # Enable relative crossrefs and scoped crossrefs, see Docstrings options.
+ relative_crossrefs: true # Sponsors only!
+ scoped_crossrefs: true # Sponsors only!
+
+ # Enable cross-references in signatures.
+ signature_crossrefs: true
+
+ # Unwrap actual types from `Annotated` type annotations.
+ unwrap_annotated: true
+
+ # MEMBERS ----------------------------------------------------------------
+ # Only render pulic symbols.
+ filters: public # Sponsors only!
+ # Comment the option otherwise to get the default filters.
+
+ # Show class inherited members.
+ inherited_members: true
+
+ # Render auto-generated summaries of attributes, functions, etc.
+ # at the start of each symbol's documentation.
+ summary: true
+
+ # HEADINGS ---------------------------------------------------------------
+ # For auto-generated pages, one module per page,
+ # make the module heading be the H1 heading of the page.
+ heading_level: 1
+
+ # Render headings for parameters, making them linkable.
+ parameter_headings: true
+
+ # Render headings for type parameters too.
+ type_parameter_headings: true
+
+ # Always show the heading for the symbol you render with `::: id`.
+ show_root_heading: true
+
+ # Only show the name of the symbols you inject render `::: id`.
+ show_root_full_path: false
+
+ # Show the type of symbol (class, function, etc.) in the heading.
+ show_symbol_type_heading: true
+
+ # Show the type of symbol (class, function, etc.) in the table of contents.
+ show_symbol_type_toc: true
+
+ # SIGNATURES -------------------------------------------------------------
+ # Format code to 80 + 10% margin (Black and Ruff defaults)
+ # in signatures and attribute value code blocks.
+ # Needs Black/Ruff installed.
+ line_length: 88
+
+ # Merge signature and docstring of `__init__` methods
+ # into their parent class signature and docstring.
+ merge_init_into_class: true
+
+ # Render signatures and attribute values in a separate code block,
+ # below the symbol heading.
+ separate_signature: true
+
+ # Show type annotations in signatures.
+ show_signature_annotations: true
+
+ # Show type parameters in signatures.
+ show_signature_type_parameters: true
+
+ # OTHER ------------------------------------------------------------------
+ # Show backlinks to other documentation sections within each symbol.
+ backlinks: tree # Sponsors only!
+
+ # Show base classes OR inheritance diagram.
+ show_bases: false
+ show_inheritance_diagram: true # Sponsors only!
+```
diff --git a/duties.py b/duties.py
index 9e516ce5..8bf362fc 100644
--- a/duties.py
+++ b/duties.py
@@ -3,17 +3,14 @@
from __future__ import annotations
import os
+import re
import sys
-from contextlib import contextmanager
-from importlib.metadata import version as pkgversion
from pathlib import Path
from typing import TYPE_CHECKING
from duty import duty, tools
if TYPE_CHECKING:
- from collections.abc import Iterator
-
from duty.context import Context
@@ -24,25 +21,21 @@
WINDOWS = os.name == "nt"
PTY = not WINDOWS and not CI
MULTIRUN = os.environ.get("MULTIRUN", "0") == "1"
+PY_VERSION = f"{sys.version_info.major}{sys.version_info.minor}"
+PY_DEV = "314"
-def pyprefix(title: str) -> str: # noqa: D103
+def pyprefix(title: str) -> str:
if MULTIRUN:
prefix = f"(python{sys.version_info.major}.{sys.version_info.minor})"
return f"{prefix:14}{title}"
return title
-@contextmanager
-def material_insiders() -> Iterator[bool]: # noqa: D103
- if "+insiders" in pkgversion("mkdocs-material"):
- os.environ["MATERIAL_INSIDERS"] = "true"
- try:
- yield True
- finally:
- os.environ.pop("MATERIAL_INSIDERS")
- else:
- yield False
+def _get_changelog_version() -> str:
+ changelog_version_re = re.compile(r"^## \[(\d+\.\d+\.\d+)\].*$")
+ with Path(__file__).parent.joinpath("CHANGELOG.md").open("r", encoding="utf8") as file:
+ return next(filter(bool, map(changelog_version_re.match, file))).group(1) # type: ignore[union-attr]
@duty
@@ -53,6 +46,7 @@ def changelog(ctx: Context, bump: str = "") -> None:
bump: Bump option passed to git-changelog.
"""
ctx.run(tools.git_changelog(bump=bump or None), title="Updating changelog")
+ ctx.run(tools.yore.check(bump=bump or _get_changelog_version()), title="Checking legacy code")
@duty(pre=["check-quality", "check-types", "check-docs", "check-api"])
@@ -60,7 +54,7 @@ def check(ctx: Context) -> None:
"""Check it all!"""
-@duty
+@duty(nofail=PY_VERSION == PY_DEV)
def check_quality(ctx: Context) -> None:
"""Check the code quality."""
ctx.run(
@@ -69,31 +63,33 @@ def check_quality(ctx: Context) -> None:
)
-@duty
+@duty(
+ nofail=PY_VERSION == PY_DEV,
+ skip_if=sys.version_info < (3, 13),
+ skip_reason=pyprefix("Skipped: docs require modern generics syntax"),
+)
def check_docs(ctx: Context) -> None:
"""Check if the documentation builds correctly."""
Path("htmlcov").mkdir(parents=True, exist_ok=True)
Path("htmlcov/index.html").touch(exist_ok=True)
- with material_insiders():
- ctx.run(
- tools.mkdocs.build(strict=True, verbose=True),
- title=pyprefix("Building documentation"),
- )
+ ctx.run(
+ tools.mkdocs.build(strict=True, verbose=True),
+ title=pyprefix("Building documentation"),
+ )
-@duty
+@duty(nofail=True)
def check_types(ctx: Context) -> None:
"""Check that the code is correctly typed."""
os.environ["MYPYPATH"] = "src"
+ os.environ["FORCE_COLOR"] = "1"
ctx.run(
tools.mypy(*PY_SRC_LIST, config_file="config/mypy.ini"),
title=pyprefix("Type-checking"),
- # TODO: Update when Pydantic supports 3.14.
- nofail=sys.version_info >= (3, 14),
)
-@duty
+@duty(nofail=PY_VERSION == PY_DEV)
def check_api(ctx: Context, *cli_args: str) -> None:
"""Check for API breaking changes."""
ctx.run(
@@ -103,7 +99,7 @@ def check_api(ctx: Context, *cli_args: str) -> None:
)
-@duty
+@duty(skip_if=sys.version_info < (3, 13), skip_reason=pyprefix("Skipped: docs require modern generics syntax"))
def docs(ctx: Context, *cli_args: str, host: str = "127.0.0.1", port: int = 8000) -> None:
"""Serve the documentation (localhost:8000).
@@ -111,48 +107,18 @@ def docs(ctx: Context, *cli_args: str, host: str = "127.0.0.1", port: int = 8000
host: The host to serve the docs from.
port: The port to serve the docs on.
"""
- with material_insiders():
- ctx.run(
- tools.mkdocs.serve(dev_addr=f"{host}:{port}").add_args(*cli_args),
- title="Serving documentation",
- capture=False,
- )
-
+ ctx.run(
+ tools.mkdocs.serve(dev_addr=f"{host}:{port}").add_args(*cli_args),
+ title="Serving documentation",
+ capture=False,
+ )
-@duty
-def docs_deploy(ctx: Context, *, force: bool = False) -> None:
- """Deploy the documentation to GitHub pages.
- Parameters:
- force: Whether to force deployment, even from non-Insiders version.
- """
+@duty(skip_if=sys.version_info < (3, 13), skip_reason=pyprefix("Skipped: docs require modern generics syntax"))
+def docs_deploy(ctx: Context) -> None:
+ """Deploy the documentation to GitHub pages."""
os.environ["DEPLOY"] = "true"
- with material_insiders() as insiders:
- if not insiders:
- ctx.run(lambda: False, title="Not deploying docs without Material for MkDocs Insiders!")
- origin = ctx.run("git config --get remote.origin.url", silent=True, allow_overrides=False)
- if "pawamoy-insiders/mkdocstrings-python" in origin:
- ctx.run(
- "git remote add upstream git@github.com:mkdocstrings/python",
- silent=True,
- nofail=True,
- allow_overrides=False,
- )
- ctx.run(
- tools.mkdocs.gh_deploy(remote_name="upstream", force=True),
- title="Deploying documentation",
- )
- elif force:
- ctx.run(
- tools.mkdocs.gh_deploy(force=True),
- title="Deploying documentation",
- )
- else:
- ctx.run(
- lambda: False,
- title="Not deploying docs from public repository (do that from insiders instead!)",
- nofail=True,
- )
+ ctx.run(tools.mkdocs.gh_deploy(force=True), title="Deploying documentation")
@duty
@@ -195,17 +161,11 @@ def release(ctx: Context, version: str = "") -> None:
Parameters:
version: The new version number to use.
"""
- origin = ctx.run("git config --get remote.origin.url", silent=True)
- if "pawamoy-insiders/mkdocstrings-python" in origin:
- ctx.run(
- lambda: False,
- title="Not releasing from insiders repository (do that from public repo instead!)",
- )
if not (version := (version or input("> Version to release: ")).strip()):
ctx.run("false", title="A version must be provided")
ctx.run("git add pyproject.toml CHANGELOG.md", title="Staging files", pty=PTY)
ctx.run(["git", "commit", "-m", f"chore: Prepare release {version}"], title="Committing changes", pty=PTY)
- ctx.run(f"git tag {version}", title="Tagging commit", pty=PTY)
+ ctx.run(f"git tag -m '' -a {version}", title="Tagging commit", pty=PTY)
ctx.run("git push", title="Pushing commits", pty=False)
ctx.run("git push --tags", title="Pushing tags", pty=False)
@@ -218,16 +178,11 @@ def coverage(ctx: Context) -> None:
ctx.run(tools.coverage.html(rcfile="config/coverage.ini"))
-@duty
-def test(ctx: Context, *cli_args: str, match: str = "", snapshot: str = "report") -> None:
- """Run the test suite.
-
- Parameters:
- match: A pytest expression to filter selected tests.
- snapshot: Whether to "create", "fix", "trim", or "update" snapshots.
- """
- py_version = f"{sys.version_info.major}{sys.version_info.minor}"
- os.environ["COVERAGE_FILE"] = f".coverage.{py_version}"
+@duty(nofail=PY_VERSION == PY_DEV)
+def test(ctx: Context, *cli_args: str, snapshot: str = "report") -> None: # noqa: PT028
+ """Run the test suite."""
+ os.environ["COVERAGE_FILE"] = f".coverage.{PY_VERSION}"
+ os.environ["PYTHONWARNDEFAULTENCODING"] = "1"
args = list(cli_args)
if snapshot == "disable" or not snapshot:
args = ["-n", "auto", "--inline-snapshot=disable"]
@@ -237,7 +192,6 @@ def test(ctx: Context, *cli_args: str, match: str = "", snapshot: str = "report"
tools.pytest(
"tests",
config_file="config/pytest.ini",
- select=match,
color="yes",
).add_args(*args),
title=pyprefix("Running tests"),
diff --git a/mkdocs.yml b/mkdocs.yml
index 396f738f..64d0de3a 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -37,19 +37,12 @@ nav:
- Advanced:
- Customization: usage/customization.md
- Extensions: usage/extensions.md
-# defer to gen-files + literate-nav
-- API reference:
- - mkdocstrings-python: reference/
+- API reference: reference/api.md
- Development:
- Contributing: contributing.md
- Code of Conduct: code_of_conduct.md
- # - Coverage report: coverage.md
-- Insiders:
- - insiders/index.md
- - Getting started:
- - Installation: insiders/installation.md
- - Changelog: insiders/changelog.md
-- mkdocstrings: https://mkdocstrings.github.io/
+ - Coverage report: coverage.md
+ - mkdocstrings: https://mkdocstrings.github.io/
theme:
name: material
@@ -63,7 +56,8 @@ theme:
- content.code.copy
- content.tooltips
- navigation.footer
- - navigation.indexes
+ - navigation.instant.preview
+ - navigation.path
- navigation.sections
- navigation.tabs
- navigation.tabs.sticky
@@ -94,7 +88,6 @@ theme:
extra_css:
- css/material.css
- css/mkdocstrings.css
-- css/insiders.css
extra_javascript:
- js/feedback.js
@@ -140,36 +133,34 @@ markdown_extensions:
permalink: "¤"
plugins:
-- autorefs
- search
+- autorefs
- markdown-exec
-- gen-files:
- scripts:
- - scripts/gen_ref_nav.py
-- literate-nav:
- nav_file: SUMMARY.md
-# - coverage
+- section-index
+- coverage
- mkdocstrings:
handlers:
python:
paths: [src, docs/snippets]
- import:
+ inventories:
- https://docs.python.org/3/objects.inv
- https://mkdocstrings.github.io/objects.inv
- https://mkdocstrings.github.io/autorefs/objects.inv
- https://mkdocstrings.github.io/griffe/objects.inv
- https://python-markdown.github.io/objects.inv
options:
+ backlinks: tree
docstring_options:
ignore_init_summary: true
docstring_section_style: list
- extensions:
- - scripts/griffe_extensions.py
- filters: ["!^_"]
+ extensions: [scripts/griffe_extensions.py]
+ filters: public
heading_level: 1
inherited_members: true
+ line_length: 88
merge_init_into_class: true
parameter_headings: true
+ type_parameter_headings: true
preload_modules: [mkdocstrings]
relative_crossrefs: true
scoped_crossrefs: true
@@ -179,22 +170,34 @@ plugins:
show_root_heading: true
show_root_full_path: false
show_signature_annotations: true
- show_source: false
+ show_signature_type_parameters: true
+ show_source: true
show_symbol_type_heading: true
show_symbol_type_toc: true
signature_crossrefs: true
summary: true
unwrap_annotated: true
+- llmstxt:
+ full_output: llms-full.txt
+ sections:
+ Usage:
+ - index.md
+ API:
+ - reference/api.md
- git-revision-date-localized:
enabled: !ENV [DEPLOY, false]
enable_creation_date: true
type: timeago
- minify:
minify_html: !ENV [DEPLOY, false]
-- group:
- enabled: !ENV [MATERIAL_INSIDERS, false]
- plugins:
- - typeset
+- redirects:
+ redirect_maps:
+ reference/mkdocstrings_handlers/python/index.md: reference/api.md
+ reference/mkdocstrings_handlers/python/config.md: reference/api.md#mkdocstrings_handlers.python.config
+ reference/mkdocstrings_handlers/python/debug.md: reference/api.md#mkdocstrings_handlers.python.debug
+ reference/mkdocstrings_handlers/python/handler.md: reference/api.md#mkdocstrings_handlers.python.handler
+ reference/mkdocstrings_handlers/python/rendering.md: reference/api.md#mkdocstrings_handlers.python.rendering
+- typeset
extra:
social:
diff --git a/pyproject.toml b/pyproject.toml
index b4a453e4..dac83b5b 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -6,9 +6,10 @@ build-backend = "pdm.backend"
name = "mkdocstrings-python"
description = "A Python handler for mkdocstrings."
authors = [{name = "Timothée Mazzucotelli", email = "dev@pawamoy.fr"}]
-license = {text = "ISC"}
+license = "ISC"
+license-files = ["LICENSE"]
readme = "README.md"
-requires-python = ">=3.9"
+requires-python = ">=3.10"
keywords = []
dynamic = ["version"]
classifiers = [
@@ -17,7 +18,6 @@ classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
- "Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
@@ -30,9 +30,9 @@ classifiers = [
"Typing :: Typed",
]
dependencies = [
- "mkdocstrings>=0.28",
- "mkdocs-autorefs>=1.2",
- "griffe>=0.49",
+ "mkdocstrings>=0.30",
+ "mkdocs-autorefs>=1.4",
+ "griffelib>=2.0",
"typing-extensions>=4.0; python_version < '3.11'",
]
@@ -56,7 +56,7 @@ includes = ["src/mkdocstrings_handlers"]
editable-backend = "editables"
# Include as much as possible in the source distribution, to help redistributors.
-excludes = ["**/.pytest_cache"]
+excludes = ["**/.pytest_cache", "**/.mypy_cache"]
source-includes = [
"config",
"docs",
@@ -78,37 +78,40 @@ data = [
]
[dependency-groups]
-dev = [
- # maintenance
+maintain = [
"build>=1.2",
"git-changelog>=2.5",
"twine>=5.1",
-
- # ci
- "duty>=1.4",
- "ruff>=0.4",
+ "yore>=0.3.3",
+]
+ci = [
+ "beautifulsoup4>=4.12.3",
+ "black>=25.1",
+ "duty>=1.6",
+ "griffe>=2.1",
+ "inline-snapshot>=0.25",
+ "mypy>=1.10",
"pytest>=8.2",
"pytest-cov>=5.0",
"pytest-randomly>=3.15",
"pytest-xdist>=3.6",
- "beautifulsoup4>=4.12.3",
- "inline-snapshot>=0.18",
- "mypy>=1.10",
"types-markdown>=3.6",
"types-pyyaml>=6.0",
-
- # docs
- "black>=24.4",
+ "ruff>=0.4",
+]
+ docs = [
"markdown-callouts>=0.4",
"markdown-exec>=1.8",
"mkdocs>=1.6",
"mkdocs-coverage>=1.0",
- "mkdocs-gen-files>=0.5",
"mkdocs-git-revision-date-localized-plugin>=1.2",
- "mkdocs-literate-nav>=0.6",
+ "mkdocs-llmstxt>=0.2",
"mkdocs-material>=9.5",
- "pydantic>=2.10",
"mkdocs-minify-plugin>=0.8",
+ "mkdocs-redirects>=1.2",
+ "mkdocs-section-index>=0.3",
+ "mkdocstrings>=0.29",
+ "pydantic>=2.10",
# YORE: EOL 3.10: Remove line.
"tomli>=2.0; python_version < '3.11'",
]
@@ -116,3 +119,6 @@ dev = [
[tool.inline-snapshot]
storage-dir = "tests/snapshots"
format-command = "ruff format --config config/ruff.toml --stdin-filename {filename}"
+
+[tool.uv]
+default-groups = ["maintain", "ci", "docs"]
diff --git a/scripts/gen_credits.py b/scripts/gen_credits.py
index 85240535..0eab7685 100644
--- a/scripts/gen_credits.py
+++ b/scripts/gen_credits.py
@@ -1,4 +1,4 @@
-"""Script to generate the project's credits."""
+# Script to generate the project's credits.
from __future__ import annotations
@@ -27,7 +27,7 @@
pyproject = tomllib.load(pyproject_file)
project = pyproject["project"]
project_name = project["name"]
-devdeps = [dep for dep in pyproject["dependency-groups"]["dev"] if not dep.startswith("-e")]
+devdeps = [dep for group in pyproject["dependency-groups"].values() for dep in group if not dep.startswith("-e")]
PackageMetadata = dict[str, Union[str, Iterable[str]]]
Metadata = dict[str, PackageMetadata]
@@ -55,7 +55,7 @@ def _extra_marker(req: Requirement) -> str | None:
if not req.marker:
return None
try:
- return next(marker[2].value for marker in req.marker._markers if getattr(marker[0], "value", None) == "extra")
+ return next(marker[2].value for marker in req.marker._markers if getattr(marker[0], "value", None) == "extra") # type: ignore[union-attr]
except StopIteration:
return None
diff --git a/scripts/gen_ref_nav.py b/scripts/gen_ref_nav.py
deleted file mode 100644
index 6939e864..00000000
--- a/scripts/gen_ref_nav.py
+++ /dev/null
@@ -1,37 +0,0 @@
-"""Generate the code reference pages and navigation."""
-
-from pathlib import Path
-
-import mkdocs_gen_files
-
-nav = mkdocs_gen_files.Nav()
-mod_symbol = ''
-
-root = Path(__file__).parent.parent
-src = root / "src"
-
-for path in sorted(src.rglob("*.py")):
- module_path = path.relative_to(src).with_suffix("")
- doc_path = path.relative_to(src).with_suffix(".md")
- full_doc_path = Path("reference", doc_path)
-
- parts = tuple(module_path.parts)
-
- if parts[-1] == "__init__":
- parts = parts[:-1]
- doc_path = doc_path.with_name("index.md")
- full_doc_path = full_doc_path.with_name("index.md")
- elif parts[-1].startswith("_"):
- continue
-
- nav_parts = [f"{mod_symbol} {part}" for part in parts]
- nav[tuple(nav_parts)] = doc_path.as_posix()
-
- with mkdocs_gen_files.open(full_doc_path, "w") as fd:
- ident = ".".join(parts)
- fd.write(f"---\ntitle: {ident}\n---\n\n::: {ident}")
-
- mkdocs_gen_files.set_edit_path(full_doc_path, ".." / path.relative_to(root))
-
-with mkdocs_gen_files.open("reference/SUMMARY.md", "w") as nav_file:
- nav_file.writelines(nav.build_literate_nav())
diff --git a/scripts/get_version.py b/scripts/get_version.py
index f4a30a8c..3c425a73 100644
--- a/scripts/get_version.py
+++ b/scripts/get_version.py
@@ -1,10 +1,15 @@
-"""Get current project version from Git tags or changelog."""
+# Get current project version from Git tags or changelog.
import re
from contextlib import suppress
from pathlib import Path
-from pdm.backend.hooks.version import SCMVersion, Version, default_version_formatter, get_version_from_scm
+from pdm.backend.hooks.version import ( # ty: ignore[unresolved-import]
+ SCMVersion,
+ Version,
+ default_version_formatter,
+ get_version_from_scm,
+)
_root = Path(__file__).parent.parent
_changelog = _root / "CHANGELOG.md"
@@ -13,7 +18,6 @@
def get_version() -> str:
- """Get current project version from Git tags or changelog."""
scm_version = get_version_from_scm(_root) or _default_scm_version
if scm_version.version <= Version("0.1"): # Missing Git tags?
with suppress(OSError, StopIteration): # noqa: SIM117
diff --git a/scripts/griffe_extensions.py b/scripts/griffe_extensions.py
index 7d283054..87106d4a 100644
--- a/scripts/griffe_extensions.py
+++ b/scripts/griffe_extensions.py
@@ -1,4 +1,4 @@
-"""Custom extensions for Griffe."""
+# Custom extensions for Griffe.
from __future__ import annotations
@@ -7,7 +7,7 @@
import griffe
-logger = griffe.get_logger("griffe_extensions")
+_logger = griffe.get_logger("griffe_extensions")
class CustomFields(griffe.Extension):
@@ -23,19 +23,24 @@ def on_attribute_instance(
"""Fetch descriptions from `Field` annotations."""
if attr.docstring:
return
+ annotation = attr.annotation
+ if not isinstance(annotation, griffe.ExprSubscript) or not isinstance(annotation.slice, griffe.ExprTuple):
+ return
try:
- field: griffe.ExprCall = attr.annotation.slice.elements[1] # type: ignore[union-attr]
- except AttributeError:
+ field = annotation.slice.elements[1]
+ except IndexError:
+ return
+ if not isinstance(field, griffe.ExprCall):
return
- if field.canonical_path == "mkdocstrings_handlers.python.config.Field":
+ if field.canonical_path == "mkdocstrings_handlers.python._internal.config._Field":
description = next(
attr.value
for attr in field.arguments
if isinstance(attr, griffe.ExprKeyword) and attr.name == "description"
)
if not isinstance(description, str):
- logger.warning(f"Field description of {attr.path} is not a static string")
+ _logger.warning(f"Field description of {attr.path} is not a static string")
description = str(description)
attr.docstring = griffe.Docstring(
diff --git a/scripts/insiders.py b/scripts/insiders.py
deleted file mode 100644
index a7da99bc..00000000
--- a/scripts/insiders.py
+++ /dev/null
@@ -1,206 +0,0 @@
-"""Functions related to Insiders funding goals."""
-
-from __future__ import annotations
-
-import json
-import logging
-import os
-import posixpath
-from dataclasses import dataclass
-from datetime import date, datetime, timedelta
-from itertools import chain
-from pathlib import Path
-from typing import TYPE_CHECKING, cast
-from urllib.error import HTTPError
-from urllib.parse import urljoin
-from urllib.request import urlopen
-
-import yaml
-
-if TYPE_CHECKING:
- from collections.abc import Iterable
-
-logger = logging.getLogger(f"mkdocs.logs.{__name__}")
-
-
-def human_readable_amount(amount: int) -> str: # noqa: D103
- str_amount = str(amount)
- if len(str_amount) >= 4: # noqa: PLR2004
- return f"{str_amount[: len(str_amount) - 3]},{str_amount[-3:]}"
- return str_amount
-
-
-@dataclass
-class Project:
- """Class representing an Insiders project."""
-
- name: str
- url: str
-
-
-@dataclass
-class Feature:
- """Class representing an Insiders feature."""
-
- name: str
- ref: str | None
- since: date | None
- project: Project | None
-
- 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("/"))
-
- def render(self, rel_base: str = "..", *, badge: bool = False) -> None: # noqa: D102
- new = ""
- if badge:
- recent = self.since and date.today() - self.since <= timedelta(days=60) # noqa: DTZ011
- if recent:
- 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 ""
- 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
-class Goal:
- """Class representing an Insiders goal."""
-
- name: str
- amount: int
- features: list[Feature]
- complete: bool = False
-
- @property
- def human_readable_amount(self) -> str: # noqa: D102
- return human_readable_amount(self.amount)
-
- def render(self, rel_base: str = "..") -> None: # noqa: D102
- print(f"#### $ {self.human_readable_amount} — {self.name}\n")
- if self.features:
- for feature in self.features:
- feature.render(rel_base)
- print("")
- else:
- print("There are no features in this goal for this project. ")
- print(
- "[See the features in this goal **for all Insiders projects.**]"
- f"(https://pawamoy.github.io/insiders/#{self.amount}-{self.name.lower().replace(' ', '-')})",
- )
-
-
-def load_goals(data: str, funding: int = 0, project: Project | None = None) -> dict[int, Goal]:
- """Load goals from JSON data.
-
- Parameters:
- data: The JSON data.
- funding: The current total funding, per month.
- origin: The origin of the data (URL).
-
- Returns:
- A dictionaries of goals, keys being their target monthly amount.
- """
- goals_data = yaml.safe_load(data)["goals"]
- return {
- amount: Goal(
- name=goal_data["name"],
- amount=amount,
- complete=funding >= amount,
- features=[
- Feature(
- name=feature_data["name"],
- ref=feature_data.get("ref"),
- since=feature_data.get("since") and datetime.strptime(feature_data["since"], "%Y/%m/%d").date(), # noqa: DTZ007
- project=project,
- )
- for feature_data in goal_data["features"]
- ],
- )
- for amount, goal_data in goals_data.items()
- }
-
-
-def _load_goals_from_disk(path: str, funding: int = 0) -> dict[int, Goal]:
- project_dir = os.getenv("MKDOCS_CONFIG_DIR", ".")
- try:
- data = Path(project_dir, path).read_text()
- except OSError as error:
- raise RuntimeError(f"Could not load data from disk: {path}") from error
- return load_goals(data, funding)
-
-
-def _load_goals_from_url(source_data: tuple[str, str, str], funding: int = 0) -> dict[int, Goal]:
- project_name, project_url, data_fragment = source_data
- data_url = urljoin(project_url, data_fragment)
- try:
- with urlopen(data_url) as response: # noqa: S310
- data = response.read()
- except HTTPError as error:
- raise RuntimeError(f"Could not load data from network: {data_url}") from error
- return load_goals(data, funding, project=Project(name=project_name, url=project_url))
-
-
-def _load_goals(source: str | tuple[str, str, str], funding: int = 0) -> dict[int, Goal]:
- if isinstance(source, str):
- return _load_goals_from_disk(source, funding)
- return _load_goals_from_url(source, funding)
-
-
-def funding_goals(source: str | list[str | tuple[str, str, str]], funding: int = 0) -> dict[int, Goal]:
- """Load funding goals from a given data source.
-
- Parameters:
- source: The data source (local file path or URL).
- funding: The current total funding, per month.
-
- Returns:
- A dictionaries of goals, keys being their target monthly amount.
- """
- if isinstance(source, str):
- return _load_goals_from_disk(source, funding)
- goals = {}
- for src in source:
- source_goals = _load_goals(src, funding)
- for amount, goal in source_goals.items():
- if amount not in goals:
- goals[amount] = goal
- else:
- goals[amount].features.extend(goal.features)
- return {amount: goals[amount] for amount in sorted(goals)}
-
-
-def feature_list(goals: Iterable[Goal]) -> list[Feature]:
- """Extract feature list from funding goals.
-
- Parameters:
- goals: A list of funding goals.
-
- Returns:
- A list of features.
- """
- return list(chain.from_iterable(goal.features for goal in goals))
-
-
-def load_json(url: str) -> str | list | dict: # noqa: D103
- with urlopen(url) as response: # noqa: S310
- return json.loads(response.read().decode())
-
-
-data_source = globals()["data_source"]
-sponsor_url = "https://github.com/sponsors/pawamoy"
-data_url = "https://raw.githubusercontent.com/pawamoy/sponsors/main"
-numbers: dict[str, int] = load_json(f"{data_url}/numbers.json") # type: ignore[assignment]
-sponsors: list[dict] = load_json(f"{data_url}/sponsors.json") # type: ignore[assignment]
-current_funding = numbers["total"]
-sponsors_count = numbers["count"]
-goals = funding_goals(data_source, funding=current_funding)
-ongoing_goals = [goal for goal in goals.values() if not goal.complete]
-unreleased_features = sorted(
- (ft for ft in feature_list(ongoing_goals) if ft.since),
- key=lambda ft: cast(date, ft.since),
- reverse=True,
-)
diff --git a/scripts/make.py b/scripts/make.py
index 3d427296..b741a366 100755
--- a/scripts/make.py
+++ b/scripts/make.py
@@ -1,6 +1,4 @@
#!/usr/bin/env python3
-"""Management commands."""
-
from __future__ import annotations
import os
@@ -16,7 +14,8 @@
from collections.abc import Iterator
-PYTHON_VERSIONS = os.getenv("PYTHON_VERSIONS", "3.9 3.10 3.11 3.12 3.13 3.14").split()
+PYTHON_VERSIONS = os.getenv("PYTHON_VERSIONS", "3.10 3.11 3.12 3.13 3.14 3.15").split()
+PYTHON_DEV = "3.15"
def shell(cmd: str, *, capture_output: bool = False, **kwargs: Any) -> str | None:
@@ -69,16 +68,31 @@ def setup() -> None:
uv_install(venv_path)
+class _RunError(subprocess.CalledProcessError):
+ def __init__(self, *args: Any, python_version: str, **kwargs: Any):
+ super().__init__(*args, **kwargs)
+ self.python_version = python_version
+
+
def run(version: str, cmd: str, *args: str, **kwargs: Any) -> None:
"""Run a command in a virtual environment."""
kwargs = {"check": True, **kwargs}
uv_run = ["uv", "run", "--no-sync"]
- if version == "default":
- with environ(UV_PROJECT_ENVIRONMENT=".venv"):
- subprocess.run([*uv_run, cmd, *args], **kwargs) # noqa: S603, PLW1510
- else:
- with environ(UV_PROJECT_ENVIRONMENT=f".venvs/{version}", MULTIRUN="1"):
- subprocess.run([*uv_run, cmd, *args], **kwargs) # noqa: S603, PLW1510
+ try:
+ if version == "default":
+ with environ(UV_PROJECT_ENVIRONMENT=".venv"):
+ subprocess.run([*uv_run, cmd, *args], **kwargs) # noqa: S603, PLW1510
+ else:
+ with environ(UV_PROJECT_ENVIRONMENT=f".venvs/{version}", MULTIRUN="1"):
+ subprocess.run([*uv_run, cmd, *args], **kwargs) # noqa: S603, PLW1510
+ except subprocess.CalledProcessError as process:
+ raise _RunError(
+ returncode=process.returncode,
+ python_version=version,
+ cmd=process.cmd,
+ output=process.output,
+ stderr=process.stderr,
+ ) from process
def multirun(cmd: str, *args: str, **kwargs: Any) -> None:
@@ -146,19 +160,31 @@ def main() -> int:
cmd = args.pop(0)
if cmd == "run":
- run("default", *args)
+ if not args:
+ print("make: run: missing command", file=sys.stderr)
+ return 1
+ run("default", *args) # ty: ignore[missing-argument]
return 0
if cmd == "multirun":
- multirun(*args)
+ if not args:
+ print("make: run: missing command", file=sys.stderr)
+ return 1
+ multirun(*args) # ty: ignore[missing-argument]
return 0
if cmd == "allrun":
- allrun(*args)
+ if not args:
+ print("make: run: missing command", file=sys.stderr)
+ return 1
+ allrun(*args) # ty: ignore[missing-argument]
return 0
if cmd.startswith("3."):
- run(cmd, *args)
+ if not args:
+ print("make: run: missing command", file=sys.stderr)
+ return 1
+ run(cmd, *args) # ty: ignore[missing-argument]
return 0
opts = []
@@ -185,7 +211,14 @@ def main() -> int:
if __name__ == "__main__":
try:
sys.exit(main())
- except subprocess.CalledProcessError as process:
+ except _RunError as process:
if process.output:
print(process.output, file=sys.stderr)
- sys.exit(process.returncode)
+ if (code := process.returncode) == 139: # noqa: PLR2004
+ print(
+ f"✗ (python{process.python_version}) '{' '.join(process.cmd)}' failed with return code {code} (segfault)",
+ file=sys.stderr,
+ )
+ if process.python_version == PYTHON_DEV:
+ code = 0
+ sys.exit(code)
diff --git a/scripts/mkdocs_hooks.py b/scripts/mkdocs_hooks.py
index 805055e0..739f93b3 100644
--- a/scripts/mkdocs_hooks.py
+++ b/scripts/mkdocs_hooks.py
@@ -1,4 +1,4 @@
-"""Generate a JSON schema of the Python handler configuration."""
+# Generate a JSON schema of the Python handler configuration.
import json
from dataclasses import dataclass, fields
@@ -8,7 +8,7 @@
from mkdocs.config.defaults import MkDocsConfig
from mkdocs.plugins import get_plugin_logger
-from mkdocstrings_handlers.python.config import PythonInputConfig, PythonInputOptions
+from mkdocstrings_handlers.python import PythonInputConfig, PythonInputOptions
# TODO: Update when Pydantic supports Python 3.14 (sources and duties as well).
try:
@@ -17,13 +17,13 @@
TypeAdapter = None # type: ignore[assignment,misc]
-logger = get_plugin_logger(__name__)
+_logger = get_plugin_logger(__name__)
def on_post_build(config: MkDocsConfig, **kwargs: Any) -> None: # noqa: ARG001
"""Write `schema.json` to the site directory."""
if TypeAdapter is None:
- logger.info("Pydantic is not installed, skipping JSON schema generation")
+ _logger.info("Pydantic is not installed, skipping JSON schema generation")
return
@dataclass
@@ -35,12 +35,12 @@ class PythonHandlerSchema:
schema["$schema"] = "https://json-schema.org/draft-07/schema"
with open(join(config.site_dir, "schema.json"), "w") as file:
json.dump(schema, file, indent=2)
- logger.debug("Generated JSON schema")
+ _logger.debug("Generated JSON schema")
autorefs = config["plugins"]["autorefs"]
for field in fields(PythonInputConfig):
if f"setting-{field.name}" not in autorefs._primary_url_map:
- logger.warning(f"Handler setting `{field.name}` is not documented")
+ _logger.warning(f"Handler setting `{field.name}` is not documented")
for field in fields(PythonInputOptions):
if f"option-{field.name}" not in autorefs._primary_url_map:
- logger.warning(f"Configuration option `{field.name}` is not documented")
+ _logger.warning(f"Configuration option `{field.name}` is not documented")
diff --git a/src/mkdocstrings_handlers/python/__init__.py b/src/mkdocstrings_handlers/python/__init__.py
index 0432a90d..c8927f7d 100644
--- a/src/mkdocstrings_handlers/python/__init__.py
+++ b/src/mkdocstrings_handlers/python/__init__.py
@@ -1,5 +1,72 @@
"""Python handler for mkdocstrings."""
-from mkdocstrings_handlers.python.handler import get_handler
+from mkdocstrings_handlers.python._internal.config import (
+ AutoStyleOptions,
+ GoogleStyleOptions,
+ Inventory,
+ NumpyStyleOptions,
+ PerStyleOptions,
+ PythonConfig,
+ PythonInputConfig,
+ PythonInputOptions,
+ PythonOptions,
+ SphinxStyleOptions,
+ SummaryOption,
+)
+from mkdocstrings_handlers.python._internal.handler import PythonHandler, get_handler
+from mkdocstrings_handlers.python._internal.rendering import (
+ AutorefsHook,
+ Order,
+ Tree,
+ do_as_attributes_section,
+ do_as_classes_section,
+ do_as_functions_section,
+ do_as_modules_section,
+ do_as_type_aliases_section,
+ do_backlink_tree,
+ do_filter_objects,
+ do_format_attribute,
+ do_format_code,
+ do_format_signature,
+ do_format_type_alias,
+ do_get_template,
+ do_order_members,
+ do_source_location,
+ do_split_path,
+ do_stash_crossref,
+)
-__all__ = ["get_handler"]
+__all__ = [
+ "AutoStyleOptions",
+ "AutorefsHook",
+ "GoogleStyleOptions",
+ "Inventory",
+ "NumpyStyleOptions",
+ "Order",
+ "PerStyleOptions",
+ "PythonConfig",
+ "PythonHandler",
+ "PythonInputConfig",
+ "PythonInputOptions",
+ "PythonOptions",
+ "SphinxStyleOptions",
+ "SummaryOption",
+ "Tree",
+ "do_as_attributes_section",
+ "do_as_classes_section",
+ "do_as_functions_section",
+ "do_as_modules_section",
+ "do_as_type_aliases_section",
+ "do_backlink_tree",
+ "do_filter_objects",
+ "do_format_attribute",
+ "do_format_code",
+ "do_format_signature",
+ "do_format_type_alias",
+ "do_get_template",
+ "do_order_members",
+ "do_source_location",
+ "do_split_path",
+ "do_stash_crossref",
+ "get_handler",
+]
diff --git a/src/mkdocstrings_handlers/python/_internal/__init__.py b/src/mkdocstrings_handlers/python/_internal/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/src/mkdocstrings_handlers/python/config.py b/src/mkdocstrings_handlers/python/_internal/config.py
similarity index 75%
rename from src/mkdocstrings_handlers/python/config.py
rename to src/mkdocstrings_handlers/python/_internal/config.py
index 6607d01c..f9f8963b 100644
--- a/src/mkdocstrings_handlers/python/config.py
+++ b/src/mkdocstrings_handlers/python/_internal/config.py
@@ -1,4 +1,4 @@
-"""Configuration and options dataclasses."""
+# Configuration and options dataclasses.
from __future__ import annotations
@@ -7,7 +7,9 @@
from dataclasses import field, fields
from typing import TYPE_CHECKING, Annotated, Any, Literal
-from mkdocstrings.loggers import get_logger
+from mkdocstrings import get_logger
+
+from mkdocstrings_handlers.python._internal.rendering import Order # noqa: TC001
# YORE: EOL 3.10: Replace block with line 2.
if sys.version_info >= (3, 11):
@@ -16,8 +18,9 @@
from typing_extensions import Self
-logger = get_logger(__name__)
+_logger = get_logger(__name__)
+_DEFAULT_FILTERS = ["!^_[^_]"]
try:
# When Pydantic is available, use it to validate options (done automatically).
@@ -36,17 +39,6 @@
if getattr(pydantic, "__version__", "1.").startswith("1."):
raise ImportError # noqa: TRY301
- if sys.version_info < (3, 10):
- try:
- import eval_type_backport # noqa: F401
- except ImportError:
- logger.debug(
- "Pydantic needs the `eval-type-backport` package to be installed "
- "for modern type syntax to work on Python 3.9. "
- "Deactivating Pydantic validation for Python handler options.",
- )
- raise
-
from inspect import cleandoc
from pydantic import Field as BaseField
@@ -54,7 +46,7 @@
_base_url = "https://mkdocstrings.github.io/python/usage"
- def Field( # noqa: N802, D103
+ def _Field( # noqa: N802
*args: Any,
description: str,
group: Literal["general", "headings", "members", "docstrings", "signatures"] | None = None,
@@ -75,7 +67,7 @@ def _add_markdown_description(schema: dict[str, Any]) -> None:
except ImportError:
from dataclasses import dataclass # type: ignore[no-redef]
- def Field(*args: Any, **kwargs: Any) -> None: # type: ignore[misc] # noqa: D103, N802
+ def _Field(*args: Any, **kwargs: Any) -> None: # type: ignore[misc] # noqa: N802
pass
@@ -83,20 +75,13 @@ def Field(*args: Any, **kwargs: Any) -> None: # type: ignore[misc] # noqa: D10
from collections.abc import MutableMapping
-# YORE: EOL 3.9: Remove block.
-_dataclass_options = {"frozen": True}
-if sys.version_info >= (3, 10):
- _dataclass_options["kw_only"] = True
-
-
-# YORE: EOL 3.9: Replace `**_dataclass_options` with `frozen=True, kw_only=True` within line.
-@dataclass(**_dataclass_options) # type: ignore[call-overload]
+@dataclass(frozen=True, kw_only=True)
class GoogleStyleOptions:
"""Google style docstring options."""
ignore_init_summary: Annotated[
bool,
- Field(
+ _Field(
group="docstrings",
parent="docstring_options",
description="Whether to ignore the summary in `__init__` methods' docstrings.",
@@ -105,7 +90,7 @@ class GoogleStyleOptions:
returns_multiple_items: Annotated[
bool,
- Field(
+ _Field(
group="docstrings",
parent="docstring_options",
description="""Whether to parse multiple items in `Yields` and `Returns` sections.
@@ -118,7 +103,7 @@ class GoogleStyleOptions:
returns_named_value: Annotated[
bool,
- Field(
+ _Field(
group="docstrings",
parent="docstring_options",
description="""Whether to parse `Yields` and `Returns` section items as name and description, rather than type and description.
@@ -131,7 +116,7 @@ class GoogleStyleOptions:
returns_type_in_property_summary: Annotated[
bool,
- Field(
+ _Field(
group="docstrings",
parent="docstring_options",
description="Whether to parse the return type of properties at the beginning of their summary: `str: Summary of the property`.",
@@ -140,7 +125,7 @@ class GoogleStyleOptions:
receives_multiple_items: Annotated[
bool,
- Field(
+ _Field(
group="docstrings",
parent="docstring_options",
description="""Whether to parse multiple items in `Receives` sections.
@@ -153,7 +138,7 @@ class GoogleStyleOptions:
receives_named_value: Annotated[
bool,
- Field(
+ _Field(
group="docstrings",
parent="docstring_options",
description="""Whether to parse `Receives` section items as name and description, rather than type and description.
@@ -166,7 +151,7 @@ class GoogleStyleOptions:
trim_doctest_flags: Annotated[
bool,
- Field(
+ _Field(
group="docstrings",
parent="docstring_options",
description="Whether to remove doctest flags from Python example blocks.",
@@ -175,22 +160,39 @@ class GoogleStyleOptions:
warn_unknown_params: Annotated[
bool,
- Field(
+ _Field(
group="docstrings",
parent="docstring_options",
description="Warn about documented parameters not appearing in the signature.",
),
] = True
+ warn_missing_types: Annotated[
+ bool,
+ _Field(
+ group="docstrings",
+ parent="docstring_options",
+ description="Warn about missing type/annotation for parameters, return values, etc.",
+ ),
+ ] = True
-# YORE: EOL 3.9: Replace `**_dataclass_options` with `frozen=True, kw_only=True` within line.
-@dataclass(**_dataclass_options) # type: ignore[call-overload]
+ warnings: Annotated[
+ bool,
+ _Field(
+ group="docstrings",
+ parent="docstring_options",
+ description="Generally enable/disable warnings when parsing docstrings.",
+ ),
+ ] = True
+
+
+@dataclass(frozen=True, kw_only=True)
class NumpyStyleOptions:
"""Numpy style docstring options."""
ignore_init_summary: Annotated[
bool,
- Field(
+ _Field(
group="docstrings",
parent="docstring_options",
description="Whether to ignore the summary in `__init__` methods' docstrings.",
@@ -199,7 +201,7 @@ class NumpyStyleOptions:
trim_doctest_flags: Annotated[
bool,
- Field(
+ _Field(
group="docstrings",
parent="docstring_options",
description="Whether to remove doctest flags from Python example blocks.",
@@ -208,28 +210,71 @@ class NumpyStyleOptions:
warn_unknown_params: Annotated[
bool,
- Field(
+ _Field(
group="docstrings",
parent="docstring_options",
description="Warn about documented parameters not appearing in the signature.",
),
] = True
+ warn_missing_types: Annotated[
+ bool,
+ _Field(
+ group="docstrings",
+ parent="docstring_options",
+ description="Warn about missing type/annotation for parameters, return values, etc.",
+ ),
+ ] = True
+
+ warnings: Annotated[
+ bool,
+ _Field(
+ group="docstrings",
+ parent="docstring_options",
+ description="Generally enable/disable warnings when parsing docstrings.",
+ ),
+ ] = True
-# YORE: EOL 3.9: Replace `**_dataclass_options` with `frozen=True, kw_only=True` within line.
-@dataclass(**_dataclass_options) # type: ignore[call-overload]
+
+@dataclass(frozen=True, kw_only=True)
class SphinxStyleOptions:
"""Sphinx style docstring options."""
+ warn_unknown_params: Annotated[
+ bool,
+ _Field(
+ group="docstrings",
+ parent="docstring_options",
+ description="Warn about documented parameters not appearing in the signature.",
+ ),
+ ] = True
+
+ warn_missing_types: Annotated[
+ bool,
+ _Field(
+ group="docstrings",
+ parent="docstring_options",
+ description="Warn about missing type/annotation for return values.",
+ ),
+ ] = True
+
+ warnings: Annotated[
+ bool,
+ _Field(
+ group="docstrings",
+ parent="docstring_options",
+ description="Generally enable/disable warnings when parsing docstrings.",
+ ),
+ ] = True
-# YORE: EOL 3.9: Replace `**_dataclass_options` with `frozen=True, kw_only=True` within line.
-@dataclass(**_dataclass_options) # type: ignore[call-overload]
+
+@dataclass(frozen=True, kw_only=True)
class PerStyleOptions:
"""Per style options."""
google: Annotated[
GoogleStyleOptions,
- Field(
+ _Field(
group="docstrings",
parent="docstring_options",
description="Google-style options.",
@@ -238,7 +283,7 @@ class PerStyleOptions:
numpy: Annotated[
NumpyStyleOptions,
- Field(
+ _Field(
group="docstrings",
parent="docstring_options",
description="Numpydoc-style options.",
@@ -247,7 +292,7 @@ class PerStyleOptions:
sphinx: Annotated[
SphinxStyleOptions,
- Field(
+ _Field(
group="docstrings",
parent="docstring_options",
description="Sphinx-style options.",
@@ -266,14 +311,13 @@ def from_data(cls, **data: Any) -> Self:
return cls(**data)
-# YORE: EOL 3.9: Replace `**_dataclass_options` with `frozen=True, kw_only=True` within line.
-@dataclass(**_dataclass_options) # type: ignore[call-overload]
+@dataclass(frozen=True, kw_only=True)
class AutoStyleOptions:
"""Auto style docstring options."""
method: Annotated[
Literal["heuristics", "max_sections"],
- Field(
+ _Field(
group="docstrings",
parent="docstring_options",
description="The method to use to determine the docstring style.",
@@ -282,7 +326,7 @@ class AutoStyleOptions:
style_order: Annotated[
list[str],
- Field(
+ _Field(
group="docstrings",
parent="docstring_options",
description="The order of the docstring styles to try.",
@@ -291,7 +335,7 @@ class AutoStyleOptions:
default: Annotated[
str | None,
- Field(
+ _Field(
group="docstrings",
parent="docstring_options",
description="The default docstring style to use if no other style is detected.",
@@ -300,7 +344,7 @@ class AutoStyleOptions:
per_style_options: Annotated[
PerStyleOptions,
- Field(
+ _Field(
group="docstrings",
parent="docstring_options",
description="Per-style options.",
@@ -315,14 +359,13 @@ def from_data(cls, **data: Any) -> Self:
return cls(**data)
-# YORE: EOL 3.9: Replace `**_dataclass_options` with `frozen=True, kw_only=True` within line.
-@dataclass(**_dataclass_options) # type: ignore[call-overload]
+@dataclass(frozen=True, kw_only=True)
class SummaryOption:
"""Summary option."""
attributes: Annotated[
bool,
- Field(
+ _Field(
group="members",
parent="summary",
description="Whether to render summaries of attributes.",
@@ -331,7 +374,7 @@ class SummaryOption:
functions: Annotated[
bool,
- Field(
+ _Field(
group="members",
parent="summary",
description="Whether to render summaries of functions (methods).",
@@ -340,7 +383,7 @@ class SummaryOption:
classes: Annotated[
bool,
- Field(
+ _Field(
group="members",
parent="summary",
description="Whether to render summaries of classes.",
@@ -349,22 +392,30 @@ class SummaryOption:
modules: Annotated[
bool,
- Field(
+ _Field(
group="members",
parent="summary",
description="Whether to render summaries of modules.",
),
] = False
+ type_aliases: Annotated[
+ bool,
+ _Field(
+ group="members",
+ parent="summary",
+ description="Whether to render summaries of type aliases.",
+ ),
+ ] = False
+
-# YORE: EOL 3.9: Replace `**_dataclass_options` with `frozen=True, kw_only=True` within line.
-@dataclass(**_dataclass_options) # type: ignore[call-overload]
+@dataclass(frozen=True, kw_only=True)
class PythonInputOptions:
"""Accepted input options."""
allow_inspection: Annotated[
bool,
- Field(
+ _Field(
group="general",
description="Whether to allow inspecting modules when visiting them is not possible.",
),
@@ -372,7 +423,7 @@ class PythonInputOptions:
force_inspection: Annotated[
bool,
- Field(
+ _Field(
group="general",
description="Whether to force using dynamic analysis when loading data.",
),
@@ -380,15 +431,23 @@ class PythonInputOptions:
annotations_path: Annotated[
Literal["brief", "source", "full"],
- Field(
+ _Field(
group="signatures",
description="The verbosity for annotations path: `brief` (recommended), `source` (as written in the source), or `full`.",
),
] = "brief"
+ backlinks: Annotated[
+ Literal["flat", "tree", False],
+ _Field(
+ group="general",
+ description="Whether to render backlinks, and how.",
+ ),
+ ] = False
+
docstring_options: Annotated[
GoogleStyleOptions | NumpyStyleOptions | SphinxStyleOptions | AutoStyleOptions | None,
- Field(
+ _Field(
group="docstrings",
description="""The options for the docstring parser.
@@ -399,7 +458,7 @@ class PythonInputOptions:
docstring_section_style: Annotated[
Literal["table", "list", "spacy"],
- Field(
+ _Field(
group="docstrings",
description="The style used to render docstring sections.",
),
@@ -407,7 +466,7 @@ class PythonInputOptions:
docstring_style: Annotated[
Literal["auto", "google", "numpy", "sphinx"] | None,
- Field(
+ _Field(
group="docstrings",
description="The docstring style to use: `auto`, `google`, `numpy`, `sphinx`, or `None`.",
),
@@ -415,28 +474,35 @@ class PythonInputOptions:
extensions: Annotated[
list[str | dict[str, Any]],
- Field(
+ _Field(
group="general",
description="A list of Griffe extensions to load.",
),
] = field(default_factory=list)
filters: Annotated[
- list[str],
- Field(
+ list[str] | Literal["public"],
+ _Field(
group="members",
- description="""A list of filters applied to filter objects based on their name.
+ description="""A list of filters, or `"public"`.
+
+ **List of filters**
A filter starting with `!` will exclude matching objects instead of including them.
The `members` option takes precedence over `filters` (filters will still be applied recursively
to lower members in the hierarchy).
+
+ **Filtering methods**
+
+ The `public` method will include only public objects:
+ those added to `__all__` or not starting with an underscore (except for special methods/attributes).
""",
),
- ] = field(default_factory=lambda: ["!^_[^_]"])
+ ] = field(default_factory=_DEFAULT_FILTERS.copy)
find_stubs_package: Annotated[
bool,
- Field(
+ _Field(
group="general",
description="Whether to load stubs package (package-stubs) when extracting docstrings.",
),
@@ -444,7 +510,7 @@ class PythonInputOptions:
group_by_category: Annotated[
bool,
- Field(
+ _Field(
group="members",
description="Group the object's children by categories: attributes, classes, functions, and modules.",
),
@@ -452,7 +518,7 @@ class PythonInputOptions:
heading: Annotated[
str,
- Field(
+ _Field(
group="headings",
description="A custom string to override the autogenerated heading of the root object.",
),
@@ -460,15 +526,23 @@ class PythonInputOptions:
heading_level: Annotated[
int,
- Field(
+ _Field(
group="headings",
description="The initial heading level to use.",
),
] = 2
+ inheritance_diagram_direction: Annotated[
+ Literal["TB", "TD", "BT", "RL", "LR"],
+ _Field(
+ group="docstrings",
+ description="The direction of the Mermaid chart presenting the inheritance diagram of a class.",
+ ),
+ ] = "TD"
+
inherited_members: Annotated[
bool | list[str],
- Field(
+ _Field(
group="members",
description="""A boolean, or an explicit list of inherited members to render.
@@ -480,7 +554,7 @@ class PythonInputOptions:
line_length: Annotated[
int,
- Field(
+ _Field(
group="signatures",
description="Maximum line length when formatting code/signatures.",
),
@@ -488,7 +562,7 @@ class PythonInputOptions:
members: Annotated[
list[str] | bool | None,
- Field(
+ _Field(
group="members",
description="""A boolean, or an explicit list of members to render.
@@ -500,20 +574,25 @@ class PythonInputOptions:
] = None
members_order: Annotated[
- Literal["alphabetical", "source"],
- Field(
+ Order | list[Order],
+ _Field(
group="members",
description="""The members ordering to use.
- - `alphabetical`: order by the members names,
+ - `__all__`: order members according to `__all__` module attributes, if declared;
+ - `alphabetical`: order members alphabetically;
- `source`: order members as they appear in the source file.
+
+ Since `__all__` is a module-only attribute, it can't be used to sort class members,
+ therefore the `members_order` option accepts a list of ordering methods,
+ indicating ordering preferences.
""",
),
] = "alphabetical"
merge_init_into_class: Annotated[
bool,
- Field(
+ _Field(
group="docstrings",
description="Whether to merge the `__init__` method into the class' signature and docstring.",
),
@@ -521,15 +600,23 @@ class PythonInputOptions:
modernize_annotations: Annotated[
bool,
- Field(
+ _Field(
group="signatures",
description="Whether to modernize annotations, for example `Optional[str]` into `str | None`.",
),
] = False
+ overloads_only: Annotated[
+ bool,
+ _Field(
+ group="signatures",
+ description="Whether to hide the implementation signature if the overloads are shown.",
+ ),
+ ] = False
+
parameter_headings: Annotated[
bool,
- Field(
+ _Field(
group="headings",
description="Whether to render headings for parameters (therefore showing parameters in the ToC).",
),
@@ -537,7 +624,7 @@ class PythonInputOptions:
preload_modules: Annotated[
list[str],
- Field(
+ _Field(
group="general",
description="""Pre-load modules that are not specified directly in autodoc instructions (`::: identifier`).
@@ -554,7 +641,7 @@ class PythonInputOptions:
relative_crossrefs: Annotated[
bool,
- Field(
+ _Field(
group="docstrings",
description="Whether to enable the relative crossref syntax.",
),
@@ -562,7 +649,7 @@ class PythonInputOptions:
scoped_crossrefs: Annotated[
bool,
- Field(
+ _Field(
group="docstrings",
description="Whether to enable the scoped crossref ability.",
),
@@ -570,7 +657,7 @@ class PythonInputOptions:
show_overloads: Annotated[
bool,
- Field(
+ _Field(
group="signatures",
description="Show the overloads of a function or method.",
),
@@ -578,7 +665,7 @@ class PythonInputOptions:
separate_signature: Annotated[
bool,
- Field(
+ _Field(
group="signatures",
description="""Whether to put the whole signature in a code block below the heading.
@@ -587,9 +674,17 @@ class PythonInputOptions:
),
] = False
+ show_attribute_values: Annotated[
+ bool,
+ _Field(
+ group="signatures",
+ description="Show initial values of attributes in classes.",
+ ),
+ ] = True
+
show_bases: Annotated[
bool,
- Field(
+ _Field(
group="general",
description="Show the base classes of a class.",
),
@@ -597,7 +692,7 @@ class PythonInputOptions:
show_category_heading: Annotated[
bool,
- Field(
+ _Field(
group="headings",
description="When grouped by categories, show a heading for each category.",
),
@@ -605,7 +700,7 @@ class PythonInputOptions:
show_docstring_attributes: Annotated[
bool,
- Field(
+ _Field(
group="docstrings",
description="Whether to display the 'Attributes' section in the object's docstring.",
),
@@ -613,7 +708,7 @@ class PythonInputOptions:
show_docstring_classes: Annotated[
bool,
- Field(
+ _Field(
group="docstrings",
description="Whether to display the 'Classes' section in the object's docstring.",
),
@@ -621,7 +716,7 @@ class PythonInputOptions:
show_docstring_description: Annotated[
bool,
- Field(
+ _Field(
group="docstrings",
description="Whether to display the textual block (including admonitions) in the object's docstring.",
),
@@ -629,7 +724,7 @@ class PythonInputOptions:
show_docstring_examples: Annotated[
bool,
- Field(
+ _Field(
group="docstrings",
description="Whether to display the 'Examples' section in the object's docstring.",
),
@@ -637,7 +732,7 @@ class PythonInputOptions:
show_docstring_functions: Annotated[
bool,
- Field(
+ _Field(
group="docstrings",
description="Whether to display the 'Functions' or 'Methods' sections in the object's docstring.",
),
@@ -645,7 +740,7 @@ class PythonInputOptions:
show_docstring_modules: Annotated[
bool,
- Field(
+ _Field(
group="docstrings",
description="Whether to display the 'Modules' section in the object's docstring.",
),
@@ -653,7 +748,7 @@ class PythonInputOptions:
show_docstring_other_parameters: Annotated[
bool,
- Field(
+ _Field(
group="docstrings",
description="Whether to display the 'Other Parameters' section in the object's docstring.",
),
@@ -661,7 +756,7 @@ class PythonInputOptions:
show_docstring_parameters: Annotated[
bool,
- Field(
+ _Field(
group="docstrings",
description="Whether to display the 'Parameters' section in the object's docstring.",
),
@@ -669,7 +764,7 @@ class PythonInputOptions:
show_docstring_raises: Annotated[
bool,
- Field(
+ _Field(
group="docstrings",
description="Whether to display the 'Raises' section in the object's docstring.",
),
@@ -677,7 +772,7 @@ class PythonInputOptions:
show_docstring_receives: Annotated[
bool,
- Field(
+ _Field(
group="docstrings",
description="Whether to display the 'Receives' section in the object's docstring.",
),
@@ -685,15 +780,31 @@ class PythonInputOptions:
show_docstring_returns: Annotated[
bool,
- Field(
+ _Field(
group="docstrings",
description="Whether to display the 'Returns' section in the object's docstring.",
),
] = True
+ show_docstring_type_aliases: Annotated[
+ bool,
+ _Field(
+ group="docstrings",
+ description="Whether to display the 'Type Aliases' section in the object's docstring.",
+ ),
+ ] = True
+
+ show_docstring_type_parameters: Annotated[
+ bool,
+ _Field(
+ group="docstrings",
+ description="Whether to display the 'Type Parameters' section in the object's docstring.",
+ ),
+ ] = True
+
show_docstring_warns: Annotated[
bool,
- Field(
+ _Field(
group="docstrings",
description="Whether to display the 'Warns' section in the object's docstring.",
),
@@ -701,7 +812,7 @@ class PythonInputOptions:
show_docstring_yields: Annotated[
bool,
- Field(
+ _Field(
group="docstrings",
description="Whether to display the 'Yields' section in the object's docstring.",
),
@@ -709,7 +820,7 @@ class PythonInputOptions:
show_if_no_docstring: Annotated[
bool,
- Field(
+ _Field(
group="docstrings",
description="Show the object heading even if it has no docstring or children with docstrings.",
),
@@ -717,7 +828,7 @@ class PythonInputOptions:
show_inheritance_diagram: Annotated[
bool,
- Field(
+ _Field(
group="docstrings",
description="Show the inheritance diagram of a class using Mermaid.",
),
@@ -725,7 +836,7 @@ class PythonInputOptions:
show_labels: Annotated[
bool,
- Field(
+ _Field(
group="docstrings",
description="Whether to show labels of the members.",
),
@@ -733,7 +844,7 @@ class PythonInputOptions:
show_object_full_path: Annotated[
bool,
- Field(
+ _Field(
group="docstrings",
description="Show the full Python path of every object.",
),
@@ -741,7 +852,7 @@ class PythonInputOptions:
show_root_full_path: Annotated[
bool,
- Field(
+ _Field(
group="docstrings",
description="Show the full Python path for the root object heading.",
),
@@ -749,7 +860,7 @@ class PythonInputOptions:
show_root_heading: Annotated[
bool,
- Field(
+ _Field(
group="headings",
description="""Show the heading of the object at the root of the documentation tree.
@@ -760,7 +871,7 @@ class PythonInputOptions:
show_root_members_full_path: Annotated[
bool,
- Field(
+ _Field(
group="headings",
description="Show the full Python path of the root members.",
),
@@ -768,7 +879,7 @@ class PythonInputOptions:
show_root_toc_entry: Annotated[
bool,
- Field(
+ _Field(
group="headings",
description="If the root heading is not shown, at least add a ToC entry for it.",
),
@@ -776,15 +887,23 @@ class PythonInputOptions:
show_signature_annotations: Annotated[
bool,
- Field(
+ _Field(
group="signatures",
description="Show the type annotations in methods and functions signatures.",
),
] = False
+ show_signature_type_parameters: Annotated[
+ bool,
+ _Field(
+ group="signatures",
+ description="Show the type parameters in generic classes, methods, functions and type aliases signatures.",
+ ),
+ ] = False
+
show_signature: Annotated[
bool,
- Field(
+ _Field(
group="signatures",
description="Show methods and functions signatures.",
),
@@ -792,7 +911,7 @@ class PythonInputOptions:
show_source: Annotated[
bool,
- Field(
+ _Field(
group="general",
description="Show the source code of this object.",
),
@@ -800,7 +919,7 @@ class PythonInputOptions:
show_submodules: Annotated[
bool,
- Field(
+ _Field(
group="members",
description="When rendering a module, show its submodules recursively.",
),
@@ -808,7 +927,7 @@ class PythonInputOptions:
show_symbol_type_heading: Annotated[
bool,
- Field(
+ _Field(
group="headings",
description="Show the symbol type in headings (e.g. mod, class, meth, func and attr).",
),
@@ -816,15 +935,23 @@ class PythonInputOptions:
show_symbol_type_toc: Annotated[
bool,
- Field(
+ _Field(
group="headings",
description="Show the symbol type in the Table of Contents (e.g. mod, class, methd, func and attr).",
),
] = False
+ skip_local_inventory: Annotated[
+ bool,
+ _Field(
+ group="general",
+ description="Whether to prevent objects from being registered in the local objects inventory.",
+ ),
+ ] = False
+
signature_crossrefs: Annotated[
bool,
- Field(
+ _Field(
group="signatures",
description="Whether to render cross-references for type annotations in signatures.",
),
@@ -832,7 +959,7 @@ class PythonInputOptions:
summary: Annotated[
bool | SummaryOption,
- Field(
+ _Field(
group="members",
description="Whether to render summaries of modules, classes, functions (methods) and attributes.",
),
@@ -840,15 +967,23 @@ class PythonInputOptions:
toc_label: Annotated[
str,
- Field(
+ _Field(
group="headings",
description="A custom string to override the autogenerated toc label of the root object.",
),
] = ""
+ type_parameter_headings: Annotated[
+ bool,
+ _Field(
+ group="headings",
+ description="Whether to render headings for type parameters (therefore showing type parameters in the ToC).",
+ ),
+ ] = False
+
unwrap_annotated: Annotated[
bool,
- Field(
+ _Field(
group="signatures",
description="Whether to unwrap `Annotated` types to show only the type without the annotations.",
),
@@ -856,7 +991,7 @@ class PythonInputOptions:
extra: Annotated[
dict[str, Any],
- Field(
+ _Field(
group="general",
description="Extra options.",
),
@@ -887,9 +1022,15 @@ def coerce(cls, **data: Any) -> MutableMapping[str, Any]:
if "summary" in data:
summary = data["summary"]
if summary is True:
- summary = SummaryOption(attributes=True, functions=True, classes=True, modules=True)
+ summary = SummaryOption(attributes=True, functions=True, classes=True, modules=True, type_aliases=True)
elif summary is False:
- summary = SummaryOption(attributes=False, functions=False, classes=False, modules=False)
+ summary = SummaryOption(
+ attributes=False,
+ functions=False,
+ classes=False,
+ modules=False,
+ type_aliases=False,
+ )
else:
summary = SummaryOption(**summary)
data["summary"] = summary
@@ -901,43 +1042,46 @@ def from_data(cls, **data: Any) -> Self:
return cls(**cls.coerce(**data))
-# YORE: EOL 3.9: Replace `**_dataclass_options` with `frozen=True, kw_only=True` within line.
-@dataclass(**_dataclass_options) # type: ignore[call-overload]
+@dataclass(frozen=True, kw_only=True)
class PythonOptions(PythonInputOptions): # type: ignore[override,unused-ignore]
"""Final options passed as template context."""
- filters: list[tuple[re.Pattern, bool]] = field(default_factory=list) # type: ignore[assignment]
- """A list of filters applied to filter objects based on their name."""
+ filters: list[tuple[re.Pattern, bool]] | Literal["public"] = field( # type: ignore[assignment]
+ default_factory=lambda: [
+ (re.compile(filtr.removeprefix("!")), filtr.startswith("!")) for filtr in _DEFAULT_FILTERS
+ ],
+ )
+ """A list of filters, or `"public"`."""
summary: SummaryOption = field(default_factory=SummaryOption)
- """Whether to render summaries of modules, classes, functions (methods) and attributes."""
+ """Whether to render summaries of modules, classes, functions (methods), attributes and type aliases."""
@classmethod
def coerce(cls, **data: Any) -> MutableMapping[str, Any]:
"""Create an instance from a dictionary."""
- if "filters" in data:
+ if "filters" in data and not isinstance(data["filters"], str):
+ # Filters are `None` or a sequence of strings (tests use tuples).
data["filters"] = [
- (re.compile(filtr.lstrip("!")), filtr.startswith("!")) for filtr in data["filters"] or ()
+ (re.compile(filtr.removeprefix("!")), filtr.startswith("!")) for filtr in data["filters"] or ()
]
return super().coerce(**data)
-# YORE: EOL 3.9: Replace `**_dataclass_options` with `frozen=True, kw_only=True` within line.
-@dataclass(**_dataclass_options) # type: ignore[call-overload]
+@dataclass(frozen=True, kw_only=True)
class Inventory:
"""An inventory."""
url: Annotated[
str,
- Field(
+ _Field(
parent="inventories",
description="The URL of the inventory.",
),
]
- base: Annotated[
+ base_url: Annotated[
str | None,
- Field(
+ _Field(
parent="inventories",
description="The base URL of the inventory.",
),
@@ -945,7 +1089,7 @@ class Inventory:
domains: Annotated[
list[str],
- Field(
+ _Field(
parent="inventories",
description="The domains to load from the inventory.",
),
@@ -953,37 +1097,38 @@ class Inventory:
@property
def _config(self) -> dict[str, Any]:
- return {"base": self.base, "domains": self.domains}
+ return {"base_url": self.base_url, "domains": self.domains}
-# YORE: EOL 3.9: Replace `**_dataclass_options` with `frozen=True, kw_only=True` within line.
-@dataclass(**_dataclass_options) # type: ignore[call-overload]
+@dataclass(frozen=True, kw_only=True)
class PythonInputConfig:
"""Python handler configuration."""
inventories: Annotated[
list[str | Inventory],
- Field(description="The inventories to load."),
+ _Field(description="The inventories to load."),
] = field(default_factory=list)
paths: Annotated[
list[str],
- Field(description="The paths in which to search for Python packages."),
+ _Field(description="The paths in which to search for Python packages."),
] = field(default_factory=lambda: ["."])
load_external_modules: Annotated[
bool | None,
- Field(description="Whether to always load external modules/packages."),
+ _Field(description="Whether to always load external modules/packages."),
] = None
options: Annotated[
PythonInputOptions,
- Field(description="Configuration options for collecting and rendering objects."),
+ _Field(description="Configuration options for collecting and rendering objects."),
] = field(default_factory=PythonInputOptions)
locale: Annotated[
str | None,
- Field(description="The locale to use when translating template strings."),
+ _Field(
+ description="Deprecated. Use mkdocstrings' own `locale` setting instead. The locale to use when translating template strings.",
+ ),
] = None
@classmethod
@@ -997,13 +1142,19 @@ def from_data(cls, **data: Any) -> Self:
return cls(**cls.coerce(**data))
-# YORE: EOL 3.9: Replace `**_dataclass_options` with `frozen=True, kw_only=True` within line.
-@dataclass(**_dataclass_options) # type: ignore[call-overload]
+@dataclass(frozen=True, kw_only=True)
class PythonConfig(PythonInputConfig): # type: ignore[override,unused-ignore]
"""Python handler configuration."""
- inventories: list[Inventory] = field(default_factory=list) # type: ignore[assignment]
- options: dict[str, Any] = field(default_factory=dict) # type: ignore[assignment]
+ inventories: Annotated[
+ list[Inventory],
+ _Field(description="The object inventories to load."),
+ ] = field(default_factory=list) # type: ignore[assignment]
+
+ options: Annotated[
+ dict[str, Any],
+ _Field(description="Configuration options for collecting and rendering objects."),
+ ] = field(default_factory=dict) # type: ignore[assignment]
@classmethod
def coerce(cls, **data: Any) -> MutableMapping[str, Any]:
diff --git a/src/mkdocstrings_handlers/python/debug.py b/src/mkdocstrings_handlers/python/_internal/debug.py
similarity index 80%
rename from src/mkdocstrings_handlers/python/debug.py
rename to src/mkdocstrings_handlers/python/_internal/debug.py
index e44f2be5..a3c99d75 100644
--- a/src/mkdocstrings_handlers/python/debug.py
+++ b/src/mkdocstrings_handlers/python/_internal/debug.py
@@ -1,5 +1,3 @@
-"""Debugging utilities."""
-
from __future__ import annotations
import os
@@ -10,7 +8,7 @@
@dataclass
-class Variable:
+class _Variable:
"""Dataclass describing an environment variable."""
name: str
@@ -20,7 +18,7 @@ class Variable:
@dataclass
-class Package:
+class _Package:
"""Dataclass describing a Python package."""
name: str
@@ -30,7 +28,7 @@ class Package:
@dataclass
-class Environment:
+class _Environment:
"""Dataclass to store environment information."""
interpreter_name: str
@@ -41,9 +39,9 @@ class Environment:
"""Path to Python executable."""
platform: str
"""Operating System."""
- packages: list[Package]
+ packages: list[_Package]
"""Installed packages."""
- variables: list[Variable]
+ variables: list[_Variable]
"""Environment variables."""
@@ -58,7 +56,7 @@ def _interpreter_name_version() -> tuple[str, str]:
return "", "0.0.0"
-def get_version(dist: str = "mkdocstrings-python") -> str:
+def _get_version(dist: str = "mkdocstrings-python") -> str:
"""Get version of the given distribution.
Parameters:
@@ -73,28 +71,28 @@ def get_version(dist: str = "mkdocstrings-python") -> str:
return "0.0.0"
-def get_debug_info() -> Environment:
+def _get_debug_info() -> _Environment:
"""Get debug/environment information.
Returns:
Environment information.
"""
py_name, py_version = _interpreter_name_version()
- packages = ["mkdocs", "mkdocstrings", "mkdocstrings-python", "griffe"]
+ packages = ["mkdocstrings-python"]
variables = ["PYTHONPATH", *[var for var in os.environ if var.startswith("MKDOCSTRINGS_PYTHON")]]
- return Environment(
+ return _Environment(
interpreter_name=py_name,
interpreter_version=py_version,
interpreter_path=sys.executable,
platform=platform.platform(),
- variables=[Variable(var, val) for var in variables if (val := os.getenv(var))],
- packages=[Package(pkg, get_version(pkg)) for pkg in packages],
+ variables=[_Variable(var, val) for var in variables if (val := os.getenv(var))], # ty: ignore[invalid-argument-type]
+ packages=[_Package(pkg, _get_version(pkg)) for pkg in packages],
)
-def print_debug_info() -> None:
+def _print_debug_info() -> None:
"""Print debug/environment information."""
- info = get_debug_info()
+ info = _get_debug_info()
print(f"- __System__: {info.platform}")
print(f"- __Python__: {info.interpreter_name} {info.interpreter_version} ({info.interpreter_path})")
print("- __Environment variables__:")
@@ -106,4 +104,4 @@ def print_debug_info() -> None:
if __name__ == "__main__":
- print_debug_info()
+ _print_debug_info()
diff --git a/src/mkdocstrings_handlers/python/handler.py b/src/mkdocstrings_handlers/python/_internal/handler.py
similarity index 68%
rename from src/mkdocstrings_handlers/python/handler.py
rename to src/mkdocstrings_handlers/python/_internal/handler.py
index 0051be0f..cd1feb3b 100644
--- a/src/mkdocstrings_handlers/python/handler.py
+++ b/src/mkdocstrings_handlers/python/_internal/handler.py
@@ -1,16 +1,16 @@
-"""This module implements a handler for the Python language."""
+# This module implements a handler for the Python language.
from __future__ import annotations
import glob
+import inspect
import os
import posixpath
import sys
from contextlib import suppress
from dataclasses import asdict
from pathlib import Path
-from typing import TYPE_CHECKING, Any, BinaryIO, ClassVar
-from warnings import warn
+from typing import TYPE_CHECKING, Any, BinaryIO, Callable, ClassVar
from griffe import (
AliasResolutionError,
@@ -19,30 +19,34 @@
ModulesCollection,
Parser,
load_extensions,
+ parse_auto,
+ parse_google,
+ parse_numpy,
+ parse_sphinx,
patch_loggers,
)
from mkdocs.exceptions import PluginError
-from mkdocstrings.handlers.base import BaseHandler, CollectionError, CollectorItem, HandlerOptions
-from mkdocstrings.inventory import Inventory
-from mkdocstrings.loggers import get_logger
+from mkdocs_autorefs import BacklinkCrumb
+from mkdocstrings import BaseHandler, CollectionError, CollectorItem, HandlerOptions, Inventory, get_logger
-from mkdocstrings_handlers.python import rendering
-from mkdocstrings_handlers.python.config import PythonConfig, PythonOptions
+from mkdocstrings_handlers.python._internal import rendering
+from mkdocstrings_handlers.python._internal.config import PythonConfig, PythonOptions
if TYPE_CHECKING:
- from collections.abc import Iterator, Mapping, MutableMapping, Sequence
+ from collections.abc import Iterable, Iterator, Mapping, MutableMapping, Sequence
from mkdocs.config.defaults import MkDocsConfig
+ from mkdocs_autorefs import Backlink
+# YORE: EOL 3.10: Replace block with line 2.
if sys.version_info >= (3, 11):
from contextlib import chdir
else:
- # TODO: remove once support for Python 3.10 is dropped
from contextlib import contextmanager
@contextmanager
- def chdir(path: str) -> Iterator[None]: # noqa: D103
+ def chdir(path: str) -> Iterator[None]:
old_wd = os.getcwd()
os.chdir(path)
try:
@@ -51,19 +55,37 @@ def chdir(path: str) -> Iterator[None]: # noqa: D103
os.chdir(old_wd)
-logger = get_logger(__name__)
+_logger = get_logger(__name__)
patch_loggers(get_logger)
-
-def _warn_extra_options(names: Sequence[str]) -> None:
- warn(
- "Passing extra options directly under `options` is deprecated. "
- "Instead, pass them under `options.extra`, and update your templates. "
- f"Current extra (unrecognized) options: {', '.join(sorted(names))}",
- DeprecationWarning,
- stacklevel=3,
- )
+_PARSER_FUNCTIONS: dict[Parser, Callable] = {
+ Parser.auto: parse_auto,
+ Parser.google: parse_google,
+ Parser.numpy: parse_numpy,
+ Parser.sphinx: parse_sphinx,
+}
+
+
+def _filter_parser_options(parser: Parser | None, options: dict[str, Any] | None) -> dict[str, Any] | None:
+ """Filter options unsupported by the selected Griffe parser."""
+ if parser is None or options is None:
+ return options
+
+ accepted_options = set(inspect.signature(_PARSER_FUNCTIONS[parser]).parameters) - {"docstring"}
+ filtered_options = {}
+ for name, value in options.items():
+ if name in accepted_options:
+ if parser is Parser.auto and name == "per_style_options":
+ filtered_options[name] = {
+ style: _filter_parser_options(Parser(style), style_options)
+ for style, style_options in value.items()
+ }
+ else:
+ filtered_options[name] = value
+ else:
+ _logger.warning(f"Ignoring unsupported {parser.value} docstring parser option: {name}")
+ return filtered_options
class PythonHandler(BaseHandler):
@@ -92,20 +114,18 @@ def __init__(self, config: PythonConfig, base_dir: Path, **kwargs: Any) -> None:
super().__init__(**kwargs)
self.config = config
+ """The handler configuration."""
self.base_dir = base_dir
+ """The base directory of the project."""
- # YORE: Bump 2: Replace block with `self.global_options = config.options`.
- global_extra, global_options = PythonOptions._extract_extra(config.options)
- if global_extra:
- _warn_extra_options(global_extra.keys()) # type: ignore[arg-type]
- self._global_extra = global_extra
- self.global_options = global_options
+ self.global_options = config.options
+ """The global configuration options (in `mkdocs.yml`)."""
# Warn if user overrides base templates.
if self.custom_templates:
for theme_dir in base_dir.joinpath(self.custom_templates, "python").iterdir():
if theme_dir.joinpath("_base").is_dir():
- logger.warning(
+ _logger.warning(
f"Overriding base template '{theme_dir.name}/_base/.html.jinja' is not supported, "
f"override '{theme_dir.name}/.html.jinja' instead",
)
@@ -152,7 +172,7 @@ def load_inventory(
) -> Iterator[tuple[str, str]]:
"""Yield items and their URLs from an inventory file streamed from `in_file`.
- This implements mkdocstrings' `load_inventory` "protocol" (see [`mkdocstrings.plugin`][]).
+ This implements mkdocstrings' `load_inventory` "protocol" (see [`mkdocstrings.BaseHandler.load_inventory`][]).
Arguments:
in_file: The binary file-like object to read the inventory from.
@@ -180,26 +200,23 @@ def get_options(self, local_options: Mapping[str, Any]) -> HandlerOptions:
Returns:
The combined options.
"""
- # YORE: Bump 2: Remove block.
- local_extra, local_options = PythonOptions._extract_extra(local_options) # type: ignore[arg-type]
- if local_extra:
- _warn_extra_options(local_extra.keys()) # type: ignore[arg-type]
- unknown_extra = self._global_extra | local_extra
-
extra = {**self.global_options.get("extra", {}), **local_options.get("extra", {})}
options = {**self.global_options, **local_options, "extra": extra}
try:
- # YORE: Bump 2: Replace `opts =` with `return` within line.
- opts = PythonOptions.from_data(**options)
+ return PythonOptions.from_data(**options)
except Exception as error:
raise PluginError(f"Invalid options: {error}") from error
- # YORE: Bump 2: Remove block.
- for key, value in unknown_extra.items():
- object.__setattr__(opts, key, value)
- return opts
+ def collect(self, identifier: str, options: PythonOptions) -> CollectorItem:
+ """Collect the documentation for the given identifier.
- def collect(self, identifier: str, options: PythonOptions) -> CollectorItem: # noqa: D102
+ Parameters:
+ identifier: The identifier of the object to collect.
+ options: The options to use for the collection.
+
+ Returns:
+ The collected item.
+ """
module_name = identifier.split(".", 1)[0]
unknown_module = module_name not in self._modules_collection
reapply = True
@@ -211,7 +228,9 @@ def collect(self, identifier: str, options: PythonOptions) -> CollectorItem: #
parser_name = options.docstring_style
parser = parser_name and Parser(parser_name)
- parser_options = options.docstring_options and asdict(options.docstring_options)
+ parser_options: dict[str, Any] | None = None
+ if options.docstring_options is not None:
+ parser_options = _filter_parser_options(parser, asdict(options.docstring_options))
if unknown_module:
extensions = self.normalize_extension_paths(options.extensions)
@@ -245,8 +264,8 @@ def collect(self, identifier: str, options: PythonOptions) -> CollectorItem: #
external=self.config.load_external_modules,
)
if unresolved:
- logger.debug(f"{len(unresolved)} aliases were still unresolved after {iterations} iterations")
- logger.debug(f"Unresolved aliases: {', '.join(sorted(unresolved))}")
+ _logger.debug(f"{len(unresolved)} aliases were still unresolved after {iterations} iterations")
+ _logger.debug(f"Unresolved aliases: {', '.join(sorted(unresolved))}")
try:
doc_object = self._modules_collection[identifier]
@@ -263,23 +282,51 @@ def collect(self, identifier: str, options: PythonOptions) -> CollectorItem: #
return doc_object
- def render(self, data: CollectorItem, options: PythonOptions) -> str: # noqa: D102 (ignore missing docstring)
- template_name = rendering.do_get_template(self.env, data)
+ def render(self, data: CollectorItem, options: PythonOptions, locale: str | None = None) -> str:
+ """Render the collected data.
+
+ Parameters:
+ data: The collected data.
+ options: The options to use for rendering.
+ locale: The locale to use for rendering (default is "en").
+
+ Returns:
+ The rendered data (HTML).
+ """
+ template_name = rendering.do_get_template(data)
template = self.env.get_template(template_name)
return template.render(
**{
"config": options,
- data.kind.value: data,
+ data.kind.value.replace(" ", "_"): data,
# Heading level is a "state" variable, that will change at each step
# of the rendering recursion. Therefore, it's easier to use it as a plain value
# than as an item in a dictionary.
"heading_level": options.heading_level,
"root": True,
- "locale": self.config.locale,
+ "locale": locale or "en",
},
)
+ def render_backlinks(self, backlinks: Mapping[str, Iterable[Backlink]], *, locale: str | None = None) -> str: # noqa: ARG002
+ """Render the backlinks.
+
+ Parameters:
+ backlinks: The backlinks to render.
+
+ Returns:
+ The rendered backlinks (HTML).
+ """
+ template = self.env.get_template("backlinks.html.jinja")
+ verbose_type = {key: key.capitalize().replace("-by", " by") for key in backlinks.keys()} # noqa: SIM118
+ return template.render(
+ backlinks=backlinks,
+ config=self.get_options({}),
+ verbose_type=verbose_type,
+ default_crumb=BacklinkCrumb(title="", url=""),
+ )
+
def update_env(self, config: Any) -> None: # noqa: ARG002
"""Update the Jinja environment with custom filters and tests.
@@ -290,26 +337,36 @@ def update_env(self, config: Any) -> None: # noqa: ARG002
self.env.lstrip_blocks = True
self.env.keep_trailing_newline = False
self.env.filters["split_path"] = rendering.do_split_path
- self.env.filters["crossref"] = rendering.do_crossref
- self.env.filters["multi_crossref"] = rendering.do_multi_crossref
self.env.filters["order_members"] = rendering.do_order_members
self.env.filters["format_code"] = rendering.do_format_code
self.env.filters["format_signature"] = rendering.do_format_signature
self.env.filters["format_attribute"] = rendering.do_format_attribute
+ self.env.filters["format_type_alias"] = rendering.do_format_type_alias
self.env.filters["filter_objects"] = rendering.do_filter_objects
self.env.filters["stash_crossref"] = rendering.do_stash_crossref
self.env.filters["get_template"] = rendering.do_get_template
+ self.env.filters["source_location"] = rendering.do_source_location
self.env.filters["as_attributes_section"] = rendering.do_as_attributes_section
self.env.filters["as_functions_section"] = rendering.do_as_functions_section
self.env.filters["as_classes_section"] = rendering.do_as_classes_section
+ self.env.filters["as_type_aliases_section"] = rendering.do_as_type_aliases_section
self.env.filters["as_modules_section"] = rendering.do_as_modules_section
+ self.env.filters["backlink_tree"] = rendering.do_backlink_tree
self.env.globals["AutorefsHook"] = rendering.AutorefsHook
self.env.tests["existing_template"] = lambda template_name: template_name in self.env.list_templates()
- def get_aliases(self, identifier: str) -> tuple[str, ...]: # noqa: D102 (ignore missing docstring)
+ def get_aliases(self, identifier: str) -> tuple[str, ...]:
+ """Get the aliases for the given identifier.
+
+ Parameters:
+ identifier: The identifier to get the aliases for.
+
+ Returns:
+ The aliases.
+ """
if "(" in identifier:
identifier, parameter = identifier.split("(", 1)
- parameter.removesuffix(")")
+ parameter = parameter.removesuffix(")")
else:
parameter = ""
try:
@@ -327,9 +384,16 @@ def get_aliases(self, identifier: str) -> tuple[str, ...]: # noqa: D102 (ignore
return tuple(f"{alias}({parameter})" for alias in aliases)
return tuple(aliases)
- def normalize_extension_paths(self, extensions: Sequence) -> Sequence:
- """Resolve extension paths relative to config file."""
- normalized = []
+ def normalize_extension_paths(self, extensions: Sequence) -> list[str | dict[str, Any]]:
+ """Resolve extension paths relative to config file.
+
+ Parameters:
+ extensions: The extensions (configuration) to normalize.
+
+ Returns:
+ The normalized extensions.
+ """
+ normalized: list[str | dict[str, Any]] = []
for ext in extensions:
if isinstance(ext, dict):
@@ -356,19 +420,21 @@ def get_handler(
tool_config: MkDocsConfig,
**kwargs: Any,
) -> PythonHandler:
- """Simply return an instance of `PythonHandler`.
+ """Return an instance of `PythonHandler`.
- Arguments:
+ Parameters:
handler_config: The handler configuration.
tool_config: The tool (SSG) configuration.
+ **kwargs: Additional arguments to pass to the handler.
Returns:
An instance of `PythonHandler`.
"""
- base_dir = Path(tool_config.config_file_path or "./mkdocs.yml").parent
- if "inventories" not in handler_config and "import" in handler_config:
- warn("The 'import' key is renamed 'inventories' for the Python handler", FutureWarning, stacklevel=1)
- handler_config["inventories"] = handler_config.pop("import", [])
+ # In rare cases, Griffe hits the recursion limit because of deeply-nested ASTs.
+ # We therefore increase the limit here, once, before Griffe is used to collect or render stuff.
+ sys.setrecursionlimit(max(sys.getrecursionlimit(), 2000))
+
+ base_dir = Path(getattr(tool_config, "config_file_path", None) or "./mkdocs.yml").parent
return PythonHandler(
config=PythonConfig.from_data(**handler_config),
base_dir=base_dir,
diff --git a/src/mkdocstrings_handlers/python/rendering.py b/src/mkdocstrings_handlers/python/_internal/rendering.py
similarity index 60%
rename from src/mkdocstrings_handlers/python/rendering.py
rename to src/mkdocstrings_handlers/python/_internal/rendering.py
index b5c893c0..dcd4df61 100644
--- a/src/mkdocstrings_handlers/python/rendering.py
+++ b/src/mkdocstrings_handlers/python/_internal/rendering.py
@@ -1,4 +1,4 @@
-"""This module implements rendering utilities."""
+# This module implements rendering utilities.
from __future__ import annotations
@@ -7,15 +7,18 @@
import string
import subprocess
import sys
-import warnings
+from collections import defaultdict
+from contextlib import suppress
from dataclasses import replace
from functools import lru_cache
from pathlib import Path
-from re import Match, Pattern
-from typing import TYPE_CHECKING, Any, Callable, ClassVar, Literal
+from re import Pattern
+from typing import TYPE_CHECKING, Any, Callable, ClassVar, Literal, TypeVar
from griffe import (
Alias,
+ AliasResolutionError,
+ CyclicAliasError,
DocstringAttribute,
DocstringClass,
DocstringFunction,
@@ -24,42 +27,62 @@
DocstringSectionClasses,
DocstringSectionFunctions,
DocstringSectionModules,
+ DocstringSectionTypeAliases,
+ DocstringTypeAlias,
Object,
+ TypeAlias,
)
-from jinja2 import TemplateNotFound, pass_context, pass_environment
+from jinja2 import pass_context
from markupsafe import Markup
-from mkdocs_autorefs.references import AutorefsHookInterface
-from mkdocstrings.loggers import get_logger
+from mkdocs_autorefs import AutorefsHookInterface, Backlink, BacklinkCrumb
+from mkdocstrings import get_logger
if TYPE_CHECKING:
- from collections.abc import Iterator, Sequence
+ from collections.abc import Iterable, Iterator, Sequence
from griffe import Attribute, Class, Function, Module
- from jinja2 import Environment, Template
from jinja2.runtime import Context
- from mkdocstrings.handlers.base import CollectorItem
+ from mkdocstrings import CollectorItem
-logger = get_logger(__name__)
+_logger = get_logger(__name__)
-def _sort_key_alphabetical(item: CollectorItem) -> Any:
- # chr(sys.maxunicode) is a string that contains the final unicode
- # character, so if 'name' isn't found on the object, the item will go to
- # the end of the list.
+def _sort_key_alphabetical(item: CollectorItem) -> str:
+ # `chr(sys.maxunicode)` is a string that contains the final unicode character,
+ # so if `name` isn't found on the object, the item will go to the end of the list.
return item.name or chr(sys.maxunicode)
-def _sort_key_source(item: CollectorItem) -> Any:
- # if 'lineno' is none, the item will go to the start of the list.
+def _sort_key_source(item: CollectorItem) -> float:
+ # If `lineno` is none, the item will go to the end of the list.
if item.is_alias:
- return item.alias_lineno if item.alias_lineno is not None else -1
- return item.lineno if item.lineno is not None else -1
+ return item.alias_lineno if item.alias_lineno is not None else float("inf")
+ return item.lineno if item.lineno is not None else float("inf")
-Order = Literal["alphabetical", "source"]
-order_map = {
+def _sort__all__(item: CollectorItem) -> float:
+ if item.parent.exports is not None:
+ try:
+ return item.parent.exports.index(item.name)
+ except ValueError:
+ # If the item is not in `__all__`, it will go to the end of the list.
+ return float("inf")
+ # No exports declared, refuse to sort (try other methods or return members as they are).
+ raise ValueError(f"Parent object {item.parent.path} doesn't declare exports")
+
+
+Order = Literal["__all__", "alphabetical", "source"]
+"""Ordering methods.
+
+- `__all__`: order members according to `__all__` module attributes, if declared;
+- `alphabetical`: order members alphabetically;
+- `source`: order members as they appear in the source file.
+"""
+
+_order_map: dict[str, Callable[[Object | Alias], str | float]] = {
"alphabetical": _sort_key_alphabetical,
"source": _sort_key_source,
+ "__all__": _sort__all__,
}
@@ -85,7 +108,7 @@ class _StashCrossRefFilter:
@staticmethod
def _gen_key(length: int) -> str:
- return "_" + "".join(random.choice(string.ascii_letters + string.digits) for _ in range(max(1, length - 1))) # noqa: S311
+ return "_" + "".join(random.choice(string.ascii_letters + string.digits) for _ in range(max(2, length - 1))) # noqa: S311
def _gen_stash_key(self, length: int) -> str:
key = self._gen_key(length)
@@ -100,6 +123,7 @@ def __call__(self, crossref: str, *, length: int) -> str:
do_stash_crossref = _StashCrossRefFilter()
+"""Filter to stash cross-references (and restore them after formatting and highlighting)."""
def _format_signature(name: Markup, signature: str, line_length: int) -> str:
@@ -144,8 +168,8 @@ def do_format_signature(
The same code, formatted.
"""
env = context.environment
- # TODO: Stop using `do_get_template` when `*.html` templates are removed.
- template = env.get_template(do_get_template(env, "signature"))
+ type_params_template = env.get_template("type_parameters.html.jinja")
+ signature_template = env.get_template("signature.html.jinja")
if annotations is None:
new_context = context.parent
@@ -153,7 +177,9 @@ def do_format_signature(
new_context = dict(context.parent)
new_context["config"] = replace(new_context["config"], show_signature_annotations=annotations)
- signature = template.render(new_context, function=function, signature=True)
+ signature = type_params_template.render(context.parent, obj=function, signature=True)
+ signature += signature_template.render(new_context, function=function, signature=True)
+
signature = _format_signature(callable_path, signature, line_length)
signature = str(
env.filters["highlight"](
@@ -169,10 +195,12 @@ def do_format_signature(
# Pygments sees it as a function call and not a function definition.
# The result is that the function name is not parsed as such,
# but instead as a regular name: `n` CSS class instead of `nf`.
- # To fix it, we replace the first occurrence of an `n` CSS class
- # with an `nf` one, unless we found `nf` already.
- if signature.find('class="nf"') == -1:
- signature = signature.replace('class="n"', 'class="nf"', 1)
+ # When the function name is a known special name like `__exit__`,
+ # Pygments will set an `fm` (function -> magic) CSS class.
+ # To fix this, we replace the CSS class in the first span with `nf`,
+ # unless we already found an `nf` span.
+ if not re.search(r'', signature):
+ signature = re.sub(r'', '', signature, count=1)
if stash := env.filters["stash_crossref"].stash:
for key, value in stash.items():
@@ -190,6 +218,7 @@ def do_format_attribute(
line_length: int,
*,
crossrefs: bool = False, # noqa: ARG001
+ show_value: bool = True,
) -> str:
"""Format an attribute.
@@ -204,16 +233,26 @@ def do_format_attribute(
The same code, formatted.
"""
env = context.environment
- # TODO: Stop using `do_get_template` when `*.html` templates are removed.
- template = env.get_template(do_get_template(env, "expression"))
+ template = env.get_template("expression.html.jinja")
annotations = context.parent["config"].show_signature_annotations
signature = str(attribute_path).strip()
if annotations and attribute.annotation:
- annotation = template.render(context.parent, expression=attribute.annotation, signature=True)
+ annotation = template.render(
+ context.parent,
+ expression=attribute.annotation,
+ signature=True,
+ backlink_type="returned-by",
+ )
signature += f": {annotation}"
- if attribute.value:
- value = template.render(context.parent, expression=attribute.value, signature=True)
+ if show_value and attribute.value:
+ value = template.render(
+ context.parent,
+ expression=attribute.value,
+ signature=True,
+ annotations_path="source",
+ backlink_type="used-by",
+ )
signature += f" = {value}"
signature = do_format_code(signature, line_length)
@@ -235,10 +274,69 @@ def do_format_attribute(
return signature
+@pass_context
+def do_format_type_alias(
+ context: Context,
+ type_alias_path: Markup,
+ type_alias: TypeAlias,
+ line_length: int,
+ *,
+ crossrefs: bool = False, # noqa: ARG001
+) -> str:
+ """Format a type alias.
+
+ Parameters:
+ context: Jinja context, passed automatically.
+ type_alias_path: The path of the type alias we render the signature of.
+ type_alias: The type alias we render the signature of.
+ line_length: The line length.
+ crossrefs: Whether to cross-reference types in the signature.
+
+ Returns:
+ The same code, formatted.
+ """
+ env = context.environment
+ type_params_template = env.get_template("type_parameters.html.jinja")
+ expr_template = env.get_template("expression.html.jinja")
+
+ signature = str(type_alias_path).strip()
+ signature += type_params_template.render(context.parent, obj=type_alias, signature=True)
+ value = expr_template.render(context.parent, expression=type_alias.value, signature=True)
+ signature += f" = {value}"
+
+ signature = do_format_code(signature, line_length)
+ signature = str(
+ env.filters["highlight"](
+ Markup.escape(signature),
+ language="python",
+ inline=False,
+ classes=["doc-signature"],
+ linenums=False,
+ ),
+ )
+
+ # Since we highlight the signature without `type`,
+ # Pygments sees only an assignment, not a type alias definition
+ # (at the moment it does not understand type alias definitions anyway).
+ # The result is that the type alias name is not parsed as such,
+ # but instead as a regular name: `n` CSS class instead of `nc`.
+ # To fix it, we replace the first occurrence of an `n` CSS class
+ # with an `nc` one, unless we found `nc` already.
+ if not re.search(r'', signature):
+ signature = re.sub(r'', '', signature, count=1)
+
+ if stash := env.filters["stash_crossref"].stash:
+ for key, value in stash.items():
+ signature = re.sub(rf"\b{key}\b", value, signature)
+ stash.clear()
+
+ return signature
+
+
def do_order_members(
members: Sequence[Object | Alias],
- order: Order,
- members_list: bool | list[str] | None,
+ order: Order | list[Order],
+ members_list: bool | list[str] | None, # noqa: FBT001
) -> Sequence[Object | Alias]:
"""Order members given an ordering method.
@@ -257,73 +355,12 @@ def do_order_members(
if name in members_dict:
sorted_members.append(members_dict[name])
return sorted_members
- return sorted(members, key=order_map[order])
-
-
-@lru_cache
-def _warn_crossref() -> None:
- warnings.warn(
- "The `crossref` filter is deprecated and will be removed in a future version",
- DeprecationWarning,
- stacklevel=1,
- )
-
-
-def do_crossref(path: str, *, brief: bool = True) -> Markup:
- """Deprecated. Filter to create cross-references.
-
- Parameters:
- path: The path to link to.
- brief: Show only the last part of the path, add full path as hover.
-
- Returns:
- Markup text.
- """
- _warn_crossref()
- full_path = path
- if brief:
- path = full_path.split(".")[-1]
- return Markup("{path} ").format(
- full_path=full_path,
- path=path,
- )
-
-
-@lru_cache
-def _warn_multi_crossref() -> None:
- warnings.warn(
- "The `multi_crossref` filter is deprecated and will be removed in a future version",
- DeprecationWarning,
- stacklevel=1,
- )
-
-
-def do_multi_crossref(text: str, *, code: bool = True) -> Markup:
- """Deprecated. Filter to create cross-references.
-
- Parameters:
- text: The text to scan.
- code: Whether to wrap the result in a code tag.
-
- Returns:
- Markup text.
- """
- _warn_multi_crossref()
- group_number = 0
- variables = {}
-
- def repl(match: Match) -> str:
- nonlocal group_number
- group_number += 1
- path = match.group()
- path_var = f"path{group_number}"
- variables[path_var] = path
- return f"{{{path_var}}} "
-
- text = re.sub(r"([\w.]+)", repl, text)
- if code:
- text = f"{text}"
- return Markup(text).format(**variables)
+ if isinstance(order, str):
+ order = [order]
+ for method in order:
+ with suppress(ValueError):
+ return sorted(members, key=_order_map[method])
+ return members
_split_path_re = re.compile(r"([.(]?)([\w]+)(\))?")
@@ -383,10 +420,31 @@ def _keep_object(name: str, filters: Sequence[tuple[Pattern, bool]]) -> bool:
return keep
+def _parents(obj: Alias) -> set[str]:
+ parents = {obj.path}
+ parent = obj.parent
+ while parent is not None:
+ parents.add(parent.path)
+ if isinstance(parent, Alias):
+ parents.add(parent.final_target.path)
+ parent = parent.parent
+ return parents
+
+
+def _remove_cycles(objects: list[Object | Alias]) -> Iterator[Object | Alias]:
+ suppress_errors = suppress(AliasResolutionError, CyclicAliasError)
+ for obj in objects:
+ if isinstance(obj, Alias):
+ with suppress_errors:
+ if obj.final_target.path in _parents(obj):
+ continue
+ yield obj
+
+
def do_filter_objects(
objects_dictionary: dict[str, Object | Alias],
*,
- filters: Sequence[tuple[Pattern, bool]] | None = None,
+ filters: Sequence[tuple[Pattern, bool]] | Literal["public"] | None = None,
members_list: bool | list[str] | None = None,
inherited_members: bool | list[str] = False,
keep_no_docstrings: bool = True,
@@ -395,7 +453,7 @@ def do_filter_objects(
Parameters:
objects_dictionary: The dictionary of objects.
- filters: Filters to apply, based on members' names.
+ filters: Filters to apply, based on members' names, or `"public"`.
Each element is a tuple: a pattern, and a boolean indicating whether
to reject the object if the pattern matches.
members_list: An optional, explicit list of members to keep.
@@ -436,14 +494,20 @@ def do_filter_objects(
]
# Use filters and docstrings.
- if filters:
+ if filters == "public":
+ objects = [obj for obj in objects if obj.is_public]
+ elif filters:
objects = [
obj for obj in objects if _keep_object(obj.name, filters) or (inherited_members_specified and obj.inherited)
]
- if keep_no_docstrings:
- return objects
+ if not keep_no_docstrings:
+ objects = [obj for obj in objects if obj.has_docstrings or (inherited_members_specified and obj.inherited)]
+
+ # Prevent infinite recursion.
+ if objects:
+ objects = list(_remove_cycles(objects))
- return [obj for obj in objects if obj.has_docstrings or (inherited_members_specified and obj.inherited)]
+ return objects
@lru_cache(maxsize=1)
@@ -455,13 +519,13 @@ def _get_formatter() -> Callable[[str, int], str]:
if (formatter := formatter_function()) is not None:
return formatter
- logger.info("Formatting signatures requires either Black or Ruff to be installed.")
+ _logger.info("Formatting signatures requires either Black or Ruff to be installed.")
return lambda text, _: text
def _get_ruff_formatter() -> Callable[[str, int], str] | None:
try:
- from ruff.__main__ import find_ruff_bin
+ from ruff.__main__ import find_ruff_bin # noqa: PLC0415
except ImportError:
return None
@@ -497,7 +561,7 @@ def formatter(code: str, line_length: int) -> str:
def _get_black_formatter() -> Callable[[str, int], str] | None:
try:
- from black import InvalidInput, Mode, format_str
+ from black import InvalidInput, Mode, format_str # noqa: PLC0415
except ModuleNotFoundError:
return None
@@ -511,37 +575,44 @@ def formatter(code: str, line_length: int) -> str:
return formatter
-@pass_environment
-def do_get_template(env: Environment, obj: str | Object) -> str | Template:
+def do_get_template(obj: Object | Alias) -> str:
"""Get the template name used to render an object.
Parameters:
- env: The Jinja environment, passed automatically.
- obj: A Griffe object, or a template name.
+ obj: A Griffe object.
Returns:
A template name.
"""
- name = obj
- if isinstance(obj, (Alias, Object)):
- extra_data = getattr(obj, "extra", {}).get("mkdocstrings", {})
- if name := extra_data.get("template", ""):
- return name
- name = obj.kind.value
- try:
- template = env.get_template(f"{name}.html")
- except TemplateNotFound:
- return f"{name}.html.jinja"
- our_template = Path(template.filename).is_relative_to(Path(__file__).parent) # type: ignore[arg-type]
- if our_template:
- return f"{name}.html.jinja"
- # TODO: Switch to a warning log after some time.
- logger.info(
- f"DeprecationWarning: Overriding '{name}.html' is deprecated, override '{name}.html.jinja' instead. "
- "After some time, this message will be logged as a warning, causing strict builds to fail.",
- once=True,
- )
- return f"{name}.html"
+ extra_data = getattr(obj, "extra", {}).get("mkdocstrings", {})
+ if name := extra_data.get("template", ""):
+ return name
+ name = obj.kind.value.replace(" ", "_")
+ return f"{name}.html.jinja"
+
+
+def do_source_location(obj: Object | Alias) -> Path:
+ """Get the file path displayed in an object's source block label.
+
+ Environment paths are never displayed: when the object's file lives in
+ a `site-packages` directory (for example a virtual environment inside
+ the current working directory), the path below `site-packages` is
+ returned instead.
+
+ Parameters:
+ obj: A Griffe object.
+
+ Returns:
+ The file path to display.
+ """
+ relative_filepath = obj.relative_filepath
+ parts = relative_filepath.parts
+ if "site-packages" in parts:
+ anchor = len(parts) - 1 - parts[::-1].index("site-packages")
+ return Path(*parts[anchor + 1 :])
+ if relative_filepath.is_absolute():
+ return obj.relative_package_filepath
+ return relative_filepath
@pass_context
@@ -575,7 +646,7 @@ def _parse_docstring_summary(attribute: Attribute) -> str:
name=attribute.name,
description=_parse_docstring_summary(attribute),
annotation=attribute.annotation,
- value=attribute.value, # type: ignore[arg-type]
+ value=attribute.value,
)
for attribute in attributes
if not check_public or attribute.is_public
@@ -668,6 +739,34 @@ def do_as_modules_section(
)
+@pass_context
+def do_as_type_aliases_section(
+ context: Context, # noqa: ARG001
+ type_aliases: Sequence[TypeAlias],
+ *,
+ check_public: bool = True,
+) -> DocstringSectionTypeAliases:
+ """Build a type aliases section from a list of type aliases.
+
+ Parameters:
+ type_aliases: The type aliases to build the section from.
+ check_public: Whether to check if the type_alias is public.
+
+ Returns:
+ A type aliases docstring section.
+ """
+ return DocstringSectionTypeAliases(
+ [
+ DocstringTypeAlias(
+ name=type_alias.name,
+ description=type_alias.docstring.value.split("\n", 1)[0] if type_alias.docstring else "",
+ )
+ for type_alias in type_aliases
+ if not check_public or type_alias.is_public
+ ],
+ )
+
+
class AutorefsHook(AutorefsHookInterface):
"""Autorefs hook.
@@ -696,6 +795,35 @@ def expand_identifier(self, identifier: str) -> str:
Returns:
The expanded identifier.
"""
+ # Handle leading dots in the identifier:
+ # - `.name` is a reference to the current object's `name` member.
+ # - `..name` is a reference to the parent object's `name` member.
+ # - etc.
+ # TODO: We should update the protocol to allow modifying the title too.
+ # In this case it would likely be better to strip dots from the title,
+ # when it's not explicitly specified.
+ if self.config.relative_crossrefs and identifier.startswith("."): # type: ignore[attr-defined]
+ identifier = identifier[1:]
+ obj = self.current_object
+ while identifier and identifier[0] == ".":
+ identifier = identifier[1:]
+ if obj.parent is None:
+ break
+ obj = obj.parent
+ identifier = f"{obj.path}.{identifier}" if identifier else obj.path
+
+ # We resolve the identifier to its full path.
+ # For this we take out the first name, resolve it, and then append the rest.
+ if self.config.scoped_crossrefs: # type: ignore[attr-defined]
+ if "." in identifier:
+ identifier, remaining = identifier.split(".", 1)
+ else:
+ remaining = ""
+ with suppress(Exception):
+ identifier = self.current_object.resolve(identifier)
+ if remaining:
+ identifier = f"{identifier}.{remaining}"
+
return identifier
def get_context(self) -> AutorefsHookInterface.Context:
@@ -711,12 +839,13 @@ def get_context(self) -> AutorefsHookInterface.Context:
"module": "mod",
}.get(self.current_object.kind.value.lower(), "obj")
origin = self.current_object.path
- try:
- filepath = self.current_object.docstring.parent.filepath # type: ignore[union-attr]
- lineno = self.current_object.docstring.lineno or 0 # type: ignore[union-attr]
- except AttributeError:
+ docstring = self.current_object.docstring
+ if docstring is None or docstring.parent is None:
filepath = self.current_object.filepath
lineno = 0
+ else:
+ filepath = docstring.parent.filepath
+ lineno = docstring.lineno or 0
return AutorefsHookInterface.Context(
domain="py",
@@ -725,3 +854,47 @@ def get_context(self) -> AutorefsHookInterface.Context:
filepath=str(filepath),
lineno=lineno,
)
+
+
+_T = TypeVar("_T")
+_Tree = dict[_T, "_Tree"]
+_rtree = lambda: defaultdict(_rtree) # type: ignore[has-type,var-annotated] # noqa: E731
+
+Tree = dict[tuple[_T, ...], "Tree"]
+"""A tree type. Each node holds a tuple of items."""
+
+
+def _tree(data: Iterable[tuple[_T, ...]]) -> _Tree:
+ new_tree = _rtree()
+ for nav in data:
+ *path, leaf = nav
+ node = new_tree
+ for key in path:
+ node = node[key]
+ node[leaf] = _rtree()
+ return new_tree
+
+
+def _compact_tree(tree: _Tree) -> Tree:
+ new_tree = _rtree()
+ for key, value in tree.items():
+ child = _compact_tree(value)
+ if len(child) == 1:
+ child_key, child_value = next(iter(child.items()))
+ new_key = (key, *child_key)
+ new_tree[new_key] = child_value
+ else:
+ new_tree[(key,)] = child
+ return new_tree
+
+
+def do_backlink_tree(backlinks: list[Backlink]) -> Tree[BacklinkCrumb]:
+ """Build a tree of backlinks.
+
+ Parameters:
+ backlinks: The list of backlinks.
+
+ Returns:
+ A tree of backlinks.
+ """
+ return _compact_tree(_tree(backlink.crumbs for backlink in backlinks))
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/attribute.html b/src/mkdocstrings_handlers/python/templates/material/_base/attribute.html
deleted file mode 100644
index 7effc590..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/_base/attribute.html
+++ /dev/null
@@ -1,11 +0,0 @@
-{% extends "_base/attribute.html.jinja" %}
-
-{% block logs scoped %}
- {{ super() }}
- {# TODO: Switch to a warning after some time. #}
- {{ log.info(
- "DeprecationWarning: Extending '_base/attribute.html' is deprecated, extend '_base/attribute.html.jinja' instead. " ~
- "After some time, this message will be logged as a warning, causing strict builds to fail.",
- once=True,
- ) }}
-{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/attribute.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/attribute.html.jinja
index c13bb641..65054689 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/attribute.html.jinja
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/attribute.html.jinja
@@ -39,7 +39,8 @@ Context:
role="data" if attribute.parent.kind.value == "module" else "attr",
id=html_id,
class="doc doc-heading",
- toc_label=(' '|safe if config.show_symbol_type_toc else '') + attribute.name,
+ toc_label=(' '|safe if config.show_symbol_type_toc else '') + (config.toc_label if config.toc_label and root else attribute.name),
+ skip_inventory=config.skip_local_inventory,
) %}
{% block heading scoped %}
@@ -48,12 +49,14 @@ Context:
This block renders the heading for the attribute.
-#}
{% if config.show_symbol_type_heading %}{% endif %}
- {% if config.separate_signature %}
- {{ config.heading if config.heading and root else attribute_name }}
+ {% if config.heading and root %}
+ {{ config.heading }}
+ {% elif config.separate_signature %}
+ {{ attribute_name }}
{% else %}
{%+ filter highlight(language="python", inline=True) %}
{{ attribute_name }}{% if attribute.annotation and config.show_signature_annotations %}: {{ attribute.annotation }}{% endif %}
- {% if attribute.value %} = {{ attribute.value }}{% endif %}
+ {% if config.show_attribute_values and attribute.value %} = {{ attribute.value }}{% endif %}
{% endfilter %}
{% endif %}
{% endblock heading %}
@@ -64,7 +67,7 @@ Context:
This block renders the labels for the attribute.
-#}
{% with labels = attribute.labels %}
- {% include "labels"|get_template with context %}
+ {% include "labels.html.jinja" with context %}
{% endwith %}
{% endblock labels %}
@@ -76,7 +79,7 @@ Context:
This block renders the signature for the attribute.
-#}
{% if config.separate_signature %}
- {% filter format_attribute(attribute, config.line_length, crossrefs=config.signature_crossrefs) %}
+ {% filter format_attribute(attribute, config.line_length, crossrefs=config.signature_crossrefs, show_value=config.show_attribute_values) %}
{{ attribute.name }}
{% endfilter %}
{% endif %}
@@ -90,6 +93,7 @@ Context:
id=html_id,
toc_label=(' '|safe if config.show_symbol_type_toc else '') + (config.toc_label if config.toc_label and root else attribute_name),
hidden=True,
+ skip_inventory=config.skip_local_inventory,
) %}
{% endfilter %}
{% endif %}
@@ -110,9 +114,13 @@ Context:
This block renders the docstring for the attribute.
-#}
{% with docstring_sections = attribute.docstring.parsed %}
- {% include "docstring"|get_template with context %}
+ {% include "docstring.html.jinja" with context %}
{% endwith %}
{% endblock docstring %}
+
+ {% if config.backlinks %}
+
+ {% endif %}
{% endblock contents %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/backlinks.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/backlinks.html.jinja
new file mode 100644
index 00000000..930da3e8
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/backlinks.html.jinja
@@ -0,0 +1,66 @@
+{#- Template for backlinks.
+
+This template renders backlinks.
+
+Context:
+ backlinks (Mapping[str, Iterable[str]]): The backlinks to render.
+ config (dict): The configuration options.
+ verbose_type (Mapping[str, str]): The verbose backlink types.
+ default_crumb (BacklinkCrumb): A default, empty crumb.
+-#}
+
+{% block logs scoped %}
+ {#- Logging block.
+
+ This block can be used to log debug messages, deprecation messages, warnings, etc.
+ -#}
+{% endblock logs %}
+
+{% macro render_crumb(crumb, last=false) %}
+
+ {% if crumb.url and crumb.title %}
+ {{ crumb.title | safe }}
+ {% elif crumb.title %}
+ {{ crumb.title | safe }}
+ {% endif %}
+
+{% endmacro %}
+
+{% macro render_tree(tree) %}
+
+ {% for node, child in tree | dictsort %}
+ -
+ {% for crumb in node %}
+ {{ render_crumb(crumb, last=loop.last and not child) }}
+ {% endfor %}
+ {% if child %}
+ {{ render_tree(child) }}
+ {% endif %}
+
+ {% endfor %}
+
+{% endmacro %}
+
+{% if config.backlinks %}
+
+ {% if config.backlinks == "tree" %}
+ {% for backlink_type, backlink_list in backlinks | dictsort %}
+ {{ verbose_type[backlink_type] }}:
+ {{ render_tree(backlink_list|backlink_tree) }}
+ {% endfor %}
+ {% elif config.backlinks == "flat" %}
+ {% for backlink_type, backlink_list in backlinks | dictsort %}
+ {{ verbose_type[backlink_type] }}:
+
+ {% for backlink in backlink_list | sort(attribute="crumbs") %}
+ -
+ {% for crumb in backlink.crumbs %}
+ {{ render_crumb(crumb, last=loop.last) }}
+ {% endfor %}
+
+ {% endfor %}
+
+ {% endfor %}
+ {% endif %}
+
+{% endif %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/children.html b/src/mkdocstrings_handlers/python/templates/material/_base/children.html
deleted file mode 100644
index 15fada5a..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/_base/children.html
+++ /dev/null
@@ -1,11 +0,0 @@
-{% extends "_base/children.html.jinja" %}
-
-{% block logs scoped %}
- {{ super() }}
- {# TODO: Switch to a warning after some time. #}
- {{ log.info(
- "DeprecationWarning: Extending '_base/children.html' is deprecated, extend '_base/children.html.jinja' instead. " ~
- "After some time, this message will be logged as a warning, causing strict builds to fail.",
- once=True,
- ) }}
-{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/children.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/children.html.jinja
index 40c011ed..5be9f585 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/children.html.jinja
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/children.html.jinja
@@ -19,6 +19,9 @@ Context:
{{ log.debug("Rendering children of " + obj.path) }}
{% endblock logs %}
+ {% import "language.html.jinja" as lang with context %}
+ {#- Language module providing the `t` translation method. -#}
+
{% if root_members %}
@@ -45,11 +48,11 @@ Context:
) %}
{% if attributes %}
{% if config.show_category_heading %}
- {% filter heading(heading_level, id=html_id ~ "-attributes") %}Attributes{% endfilter %}
+ {% filter heading(heading_level, id=html_id ~ "-attributes", skip_inventory=config.skip_local_inventory) %}{{ lang.t("Attributes") }}{% endfilter %}
{% endif %}
{% with heading_level = heading_level + extra_level %}
{% for attribute in attributes|order_members(config.members_order, members_list) %}
- {% if members_list is not none or (not attribute.is_imported or attribute.is_public) %}
+ {% if config.filters == "public" or members_list is not none or (not attribute.is_imported or attribute.is_public) %}
{% include attribute|get_template with context %}
{% endif %}
{% endfor %}
@@ -57,6 +60,26 @@ Context:
{% endif %}
{% endwith %}
+ {% with type_aliases = obj.type_aliases|filter_objects(
+ filters=config.filters,
+ members_list=members_list,
+ inherited_members=config.inherited_members,
+ keep_no_docstrings=config.show_if_no_docstring,
+ ) %}
+ {% if type_aliases %}
+ {% if config.show_category_heading %}
+ {% filter heading(heading_level, id=html_id ~ "-type_aliases") %}{{ lang.t("Type Aliases") }}{% endfilter %}
+ {% endif %}
+ {% with heading_level = heading_level + extra_level %}
+ {% for type_alias in type_aliases|order_members(config.members_order, members_list) %}
+ {% if config.filters == "public" or members_list is not none or (not type_alias.is_imported or type_alias.is_public) %}
+ {% include type_alias|get_template with context %}
+ {% endif %}
+ {% endfor %}
+ {% endwith %}
+ {% endif %}
+ {% endwith %}
+
{% with classes = obj.classes|filter_objects(
filters=config.filters,
members_list=members_list,
@@ -65,11 +88,11 @@ Context:
) %}
{% if classes %}
{% if config.show_category_heading %}
- {% filter heading(heading_level, id=html_id ~ "-classes") %}Classes{% endfilter %}
+ {% filter heading(heading_level, id=html_id ~ "-classes", skip_inventory=config.skip_local_inventory) %}{{ lang.t("Classes") }}{% endfilter %}
{% endif %}
{% with heading_level = heading_level + extra_level %}
{% for class in classes|order_members(config.members_order, members_list) %}
- {% if members_list is not none or (not class.is_imported or class.is_public) %}
+ {% if config.filters == "public" or members_list is not none or (not class.is_imported or class.is_public) %}
{% include class|get_template with context %}
{% endif %}
{% endfor %}
@@ -85,12 +108,12 @@ Context:
) %}
{% if functions %}
{% if config.show_category_heading %}
- {% filter heading(heading_level, id=html_id ~ "-functions") %}Functions{% endfilter %}
+ {% filter heading(heading_level, id=html_id ~ "-functions", skip_inventory=config.skip_local_inventory) %}{{ lang.t("Methods:") if obj.is_class else lang.t("Functions:") }}{% endfilter %}
{% endif %}
{% with heading_level = heading_level + extra_level %}
{% for function in functions|order_members(config.members_order, members_list) %}
{% if not (obj.kind.value == "class" and function.name == "__init__" and config.merge_init_into_class) %}
- {% if members_list is not none or (not function.is_imported or function.is_public) %}
+ {% if config.filters == "public" or members_list is not none or (not function.is_imported or function.is_public) %}
{% include function|get_template with context %}
{% endif %}
{% endif %}
@@ -108,11 +131,11 @@ Context:
) %}
{% if modules %}
{% if config.show_category_heading %}
- {% filter heading(heading_level, id=html_id ~ "-modules") %}Modules{% endfilter %}
+ {% filter heading(heading_level, id=html_id ~ "-modules", skip_inventory=config.skip_local_inventory) %}{{ lang.t("Modules") }}{% endfilter %}
{% endif %}
{% with heading_level = heading_level + extra_level %}
{% for module in modules|order_members("alphabetical", members_list) %}
- {% if members_list is not none or (not module.is_alias or module.is_public) %}
+ {% if config.filters == "public" or members_list is not none or (not module.is_alias or module.is_public) %}
{% include module|get_template with context %}
{% endif %}
{% endfor %}
@@ -137,12 +160,17 @@ Context:
{% if not (obj.is_class and child.name == "__init__" and config.merge_init_into_class) %}
- {% if members_list is not none or child.is_public %}
+ {% if config.filters == "public" or members_list is not none or (not child.is_imported or child.is_public) %}
{% if child.is_attribute %}
{% with attribute = child %}
{% include attribute|get_template with context %}
{% endwith %}
+ {% elif child.is_type_alias %}
+ {% with type_alias = child %}
+ {% include type_alias|get_template with context %}
+ {% endwith %}
+
{% elif child.is_class %}
{% with class = child %}
{% include class|get_template with context %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/class.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/class.html.jinja
index e8f89fa3..17e9e29f 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/class.html.jinja
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/class.html.jinja
@@ -17,6 +17,9 @@ Context:
{{ log.debug("Rendering " + class.path) }}
{% endblock logs %}
+{% import "language.html.jinja" as lang with context %}
+{#- Language module providing the `t` translation method. -#}
+
{% with obj = class, html_id = class.path, all_members = class.all_members %}
@@ -38,7 +41,8 @@ Context:
role="class",
id=html_id,
class="doc doc-heading",
- toc_label=(' '|safe if config.show_symbol_type_toc else '') + class.name,
+ toc_label=(' '|safe if config.show_symbol_type_toc else '') + (config.toc_label if config.toc_label and root else class.name),
+ skip_inventory=config.skip_local_inventory,
) %}
{% block heading scoped %}
@@ -47,15 +51,22 @@ Context:
This block renders the heading for the class.
-#}
{% if config.show_symbol_type_heading %}{% endif %}
- {% if config.separate_signature %}
- {{ config.heading if config.heading and root else class_name }}
+ {% if config.heading and root %}
+ {{ config.heading }}
+ {% elif config.separate_signature %}
+ {{ class_name }}
{% elif config.merge_init_into_class and "__init__" in all_members %}
{% with function = all_members["__init__"] %}
{%+ filter highlight(language="python", inline=True) %}
- {{ class_name }}{% include "signature"|get_template with context %}
+ {{ class_name -}}
+ {%- with obj = function -%}
+ {%- include "type_parameters.html.jinja" with context -%}
+ {%- endwith -%}
+ {%- include "signature.html.jinja" with context -%}
{% endfilter %}
{% endwith %}
{% else %}
+ {# TODO: Maybe render type parameters here. #}
{{ class_name }}
{% endif %}
{% endblock heading %}
@@ -66,7 +77,7 @@ Context:
This block renders the labels for the class.
-#}
{% with labels = class.labels %}
- {% include "labels"|get_template with context %}
+ {% include "labels.html.jinja" with context %}
{% endwith %}
{% endblock labels %}
@@ -78,26 +89,30 @@ Context:
This block renders the signature for the class.
Overloads of the `__init__` method are rendered if `merge_init_into_class` is enabled.
The actual `__init__` method signature is only rendered if `separate_signature` is also enabled.
+
+ If the class is generic, but the `__init__` method isn't or `merge_init_into_class` is disabled,
+ the class signature is rendered if `separate_signature` and `show_signature_type_parameters` are enabled.
+
+ If the `__init__` method or any overloads are generic, they are rendered as methods if
+ `merge_init_into_class`, `separate_signature` and `show_signature_type_parameters` are enabled.
-#}
- {% if config.merge_init_into_class %}
- {% if "__init__" in all_members %}
- {% with function = all_members["__init__"] %}
- {% if function.overloads and config.show_overloads %}
-
- {% for overload in function.overloads %}
- {% filter format_signature(overload, config.line_length, annotations=True, crossrefs=config.signature_crossrefs) %}
- {{ class.name }}
- {% endfilter %}
- {% endfor %}
-
- {% endif %}
- {% if config.separate_signature %}
- {% filter format_signature(function, config.line_length, crossrefs=config.signature_crossrefs) %}
- {{ class.name }}
- {% endfilter %}
- {% endif %}
- {% endwith %}
- {% endif %}
+ {% if config.merge_init_into_class and "__init__" in all_members %}
+ {% with function = all_members["__init__"] %}
+ {% if function.overloads and config.show_overloads %}
+
+ {% for overload in function.overloads %}
+ {% filter format_signature(overload, config.line_length, annotations=True, crossrefs=config.signature_crossrefs) %}
+ {{ class.name }}
+ {% endfilter %}
+ {% endfor %}
+
+ {% endif %}
+ {% if config.separate_signature and not (config.show_overloads and function.overloads and config.overloads_only) %}
+ {% filter format_signature(function, config.line_length, crossrefs=config.signature_crossrefs) %}
+ {{ class.name }}
+ {% endfilter %}
+ {% endif %}
+ {% endwith %}
{% endif %}
{% endblock signature %}
@@ -108,6 +123,7 @@ Context:
id=html_id,
toc_label=(' '|safe if config.show_symbol_type_toc else '') + (config.toc_label if config.toc_label and root else class.name),
hidden=True,
+ skip_inventory=config.skip_local_inventory,
) %}
{% endfilter %}
{% endif %}
@@ -130,19 +146,71 @@ Context:
{% if config.show_bases and class.bases %}
Bases: {% for expression in class.bases -%}
- {% include "expression"|get_template with context %}{% if not loop.last %}, {% endif %}
+
+ {%- with backlink_type = "subclassed-by" -%}
+ {%- include "expression.html.jinja" with context -%}
+ {%- endwith -%}
+ {% if not loop.last %}, {% endif %}
{% endfor -%}
{% endif %}
{% endblock bases %}
+ {% block inheritance_diagram scoped %}
+ {#- Inheritance diagram block.
+
+ This block renders the inheritance diagram for the class,
+ using Mermaid syntax and a bit of JavaScript to make the nodes clickable,
+ linking to the corresponding class documentation.
+ -#}
+ {% if config.show_inheritance_diagram and class.bases %}
+ {% macro edges(class) %}
+ {% for base in class.resolved_bases %}
+ {{ base.path }} --> {{ class.path }}
+ {{ edges(base) }}
+ {% endfor %}
+ {% endmacro %}
+
+
+ flowchart {{ config.inheritance_diagram_direction }}
+ {{ class.path }}[{{ class.name }}]
+ {% for base in class.mro() %}
+ {{ base.path }}[{{ base.name }}]
+ {% endfor %}
+
+ {{ edges(class) | safe }}
+
+ click {{ class.path }} href "" "{{ class.path }}"
+ {% for base in class.mro() %}
+ click {{ base.path }} href "" "{{ base.path }}"
+ {% endfor %}
+
+
+ {% endif %}
+ {% endblock inheritance_diagram %}
+
{% block docstring scoped %}
{#- Docstring block.
This block renders the docstring for the class.
-#}
{% with docstring_sections = class.docstring.parsed %}
- {% include "docstring"|get_template with context %}
+ {% include "docstring.html.jinja" with context %}
{% endwith %}
{% if config.merge_init_into_class %}
{# We don't want to merge the inherited `__init__` method docstring into the class docstring #}
@@ -151,7 +219,7 @@ Context:
{% if "__init__" in check_members and check_members["__init__"].has_docstring %}
{% with function = check_members["__init__"] %}
{% with obj = function, docstring_sections = function.docstring.parsed %}
- {% include "docstring"|get_template with context %}
+ {% include "docstring.html.jinja" with context %}
{% endwith %}
{% endwith %}
{% endif %}
@@ -159,12 +227,16 @@ Context:
{% endif %}
{% endblock docstring %}
+ {% if config.backlinks %}
+
+ {% endif %}
+
{% block summary scoped %}
{#- Summary block.
This block renders auto-summaries for classes, methods, and attributes.
-#}
- {% include "summary"|get_template with context %}
+ {% include "summary.html.jinja" with context %}
{% endblock summary %}
{% block source scoped %}
@@ -176,27 +248,15 @@ Context:
{% if config.merge_init_into_class %}
{% if "__init__" in all_members and all_members["__init__"].source %}
{% with init = all_members["__init__"] %}
-
- Source code in
- {%- if init.relative_filepath.is_absolute() -%}
- {{ init.relative_package_filepath }}
- {%- else -%}
- {{ init.relative_filepath }}
- {%- endif -%}
-
+
+ {{ lang.t("Source code in") }} {{ init|source_location }}
{{ init.source|highlight(language="python", linestart=init.lineno or 0, linenums=True) }}
{% endwith %}
{% endif %}
{% elif class.source %}
-
- Source code in
- {%- if class.relative_filepath.is_absolute() -%}
- {{ class.relative_package_filepath }}
- {%- else -%}
- {{ class.relative_filepath }}
- {%- endif -%}
-
+
+ {{ lang.t("Source code in") }} {{ class|source_location }}
{{ class.source|highlight(language="python", linestart=class.lineno or 0, linenums=True) }}
{% endif %}
@@ -210,7 +270,7 @@ Context:
-#}
{% set root = False %}
{% set heading_level = heading_level + 1 %}
- {% include "children"|get_template with context %}
+ {% include "children.html.jinja" with context %}
{% endblock children %}
{% endblock contents %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring.html
deleted file mode 100644
index 5ef9da3e..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring.html
+++ /dev/null
@@ -1,11 +0,0 @@
-{% extends "_base/docstring.html.jinja" %}
-
-{% block logs scoped %}
- {{ super() }}
- {# TODO: Switch to a warning after some time. #}
- {{ log.info(
- "DeprecationWarning: Extending '_base/docstring.html' is deprecated, extend '_base/docstring.html.jinja' instead. " ~
- "After some time, this message will be logged as a warning, causing strict builds to fail.",
- once=True,
- ) }}
-{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring.html.jinja
index 6983b2e1..a00a0249 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring.html.jinja
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring.html.jinja
@@ -24,31 +24,35 @@ Context:
{% if config.show_docstring_description and section.kind.value == "text" %}
{{ section.value|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
{% elif config.show_docstring_attributes and section.kind.value == "attributes" %}
- {% include "docstring/attributes"|get_template with context %}
+ {% include "docstring/attributes.html.jinja" with context %}
{% elif config.show_docstring_functions and section.kind.value == "functions" %}
- {% include "docstring/functions"|get_template with context %}
+ {% include "docstring/functions.html.jinja" with context %}
{% elif config.show_docstring_classes and section.kind.value == "classes" %}
- {% include "docstring/classes"|get_template with context %}
+ {% include "docstring/classes.html.jinja" with context %}
+ {% elif config.show_docstring_type_aliases and section.kind.value == "type aliases" %}
+ {% include "docstring/type_aliases.html.jinja" with context %}
{% elif config.show_docstring_modules and section.kind.value == "modules" %}
- {% include "docstring/modules"|get_template with context %}
+ {% include "docstring/modules.html.jinja" with context %}
+ {% elif config.show_docstring_type_parameters and section.kind.value == "type parameters" %}
+ {% include "docstring/type_parameters.html.jinja" with context %}
{% elif config.show_docstring_parameters and section.kind.value == "parameters" %}
- {% include "docstring/parameters"|get_template with context %}
+ {% include "docstring/parameters.html.jinja" with context %}
{% elif config.show_docstring_other_parameters and section.kind.value == "other parameters" %}
- {% include "docstring/other_parameters"|get_template with context %}
+ {% include "docstring/other_parameters.html.jinja" with context %}
{% elif config.show_docstring_raises and section.kind.value == "raises" %}
- {% include "docstring/raises"|get_template with context %}
+ {% include "docstring/raises.html.jinja" with context %}
{% elif config.show_docstring_warns and section.kind.value == "warns" %}
- {% include "docstring/warns"|get_template with context %}
+ {% include "docstring/warns.html.jinja" with context %}
{% elif config.show_docstring_yields and section.kind.value == "yields" %}
- {% include "docstring/yields"|get_template with context %}
+ {% include "docstring/yields.html.jinja" with context %}
{% elif config.show_docstring_receives and section.kind.value == "receives" %}
- {% include "docstring/receives"|get_template with context %}
+ {% include "docstring/receives.html.jinja" with context %}
{% elif config.show_docstring_returns and section.kind.value == "returns" %}
- {% include "docstring/returns"|get_template with context %}
+ {% include "docstring/returns.html.jinja" with context %}
{% elif config.show_docstring_examples and section.kind.value == "examples" %}
- {% include "docstring/examples"|get_template with context %}
+ {% include "docstring/examples.html.jinja" with context %}
{% elif config.show_docstring_description and section.kind.value == "admonition" %}
- {% include "docstring/admonition"|get_template with context %}
+ {% include "docstring/admonition.html.jinja" with context %}
{% endif %}
{% endfor %}
{% endwith %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/admonition.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/admonition.html
deleted file mode 100644
index a8a75542..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/admonition.html
+++ /dev/null
@@ -1,11 +0,0 @@
-{% extends "_base/docstring/admonition.html.jinja" %}
-
-{% block logs scoped %}
- {{ super() }}
- {# TODO: Switch to a warning after some time. #}
- {{ log.info(
- "DeprecationWarning: Extending '_base/docstring/admonition.html' is deprecated, extend '_base/docstring/admonition.html.jinja' instead. " ~
- "After some time, this message will be logged as a warning, causing strict builds to fail.",
- once=True,
- ) }}
-{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html
deleted file mode 100644
index cd4b05be..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html
+++ /dev/null
@@ -1,11 +0,0 @@
-{% extends "_base/docstring/attributes.html.jinja" %}
-
-{% block logs scoped %}
- {{ super() }}
- {# TODO: Switch to a warning after some time. #}
- {{ log.info(
- "DeprecationWarning: Extending '_base/docstring/attributes.html' is deprecated, extend '_base/docstring/attributes.html.jinja' instead. " ~
- "After some time, this message will be logged as a warning, causing strict builds to fail.",
- once=True,
- ) }}
-{% endblock logs %}
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 13bd15b2..e336e46e 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
@@ -15,7 +15,7 @@ Context:
{{ log.debug("Rendering attributes section") }}
{% endblock logs %}
-{% import "language"|get_template as lang with context %}
+{% import "language.html.jinja" as lang with context %}
{#- Language module providing the `t` translation method. -#}
{% if config.docstring_section_style == "table" %}
@@ -37,13 +37,13 @@ Context:
{% if attribute.annotation %}
{% with expression = attribute.annotation %}
- {% include "expression"|get_template with context %}
+ {% include "expression.html.jinja" with context %}
{% endwith %}
{% endif %}
- {{ attribute.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
+ {{ attribute.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook|default(AutorefsHook(obj[attribute.name], config))) }}
@@ -61,12 +61,12 @@ Context:
{{ attribute.name }}
{% if attribute.annotation %}
{% with expression = attribute.annotation %}
- ({% include "expression"|get_template with context %})
+ ({% include "expression.html.jinja" with context %})
{% endwith %}
{% endif %}
–
- {{ attribute.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
+ {{ attribute.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook|default(AutorefsHook(obj[attribute.name], config))) }}
{% endfor %}
@@ -88,14 +88,14 @@ Context:
{{ attribute.name }}
- {{ attribute.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
+ {{ attribute.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook|default(AutorefsHook(obj[attribute.name], config))) }}
{% if attribute.annotation %}
- TYPE:
+ {{ lang.t("TYPE:") }}
{% with expression = attribute.annotation %}
- {% include "expression"|get_template with context %}
+ {% include "expression.html.jinja" with context %}
{% endwith %}
{% endif %}
@@ -106,4 +106,4 @@ Context:
{% endblock spacy_style %}
-{% endif %}
\ No newline at end of file
+{% endif %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html
deleted file mode 100644
index 78b47e2d..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html
+++ /dev/null
@@ -1,11 +0,0 @@
-{% extends "_base/docstring/classes.html.jinja" %}
-
-{% block logs scoped %}
- {{ super() }}
- {# TODO: Switch to a warning after some time. #}
- {{ log.info(
- "DeprecationWarning: Extending '_base/docstring/classes.html' is deprecated, extend '_base/docstring/classes.html.jinja' instead. " ~
- "After some time, this message will be logged as a warning, causing strict builds to fail.",
- once=True,
- ) }}
-{% endblock logs %}
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 73f39329..7dff6c9c 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
@@ -15,7 +15,7 @@ Context:
{{ log.debug("Rendering classes section") }}
{% endblock logs %}
-{% import "language"|get_template as lang with context %}
+{% import "language.html.jinja" as lang with context %}
{#- Language module providing the `t` translation method. -#}
{% if config.docstring_section_style == "table" %}
@@ -35,7 +35,7 @@ Context:
{{ class.name }}
- {{ class.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
+ {{ class.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook|default(AutorefsHook(obj[class.name], config))) }}
@@ -53,7 +53,7 @@ Context:
{{ class.name }}
–
- {{ class.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
+ {{ class.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook|default(AutorefsHook(obj[class.name], config))) }}
{% endfor %}
@@ -75,7 +75,7 @@ Context:
{{ class.name }}
- {{ class.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
+ {{ class.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook|default(AutorefsHook(obj[class.name], config))) }}
@@ -83,4 +83,4 @@ Context:
{% endblock spacy_style %}
-{% endif %}
\ No newline at end of file
+{% endif %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/examples.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/examples.html
deleted file mode 100644
index 37674811..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/examples.html
+++ /dev/null
@@ -1,11 +0,0 @@
-{% extends "_base/docstring/examples.html.jinja" %}
-
-{% block logs scoped %}
- {{ super() }}
- {# TODO: Switch to a warning after some time. #}
- {{ log.info(
- "DeprecationWarning: Extending '_base/docstring/examples.html' is deprecated, extend '_base/docstring/examples.html.jinja' instead. " ~
- "After some time, this message will be logged as a warning, causing strict builds to fail.",
- once=True,
- ) }}
-{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/examples.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/examples.html.jinja
index 0caacc15..32360f7d 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/examples.html.jinja
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/examples.html.jinja
@@ -15,7 +15,7 @@ Context:
{{ log.debug("Rendering examples section") }}
{% endblock logs %}
-{% import "language"|get_template as lang with context %}
+{% import "language.html.jinja" as lang with context %}
{#- Language module providing the `t` translation method. -#}
{{ section.title or lang.t("Examples:") }}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html
deleted file mode 100644
index a61c48fb..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html
+++ /dev/null
@@ -1,11 +0,0 @@
-{% extends "_base/docstring/functions.html.jinja" %}
-
-{% block logs scoped %}
- {{ super() }}
- {# TODO: Switch to a warning after some time. #}
- {{ log.info(
- "DeprecationWarning: Extending '_base/docstring/functions.html' is deprecated, extend '_base/docstring/functions.html.jinja' instead. " ~
- "After some time, this message will be logged as a warning, causing strict builds to fail.",
- once=True,
- ) }}
-{% endblock logs %}
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 28bb0cae..ad9e3b25 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
@@ -15,7 +15,7 @@ Context:
{{ log.debug("Rendering functions section") }}
{% endblock logs %}
-{% import "language"|get_template as lang with context %}
+{% import "language.html.jinja" as lang with context %}
{#- Language module providing the `t` translation method. -#}
{% if config.docstring_section_style == "table" %}
@@ -36,7 +36,7 @@ Context:
{{ function.name }}
- {{ function.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
+ {{ function.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook|default(AutorefsHook(obj[function.name], config))) }}
@@ -56,7 +56,7 @@ Context:
{{ function.name }}
–
- {{ function.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
+ {{ function.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook|default(AutorefsHook(obj[function.name], config))) }}
{% endif %}
@@ -80,7 +80,7 @@ Context:
{{ function.name }}
- {{ function.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
+ {{ function.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook|default(AutorefsHook(obj[function.name], config))) }}
@@ -89,4 +89,4 @@ Context:
{% endblock spacy_style %}
-{% endif %}
\ No newline at end of file
+{% endif %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html
deleted file mode 100644
index d0b303b4..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html
+++ /dev/null
@@ -1,11 +0,0 @@
-{% extends "_base/docstring/modules.html.jinja" %}
-
-{% block logs scoped %}
- {{ super() }}
- {# TODO: Switch to a warning after some time. #}
- {{ log.info(
- "DeprecationWarning: Extending '_base/docstring/modules.html' is deprecated, extend '_base/docstring/modules.html.jinja' instead. " ~
- "After some time, this message will be logged as a warning, causing strict builds to fail.",
- once=True,
- ) }}
-{% endblock logs %}
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 d55f854e..d366d0db 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
@@ -15,7 +15,7 @@ Context:
{{ log.debug("Rendering modules section") }}
{% endblock logs %}
-{% import "language"|get_template as lang with context %}
+{% import "language.html.jinja" as lang with context %}
{#- Language module providing the `t` translation method. -#}
{% if config.docstring_section_style == "table" %}
@@ -35,7 +35,7 @@ Context:
{{ module.name }}
- {{ module.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
+ {{ module.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook|default(AutorefsHook(obj[module.name], config))) }}
@@ -53,7 +53,7 @@ Context:
{{ module.name }}
–
- {{ module.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
+ {{ module.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook|default(AutorefsHook(obj[module.name], config))) }}
{% endfor %}
@@ -75,7 +75,7 @@ Context:
{{ module.name }}
- {{ module.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
+ {{ module.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook|default(AutorefsHook(obj[module.name], config))) }}
@@ -83,4 +83,4 @@ Context:
{% endblock spacy_style %}
-{% endif %}
\ No newline at end of file
+{% endif %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/other_parameters.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/other_parameters.html
deleted file mode 100644
index eae60aa7..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/other_parameters.html
+++ /dev/null
@@ -1,11 +0,0 @@
-{% extends "_base/docstring/other_parameters.html.jinja" %}
-
-{% block logs scoped %}
- {{ super() }}
- {# TODO: Switch to a warning after some time. #}
- {{ log.info(
- "DeprecationWarning: Extending '_base/docstring/other_parameters.html' is deprecated, extend '_base/docstring/other_parameters.html.jinja' instead. " ~
- "After some time, this message will be logged as a warning, causing strict builds to fail.",
- once=True,
- ) }}
-{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/other_parameters.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/other_parameters.html.jinja
index 1689dcb8..5e0a75f5 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/other_parameters.html.jinja
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/other_parameters.html.jinja
@@ -15,7 +15,7 @@ Context:
{{ log.debug("Rendering other parameters section") }}
{% endblock logs %}
-{% import "language"|get_template as lang with context %}
+{% import "language.html.jinja" as lang with context %}
{#- Language module providing the `t` translation method. -#}
{% if config.docstring_section_style == "table" %}
@@ -36,8 +36,8 @@ Context:
{{ parameter.name }}
{% if parameter.annotation %}
- {% with expression = parameter.annotation %}
- {% include "expression"|get_template with context %}
+ {% with expression = parameter.annotation, backlink_type = "used-by" %}
+ {% include "expression.html.jinja" with context %}
{% endwith %}
{% endif %}
@@ -60,8 +60,8 @@ Context:
{{ parameter.name }}
{% if parameter.annotation %}
- {% with expression = parameter.annotation %}
- ({% include "expression"|get_template with context %})
+ {% with expression = parameter.annotation, backlink_type = "used-by" %}
+ ({% include "expression.html.jinja" with context %})
{% endwith %}
{% endif %}
–
@@ -94,8 +94,8 @@ Context:
{% if parameter.annotation %}
{{ lang.t("TYPE:") }}
- {% with expression = parameter.annotation %}
- {% include "expression"|get_template with context %}
+ {% with expression = parameter.annotation, backlink_type = "used-by" %}
+ {% include "expression.html.jinja" with context %}
{% endwith %}
{% endif %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html
deleted file mode 100644
index f5745464..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html
+++ /dev/null
@@ -1,11 +0,0 @@
-{% extends "_base/docstring/parameters.html.jinja" %}
-
-{% block logs scoped %}
- {{ super() }}
- {# TODO: Switch to a warning after some time. #}
- {{ log.info(
- "DeprecationWarning: Extending '_base/docstring/parameters.html' is deprecated, extend '_base/docstring/parameters.html.jinja' instead. " ~
- "After some time, this message will be logged as a warning, causing strict builds to fail.",
- once=True,
- ) }}
-{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html.jinja
index d4e9acb8..a67113fa 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html.jinja
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html.jinja
@@ -15,7 +15,7 @@ Context:
{{ log.debug("Rendering parameters section") }}
{% endblock logs %}
-{% import "language"|get_template as lang with context %}
+{% import "language.html.jinja" as lang with context %}
{#- Language module providing the `t` translation method. -#}
{% if config.docstring_section_style == "table" %}
@@ -42,6 +42,7 @@ Context:
id=html_id ~ "(" ~ parameter.name ~ ")",
class="doc doc-heading doc-heading-parameter",
toc_label=(' '|safe if config.show_symbol_type_toc else '') + parameter.name,
+ skip_inventory=config.skip_local_inventory,
) %}
{{ parameter.name }}
{% endfilter %}
@@ -51,8 +52,8 @@ Context:
{% if parameter.annotation %}
- {% with expression = parameter.annotation %}
- {% include "expression"|get_template with context %}
+ {% with expression = parameter.annotation, backlink_type = "used-by" %}
+ {% include "expression.html.jinja" with context %}
{% endwith %}
{% endif %}
@@ -63,8 +64,8 @@ Context:
{% if parameter.default %}
- {% with expression = parameter.default %}
- {% include "expression"|get_template with context %}
+ {% with expression = parameter.default, backlink_type = "used-by" %}
+ {% include "expression.html.jinja" with context %}
{% endwith %}
{% else %}
{{ lang.t("required") }}
@@ -89,6 +90,7 @@ Context:
id=html_id ~ "(" ~ parameter.name ~ ")",
class="doc doc-heading doc-heading-parameter",
toc_label=(' '|safe if config.show_symbol_type_toc else '') + parameter.name,
+ skip_inventory=config.skip_local_inventory,
) %}
{{ parameter.name }}
{% endfilter %}
@@ -96,11 +98,11 @@ Context:
{{ parameter.name }}
{% endif %}
{% if parameter.annotation %}
- {% with expression = parameter.annotation %}
- ({% include "expression"|get_template with context %}
+ {% with expression = parameter.annotation, backlink_type = "used-by" %}
+ ({% include "expression.html.jinja" with context %}
{%- if parameter.default %}, {{ lang.t("default:") }}
- {% with expression = parameter.default %}
- {% include "expression"|get_template with context %}
+ {% with expression = parameter.default, backlink_type = "used-by" %}
+ {% include "expression.html.jinja" with context %}
{% endwith %}
{% endif %})
{% endwith %}
@@ -134,6 +136,7 @@ Context:
id=html_id ~ "(" ~ parameter.name ~ ")",
class="doc doc-heading doc-heading-parameter",
toc_label=(' '|safe if config.show_symbol_type_toc else '') + parameter.name,
+ skip_inventory=config.skip_local_inventory,
) %}
{{ parameter.name }}
{% endfilter %}
@@ -149,16 +152,16 @@ Context:
{% if parameter.annotation %}
{{ lang.t("TYPE:") }}
- {% with expression = parameter.annotation %}
- {% include "expression"|get_template with context %}
+ {% with expression = parameter.annotation, backlink_type = "used-by" %}
+ {% include "expression.html.jinja" with context %}
{% endwith %}
{% endif %}
{% if parameter.default %}
{{ lang.t("DEFAULT:") }}
- {% with expression = parameter.default %}
- {% include "expression"|get_template with context %}
+ {% with expression = parameter.default, backlink_type = "used-by" %}
+ {% include "expression.html.jinja" with context %}
{% endwith %}
{% endif %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html
deleted file mode 100644
index 361b9732..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html
+++ /dev/null
@@ -1,11 +0,0 @@
-{% extends "_base/docstring/raises.html.jinja" %}
-
-{% block logs scoped %}
- {{ super() }}
- {# TODO: Switch to a warning after some time. #}
- {{ log.info(
- "DeprecationWarning: Extending '_base/docstring/raises.html' is deprecated, extend '_base/docstring/raises.html.jinja' instead. " ~
- "After some time, this message will be logged as a warning, causing strict builds to fail.",
- once=True,
- ) }}
-{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html.jinja
index d734e94a..7d548035 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html.jinja
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html.jinja
@@ -15,7 +15,7 @@ Context:
{{ log.debug("Rendering raises section") }}
{% endblock logs %}
-{% import "language"|get_template as lang with context %}
+{% import "language.html.jinja" as lang with context %}
{#- Language module providing the `t` translation method. -#}
{% if config.docstring_section_style == "table" %}
@@ -34,8 +34,8 @@ Context:
{% if raises.annotation %}
- {% with expression = raises.annotation %}
- {% include "expression"|get_template with context %}
+ {% with expression = raises.annotation, backlink_type = "raised-by" %}
+ {% include "expression.html.jinja" with context %}
{% endwith %}
{% endif %}
@@ -57,8 +57,8 @@ Context:
{% for raises in section.value %}
{% if raises.annotation %}
- {% with expression = raises.annotation %}
- {% include "expression"|get_template with context %}
+ {% with expression = raises.annotation, backlink_type = "raised-by" %}
+ {% include "expression.html.jinja" with context %}
{% endwith %}
–
{% endif %}
@@ -84,8 +84,8 @@ Context:
- {% with expression = raises.annotation %}
- {% include "expression"|get_template with context %}
+ {% with expression = raises.annotation, backlink_type = "raised-by" %}
+ {% include "expression.html.jinja" with context %}
{% endwith %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html
deleted file mode 100644
index e5a115c1..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html
+++ /dev/null
@@ -1,11 +0,0 @@
-{% extends "_base/docstring/receives.html.jinja" %}
-
-{% block logs scoped %}
- {{ super() }}
- {# TODO: Switch to a warning after some time. #}
- {{ log.info(
- "DeprecationWarning: Extending '_base/docstring/receives.html' is deprecated, extend '_base/docstring/receives.html.jinja' instead. " ~
- "After some time, this message will be logged as a warning, causing strict builds to fail.",
- once=True,
- ) }}
-{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html.jinja
index 3b618c66..6830d434 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html.jinja
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html.jinja
@@ -15,7 +15,7 @@ Context:
{{ log.debug("Rendering receives section") }}
{% endblock logs %}
-{% import "language"|get_template as lang with context %}
+{% import "language.html.jinja" as lang with context %}
{#- Language module providing the `t` translation method. -#}
{% if config.docstring_section_style == "table" %}
@@ -37,8 +37,8 @@ Context:
{% if name_column %}{% if receives.name %}{{ receives.name }}{% endif %} {% endif %}
{% if receives.annotation %}
- {% with expression = receives.annotation %}
- {% include "expression"|get_template with context %}
+ {% with expression = receives.annotation, backlink_type = "received-by" %}
+ {% include "expression.html.jinja" with context %}
{% endwith %}
{% endif %}
@@ -61,9 +61,9 @@ Context:
{% if receives.name %}{{ receives.name }}{% endif %}
{% if receives.annotation %}
- {% with expression = receives.annotation %}
+ {% with expression = receives.annotation, backlink_type = "received-by" %}
{% if receives.name %} ({% endif %}
- {% include "expression"|get_template with context %}
+ {% include "expression.html.jinja" with context %}
{% if receives.name %}){% endif %}
{% endwith %}
{% endif %}
@@ -93,8 +93,8 @@ Context:
{{ receives.name }}
{% elif receives.annotation %}
- {% with expression = receives.annotation %}
- {% include "expression"|get_template with context %}
+ {% with expression = receives.annotation, backlink_type = "received-by" %}
+ {% include "expression.html.jinja" with context %}
{% endwith %}
{% endif %}
@@ -107,8 +107,8 @@ Context:
{{ lang.t("TYPE:") }}
- {% with expression = receives.annotation %}
- {% include "expression"|get_template with context %}
+ {% with expression = receives.annotation, backlink_type = "received-by" %}
+ {% include "expression.html.jinja" with context %}
{% endwith %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html
deleted file mode 100644
index 0e7807ac..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html
+++ /dev/null
@@ -1,11 +0,0 @@
-{% extends "_base/docstring/returns.html.jinja" %}
-
-{% block logs scoped %}
- {{ super() }}
- {# TODO: Switch to a warning after some time. #}
- {{ log.info(
- "DeprecationWarning: Extending '_base/docstring/returns.html' is deprecated, extend '_base/docstring/returns.html.jinja' instead. " ~
- "After some time, this message will be logged as a warning, causing strict builds to fail.",
- once=True,
- ) }}
-{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html.jinja
index af61fce5..da693da7 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html.jinja
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html.jinja
@@ -15,7 +15,7 @@ Context:
{{ log.debug("Rendering returns section") }}
{% endblock logs %}
-{% import "language"|get_template as lang with context %}
+{% import "language.html.jinja" as lang with context %}
{#- Language module providing the `t` translation method. -#}
{% if config.docstring_section_style == "table" %}
@@ -37,8 +37,8 @@ Context:
{% if name_column %}{% if returns.name %}{{ returns.name }}{% endif %} {% endif %}
{% if returns.annotation %}
- {% with expression = returns.annotation %}
- {% include "expression"|get_template with context %}
+ {% with expression = returns.annotation, backlink_type = "returned-by" %}
+ {% include "expression.html.jinja" with context %}
{% endwith %}
{% endif %}
@@ -61,9 +61,9 @@ Context:
{% if returns.name %}{{ returns.name }}{% endif %}
{% if returns.annotation %}
- {% with expression = returns.annotation %}
+ {% with expression = returns.annotation, backlink_type = "returned-by" %}
{% if returns.name %} ({% endif %}
- {% include "expression"|get_template with context %}
+ {% include "expression.html.jinja" with context %}
{% if returns.name %}){% endif %}
{% endwith %}
{% endif %}
@@ -93,8 +93,8 @@ Context:
{{ returns.name }}
{% elif returns.annotation %}
- {% with expression = returns.annotation %}
- {% include "expression"|get_template with context %}
+ {% with expression = returns.annotation, backlink_type = "returned-by" %}
+ {% include "expression.html.jinja" with context %}
{% endwith %}
{% endif %}
@@ -107,8 +107,8 @@ Context:
{{ lang.t("TYPE:") }}
- {% with expression = returns.annotation %}
- {% include "expression"|get_template with context %}
+ {% with expression = returns.annotation, backlink_type = "returned-by" %}
+ {% include "expression.html.jinja" with context %}
{% endwith %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/type_aliases.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/type_aliases.html.jinja
new file mode 100644
index 00000000..3ccd947c
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/type_aliases.html.jinja
@@ -0,0 +1,86 @@
+{#- Template for "Type Aliases" sections in docstrings.
+
+This template renders a list of documented type aliases in the format
+specified with the [`docstring_section_style`][] configuration option.
+
+Context:
+ section (griffe.DocstringSectionTypeAliases): The section to render.
+-#}
+
+{% block logs scoped %}
+ {#- Logging block.
+
+ This block can be used to log debug messages, deprecation messages, warnings, etc.
+ -#}
+ {{ log.debug("Rendering type aliases section") }}
+{% endblock logs %}
+
+{% import "language.html.jinja" as lang with context %}
+{#- Language module providing the `t` translation method. -#}
+
+{% if config.docstring_section_style == "table" %}
+ {% block table_style scoped %}
+ {#- Block for the `table` section style. -#}
+ {{ section.title or lang.t("Type Aliases:") }}
+
+
+
+ {{ lang.t("Name") }}
+ {{ lang.t("Description") }}
+
+
+
+ {% for type_alias in section.value %}
+
+ {{ type_alias.name }}
+
+
+ {{ type_alias.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook|default(AutorefsHook(obj[type_alias.name], config))) }}
+
+
+
+ {% endfor %}
+
+
+ {% endblock table_style %}
+{% elif config.docstring_section_style == "list" %}
+ {% block list_style scoped %}
+ {#- Block for the `list` section style. -#}
+ {{ section.title or lang.t("Type Aliases:") }}
+
+ {% for type_alias in section.value %}
+ -
+
{{ type_alias.name }}
+ –
+
+ {{ type_alias.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook|default(AutorefsHook(obj[type_alias.name], config))) }}
+
+
+ {% endfor %}
+
+ {% endblock list_style %}
+{% elif config.docstring_section_style == "spacy" %}
+ {% block spacy_style scoped %}
+ {#- Block for the `spacy` section style. -#}
+
+
+
+ {{ (section.title or lang.t("TYPE ALIAS")).rstrip(":").upper() }}
+ {{ lang.t("DESCRIPTION") }}
+
+
+
+ {% for type_alias in section.value %}
+
+ {{ type_alias.name }}
+
+
+ {{ type_alias.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook|default(AutorefsHook(obj[type_alias.name], config))) }}
+
+
+
+ {% endfor %}
+
+
+ {% endblock spacy_style %}
+{% endif %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/type_parameters.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/type_parameters.html.jinja
new file mode 100644
index 00000000..6fe8bb4e
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/type_parameters.html.jinja
@@ -0,0 +1,208 @@
+{#- Template for "Parameters" sections in docstrings.
+
+This template renders a list of documented type parameters in the format
+specified with the [`docstring_section_style`][] configuration option.
+
+Context:
+ section (griffe.DocstringSectionTypeParameters): The section to render.
+-#}
+
+{% block logs scoped %}
+ {#- Logging block.
+
+ This block can be used to log debug messages, deprecation messages, warnings, etc.
+ -#}
+ {{ log.debug("Rendering type parameters section") }}
+{% endblock logs %}
+
+{% import "language.html.jinja" as lang with context %}
+{#- Language module providing the `t` translation method. -#}
+
+{% if config.docstring_section_style == "table" %}
+ {% block table_style scoped %}
+ {#- Block for the `table` section style. -#}
+
+
+ {{ section.title or lang.t(("Class " if obj.is_class else "Init " if obj.is_init_method else "") ~ "Type Parameters:") }}
+
+
+
+
+
+ {{ lang.t("Name") }}
+ {{ lang.t("Bound or Constraints") }}
+ {{ lang.t("Description") }}
+ {{ lang.t("Default") }}
+
+
+
+ {% for type_parameter in section.value %}
+
+
+ {% if config.type_parameter_headings %}
+ {% filter heading(
+ heading_level + 1,
+ role="typeparam",
+ id=obj.path ~ "[" ~ type_parameter.name ~ "]",
+ class="doc doc-heading doc-heading-type_parameter",
+ toc_label=(' '|safe if config.show_symbol_type_toc else '') + type_parameter.name,
+ ) %}
+ {{ type_parameter.name }}
+ {% endfilter %}
+ {% else %}
+ {{ type_parameter.name }}
+ {% endif %}
+
+
+ {% if type_parameter.annotation %}
+ {% with expression = type_parameter.annotation %}
+ {% include "expression.html.jinja" with context %}
+ {% endwith %}
+ {% endif %}
+
+
+
+ {{ type_parameter.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
+
+
+
+ {% if type_parameter.default %}
+ {% with expression = type_parameter.default %}
+ {% include "expression.html.jinja" with context %}
+ {% endwith %}
+ {% else %}
+ {{ lang.t("required") }}
+ {% endif %}
+
+
+ {% endfor %}
+
+
+ {% endblock table_style %}
+{% elif config.docstring_section_style == "list" %}
+ {% block list_style scoped %}
+ {#- Block for the `list` section style. -#}
+
+
+ {{ section.title or lang.t(("Class " if obj.is_class else "Init " if obj.is_init_method else "") ~ "Type Parameters:") }}
+
+
+
+ {% for type_parameter in section.value %}
+ -
+ {% if config.type_parameter_headings %}
+ {% filter heading(
+ heading_level + 1,
+ role="typeparam",
+ id=obj.path ~ "[" ~ type_parameter.name ~ "]",
+ class="doc doc-heading doc-heading-type_parameter",
+ toc_label=('
'|safe if config.show_symbol_type_toc else '') + type_parameter.name,
+ ) %}
+ {{ type_parameter.name }}
+ {% endfilter %}
+ {% else %}
+ {{ type_parameter.name }}
+ {% endif %}
+ {%- if type_parameter.bound or type_parameter.constraints or type_parameter.default -%}
+ (
+ {%- endif -%}
+ {%- if type_parameter.bound -%}
+ {%- with expression = type_parameter.bound -%}
+ {% include "expression.html.jinja" with context %}
+ {%- endwith -%}
+ {%- if type_parameter.default %}, {% endif -%}
+ {%- elif type_parameter.constraints -%}
+ {%- for expression in type_parameter.constraints -%}
+ {% include "expression.html.jinja" with context %}
+ {%- if not loop.last %}, {% endif -%}
+ {%- endfor -%}
+ {%- if type_parameter.default %}, {% endif -%}
+ {%- endif -%}
+ {%- if type_parameter.default -%}
+ {{ lang.t("default:") }}
+ {% with expression = type_parameter.default %}
+ {% include "expression.html.jinja" with context %}
+ {%- endwith -%}
+ {%- endif -%}
+ {%- if type_parameter.constraints or type_parameter.default -%}
+ )
+ {% endif -%}
+ –
+
+ {{ type_parameter.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
+
+
+ {% endfor %}
+
+ {% endblock list_style %}
+{% elif config.docstring_section_style == "spacy" %}
+ {% block spacy_style scoped %}
+ {#- Block for the `spacy` section style. -#}
+
+
+
+
+
+ {{ (section.title or lang.t(("CLASS " if obj.is_class else "INIT " if obj.is_init_method else "") ~ "TYPE PARAMETER")).rstrip(":").upper() }}
+
+
+ {{ lang.t("DESCRIPTION") }}
+
+
+
+ {% for type_parameter in section.value %}
+
+
+ {% if config.type_parameter_headings %}
+ {% filter heading(
+ heading_level + 1,
+ role="typeparam",
+ id=obj.path ~ "[" ~ type_parameter.name ~ "]",
+ class="doc doc-heading doc-heading-type_parameter",
+ toc_label=(' '|safe if config.show_symbol_type_toc else '') + type_parameter.name,
+ ) %}
+ {{ type_parameter.name }}
+ {% endfilter %}
+ {% else %}
+ {{ type_parameter.name }}
+ {% endif %}
+
+
+
+ {{ type_parameter.description|convert_markdown(heading_level, html_id, autoref_hook=autoref_hook) }}
+
+
+ {% if type_parameter.constraints %}
+
+ {{ lang.t("CONSTRAINTS:") }}
+ {% for constraint in type_parameter.constraints -%}
+ {%- with expression = constraint -%}
+ {% include "expression.html.jinja" with context %}
+ {%- endwith -%}
+ {%- if not loop.last %}, {% endif -%}
+ {% endfor %}
+
+ {% elif type_parameter.bound %}
+
+ {{ lang.t("BOUND:") }}
+ {% with expression = type_parameter.bound %}
+ {% include "expression.html.jinja" with context %}
+ {% endwith %}
+
+ {% endif %}
+ {% if type_parameter.default %}
+
+ {{ lang.t("DEFAULT:") }}
+ {% with expression = type_parameter.default %}
+ {% include "expression.html.jinja" with context %}
+ {% endwith %}
+
+ {% endif %}
+
+
+
+ {% endfor %}
+
+
+ {% endblock spacy_style %}
+{% endif %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html
deleted file mode 100644
index b7b937a9..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html
+++ /dev/null
@@ -1,11 +0,0 @@
-{% extends "_base/docstring/warns.html.jinja" %}
-
-{% block logs scoped %}
- {{ super() }}
- {# TODO: Switch to a warning after some time. #}
- {{ log.info(
- "DeprecationWarning: Extending '_base/docstring/warns.html' is deprecated, extend '_base/docstring/warns.html.jinja' instead. " ~
- "After some time, this message will be logged as a warning, causing strict builds to fail.",
- once=True,
- ) }}
-{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html.jinja
index 782c0cdf..6f7e69de 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html.jinja
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html.jinja
@@ -15,7 +15,7 @@ Context:
{{ log.debug("Rendering warns section") }}
{% endblock logs %}
-{% import "language"|get_template as lang with context %}
+{% import "language.html.jinja" as lang with context %}
{#- Language module providing the `t` translation method. -#}
{% if config.docstring_section_style == "table" %}
@@ -34,8 +34,8 @@ Context:
{% if warns.annotation %}
- {% with expression = warns.annotation %}
- {% include "expression"|get_template with context %}
+ {% with expression = warns.annotation, backlink_type = "emitted-by" %}
+ {% include "expression.html.jinja" with context %}
{% endwith %}
{% endif %}
@@ -57,8 +57,8 @@ Context:
{% for warns in section.value %}
{% if warns.annotation %}
- {% with expression = warns.annotation %}
- {% include "expression"|get_template with context %}
+ {% with expression = warns.annotation, backlink_type = "emitted-by" %}
+ {% include "expression.html.jinja" with context %}
{% endwith %}
–
{% endif %}
@@ -84,8 +84,8 @@ Context:
- {% with expression = warns.annotation %}
- {% include "expression"|get_template with context %}
+ {% with expression = warns.annotation, backlink_type = "emitted-by" %}
+ {% include "expression.html.jinja" with context %}
{% endwith %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html
deleted file mode 100644
index ecd6f513..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html
+++ /dev/null
@@ -1,11 +0,0 @@
-{% extends "_base/docstring/yields.html.jinja" %}
-
-{% block logs scoped %}
- {{ super() }}
- {# TODO: Switch to a warning after some time. #}
- {{ log.info(
- "DeprecationWarning: Extending '_base/docstring/yields.html' is deprecated, extend '_base/docstring/yields.html.jinja' instead. " ~
- "After some time, this message will be logged as a warning, causing strict builds to fail.",
- once=True,
- ) }}
-{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html.jinja
index 6d3cfa14..69e5ea6d 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html.jinja
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html.jinja
@@ -15,7 +15,7 @@ Context:
{{ log.debug("Rendering yields section") }}
{% endblock logs %}
-{% import "language"|get_template as lang with context %}
+{% import "language.html.jinja" as lang with context %}
{#- Language module providing the `t` translation method. -#}
{% if config.docstring_section_style == "table" %}
@@ -37,8 +37,8 @@ Context:
{% if name_column %}{% if yields.name %}{{ yields.name }}{% endif %} {% endif %}
{% if yields.annotation %}
- {% with expression = yields.annotation %}
- {% include "expression"|get_template with context %}
+ {% with expression = yields.annotation, backlink_type = "yielded-by" %}
+ {% include "expression.html.jinja" with context %}
{% endwith %}
{% endif %}
@@ -61,9 +61,9 @@ Context:
{% if yields.name %}{{ yields.name }}{% endif %}
{% if yields.annotation %}
- {% with expression = yields.annotation %}
+ {% with expression = yields.annotation, backlink_type = "yielded-by" %}
{% if yields.name %} ({% endif %}
- {% include "expression"|get_template with context %}
+ {% include "expression.html.jinja" with context %}
{% if yields.name %}){% endif %}
{% endwith %}
{% endif %}
@@ -93,8 +93,8 @@ Context:
{{ yields.name }}
{% elif yields.annotation %}
- {% with expression = yields.annotation %}
- {% include "expression"|get_template with context %}
+ {% with expression = yields.annotation, backlink_type = "yielded-by" %}
+ {% include "expression.html.jinja" with context %}
{% endwith %}
{% endif %}
@@ -107,8 +107,8 @@ Context:
{{ lang.t("TYPE:") }}:
- {% with expression = yields.annotation %}
- {% include "expression"|get_template with context %}
+ {% with expression = yields.annotation, backlink_type = "yielded-by" %}
+ {% include "expression.html.jinja" with context %}
{% endwith %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/expression.html b/src/mkdocstrings_handlers/python/templates/material/_base/expression.html
deleted file mode 100644
index 556b3e2b..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/_base/expression.html
+++ /dev/null
@@ -1,11 +0,0 @@
-{% extends "_base/expression.html.jinja" %}
-
-{% block logs scoped %}
- {{ super() }}
- {# TODO: Switch to a warning after some time. #}
- {{ log.info(
- "DeprecationWarning: Extending '_base/expression.html' is deprecated, extend '_base/expression.html.jinja' instead. " ~
- "After some time, this message will be logged as a warning, causing strict builds to fail.",
- once=True,
- ) }}
-{% endblock logs %}
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 781d46c7..60585a5a 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/expression.html.jinja
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/expression.html.jinja
@@ -2,6 +2,10 @@
This template renders a Griffe expression,
which is a tree-like structure representing a Python expression.
+
+Context:
+ expression (griffe.Expr): The expression to render.
+ config (dict): The configuration options.
-#}
{% block logs scoped %}
@@ -11,11 +15,30 @@ which is a tree-like structure representing a Python expression.
-#}
{% endblock logs %}
-{%- macro crossref(name, annotation_path) -%}
+{%- macro crossref(name, annotation_path, backlink_type="") -%}
{#- Output a cross-reference.
This macro outputs a cross-reference to the given name.
+ Parameters:
+ name (griffe.ExprName): The name to cross-reference.
+ annotation_path (str): Either "brief", "source", or "full".
+
+ Returns:
+ Either a cross-reference (using an autoref element) or the name itself.
+ -#}
+ {%- if name.classname == "ExprName" and name.is_type_parameter -%}
+ {{ type_param_crossref(name) }}
+ {%- else -%}
+ {{ object_crossref(name, annotation_path) }}
+ {%- endif -%}
+{%- endmacro -%}
+
+{%- macro object_crossref(name, annotation_path) -%}
+ {#- Output a cross-reference to a Griffe object.
+
+ This macro outputs a cross-reference to the given name.
+
Parameters:
name (griffe.ExprName): The name to cross-reference.
annotation_path (str): Either "brief", "source", or "full".
@@ -35,11 +58,11 @@ which is a tree-like structure representing a Python expression.
{{ prefix }}
{%- if not signature -%}
{#- Always render cross-references outside of signatures. We don't need to stash them. -#}
- {{ title }}
+ {{ title }}
{%- elif config.signature_crossrefs -%}
{#- We're in a signature and cross-references are enabled, we must render one and stash it. -#}
{%- filter stash_crossref(length=title|length) -%}
- {{ title }}
+ {{ title }}
{%- endfilter -%}
{%- else -%}
{#- We're in a signature but cross-references are disabled, we just render the title. -#}
@@ -50,6 +73,26 @@ which is a tree-like structure representing a Python expression.
{%- endwith -%}
{%- endmacro -%}
+{%- macro type_param_crossref(name) -%}
+ {#- Render a cross-reference to a type parameter heading.
+
+ Parameters:
+ name (griffe.ExprName): The name to cross-reference.
+
+ Returns:
+ The autorefs cross-reference, or the type parameter name.
+ -#}
+ {%- if not signature -%}
+ {{ name.name }}
+ {%- elif config.signature_crossrefs -%}
+ {%- filter stash_crossref(length=name.name|length) -%}
+ {{ name.name }}
+ {%- endfilter -%}
+ {%- else -%}
+ {{ name.name }}
+ {%- endif -%}
+{%- endmacro -%}
+
{%- macro param_crossref(expression) -%}
{#- Render a cross-reference to a parameter heading.
@@ -72,7 +115,7 @@ which is a tree-like structure representing a Python expression.
{%- endif -%}
{%- endmacro -%}
-{%- macro render(expression, annotations_path) -%}
+{%- macro render(expression, annotations_path, backlink_type="") -%}
{#- Render an expression.
Parameters:
@@ -85,13 +128,20 @@ which is a tree-like structure representing a Python expression.
{%- if expression is string -%}
{%- if signature -%}{{ expression|safe }}{%- else -%}{{ expression }}{%- endif -%}
{%- elif expression.classname == "ExprName" -%}
- {{ crossref(expression, annotations_path) }}
+ {{ crossref(expression, annotations_path, backlink_type) }}
{%- elif config.unwrap_annotated and expression.classname == "ExprSubscript" and expression.canonical_path in ("typing.Annotated", "typing_extensions.Annotated") -%}
{{ render(expression.slice.elements[0], annotations_path) }}
{%- elif expression.classname == "ExprAttribute" -%}
- {%- if annotations_path == "brief" -%}
+ {%- if expression.first.is_type_parameter -%}
+ {{ type_param_crossref(expression.first) }}
+ {%- for element in expression -%}
+ {%- if not loop.first -%}
+ {{ render(element, "brief") }}
+ {%- endif -%}
+ {%- endfor -%}
+ {%- elif annotations_path == "brief" -%}
{%- if expression.last.is_enum_value -%}
- {{ crossref(expression.last.parent, "brief") }}.value
+ {{ crossref(expression.last.parent, "brief", backlink_type) }}.value
{%- else -%}
{{ render(expression.last, "brief") }}
{%- endif -%}
@@ -116,4 +166,7 @@ which is a tree-like structure representing a Python expression.
{%- endif -%}
{%- endmacro -%}
-{{ render(expression, config.annotations_path) }}
+{%- if config.modernize_annotations and expression is not string -%}
+ {%- set expression = expression.modernize() -%}
+{%- endif -%}
+{{ render(expression, annotations_path|default(config.annotations_path), backlink_type|default("")) }}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/function.html b/src/mkdocstrings_handlers/python/templates/material/_base/function.html
deleted file mode 100644
index 07be5abb..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/_base/function.html
+++ /dev/null
@@ -1,11 +0,0 @@
-{% extends "_base/function.html.jinja" %}
-
-{% block logs scoped %}
- {{ super() }}
- {# TODO: Switch to a warning after some time. #}
- {{ log.info(
- "DeprecationWarning: Extending '_base/function.html' is deprecated, extend '_base/function.html.jinja' instead. " ~
- "After some time, this message will be logged as a warning, causing strict builds to fail.",
- once=True,
- ) }}
-{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/function.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/function.html.jinja
index b475cf1b..c824226e 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/function.html.jinja
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/function.html.jinja
@@ -17,7 +17,7 @@ Context:
{{ log.debug("Rendering " + function.path) }}
{% endblock logs %}
-{% import "language"|get_template as lang with context %}
+{% import "language.html.jinja" as lang with context %}
{#- Language module providing the `t` translation method. -#}
@@ -44,7 +44,8 @@ Context:
role="function",
id=html_id,
class="doc doc-heading",
- toc_label=((' ')|safe if config.show_symbol_type_toc else '') + function.name,
+ toc_label=((' ')|safe if config.show_symbol_type_toc else '') + (config.toc_label if config.toc_label and root else function.name),
+ skip_inventory=config.skip_local_inventory,
) %}
{% block heading scoped %}
@@ -53,12 +54,16 @@ Context:
This block renders the heading for the function.
-#}
{% if config.show_symbol_type_heading %}{% endif %}
- {% if config.separate_signature %}
- {{ config.heading if config.heading and root else function_name }}
+ {% if config.heading and root %}
+ {{ config.heading }}
+ {% elif config.separate_signature %}
+ {{ function_name }}
{% else %}
- {%+ filter highlight(language="python", inline=True) %}
- {{ function_name }}{% include "signature"|get_template with context %}
- {% endfilter %}
+ {%+ filter highlight(language="python", inline=True) -%}
+ {{ function_name }}
+ {%- include "type_parameters.html.jinja" with context -%}
+ {%- include "signature.html.jinja" with context -%}
+ {%- endfilter %}
{% endif %}
{% endblock heading %}
@@ -68,7 +73,7 @@ Context:
This block renders the labels for the function.
-#}
{% with labels = function.labels %}
- {% include "labels"|get_template with context %}
+ {% include "labels.html.jinja" with context %}
{% endwith %}
{% endblock labels %}
@@ -89,7 +94,7 @@ Context:
{% endfor %}
{% endif %}
- {% if config.separate_signature %}
+ {% if config.separate_signature and not (config.show_overloads and function.overloads and config.overloads_only) %}
{% filter format_signature(function, config.line_length, crossrefs=config.signature_crossrefs) %}
{{ function.name }}
{% endfilter %}
@@ -105,6 +110,7 @@ Context:
id=html_id,
toc_label=((' ')|safe if config.show_symbol_type_toc else '') + (config.toc_label if config.toc_label and root else function.name),
hidden=True,
+ skip_inventory=config.skip_local_inventory,
) %}
{% endfilter %}
{% endif %}
@@ -125,24 +131,22 @@ Context:
This block renders the docstring for the function.
-#}
{% with docstring_sections = function.docstring.parsed %}
- {% include "docstring"|get_template with context %}
+ {% include "docstring.html.jinja" with context %}
{% endwith %}
{% endblock docstring %}
+ {% if config.backlinks %}
+
+ {% endif %}
+
{% block source scoped %}
{#- Source block.
This block renders the source code for the function.
-#}
{% if config.show_source and function.source %}
-
- {{ lang.t("Source code in") }}
- {%- if function.relative_filepath.is_absolute() -%}
- {{ function.relative_package_filepath }}
- {%- else -%}
- {{ function.relative_filepath }}
- {%- endif -%}
-
+
+ {{ lang.t("Source code in") }} {{ function|source_location }}
{{ function.source|highlight(language="python", linestart=function.lineno or 0, linenums=True) }}
{% endif %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/labels.html b/src/mkdocstrings_handlers/python/templates/material/_base/labels.html
deleted file mode 100644
index 784150c4..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/_base/labels.html
+++ /dev/null
@@ -1,11 +0,0 @@
-{% extends "_base/labels.html.jinja" %}
-
-{% block logs scoped %}
- {{ super() }}
- {# TODO: Switch to a warning after some time. #}
- {{ log.info(
- "DeprecationWarning: Extending '_base/labels.html' is deprecated, extend '_base/labels.html.jinja' instead. " ~
- "After some time, this message will be logged as a warning, causing strict builds to fail.",
- once=True,
- ) }}
-{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/language.html b/src/mkdocstrings_handlers/python/templates/material/_base/language.html
deleted file mode 100644
index c97d0c31..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/_base/language.html
+++ /dev/null
@@ -1,11 +0,0 @@
-{% extends "_base/language.html.jinja" %}
-
-{% block logs scoped %}
- {{ super() }}
- {# TODO: Switch to a warning after some time. #}
- {{ log.info(
- "DeprecationWarning: Extending '_base/language.html' is deprecated, extend '_base/language.html.jinja' instead. " ~
- "After some time, this message will be logged as a warning, causing strict builds to fail.",
- once=True,
- ) }}
-{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/language.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/language.html.jinja
index e3a614bb..31ecfdd6 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/language.html.jinja
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/language.html.jinja
@@ -7,12 +7,12 @@
-#}
{% endblock logs %}
-{% set lang_pth = "languages/" ~ locale | get_template %}
+{% set lang_pth = "languages/" ~ locale ~ ".html.jinja" %}
{% if lang_pth is existing_template %}
- {% import lang_pth as lang %}
- {% import "languages/en"|get_template as fallback %}
- {% macro t(key) %}{{ lang.t(key) or fallback.t(key) }}{% endmacro %}
+ {% import lang_pth as lang %}
+ {% import "languages/en.html.jinja" as fallback %}
+ {% macro t(key) %}{{ lang.t(key) or fallback.t(key) }}{% endmacro %}
{% else %}
- {% import "languages/en"|get_template as lang %}
- {% macro t(key) %}{{ lang.t(key) }}{% endmacro %}
+ {% import "languages/en.html.jinja" as lang %}
+ {% macro t(key) %}{{ lang.t(key) }}{% endmacro %}
{% 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
deleted file mode 100644
index eab87415..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/_base/languages/en.html
+++ /dev/null
@@ -1,11 +0,0 @@
-{% extends "_base/languages/en.html.jinja" %}
-
-{% block logs scoped %}
- {{ super() }}
- {# TODO: Switch to a warning after some time. #}
- {{ log.info(
- "DeprecationWarning: Extending '_base/languages/en.html' is deprecated, extend '_base/languages/en.html.jinja' instead. " ~
- "After some time, this message will be logged as a warning, causing strict builds to fail.",
- once=True,
- ) }}
-{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/languages/en.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/languages/en.html.jinja
index bcdcce2d..d2bbba03 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/languages/en.html.jinja
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/languages/en.html.jinja
@@ -9,19 +9,30 @@
{% macro t(key) %}{{ {
"ATTRIBUTE": "ATTRIBUTE",
+ "Attributes": "Attributes",
"Attributes:": "Attributes:",
+ "BOUND:": "BOUND:",
+ "Bound or Constraints": "Bound or Constraints",
+ "Classes": "Classes",
"Classes:": "Classes:",
+ "Class Type Parameters:": "Class Type Parameters:",
+ "CLASS TYPE PARAMETER": "CLASS TYPE PARAMETER",
"CLASS": "CLASS",
+ "CONSTRAINTS:": "CONSTRAINTS:",
"DEFAULT:": "DEFAULT:",
"Default": "Default",
"default:": "default:",
"DESCRIPTION": "DESCRIPTION",
"Description": "Description",
"Examples:": "Examples:",
+ "Functions": "Functions",
"Functions:": "Functions:",
"FUNCTION": "FUNCTION",
+ "Init Type Parameters:": "Init Type Parameters:",
+ "INIT TYPE PARAMETER": "INIT TYPE PARAMETER",
"Methods:": "Methods:",
"METHOD": "METHOD",
+ "Modules": "Modules",
"Modules:": "Modules:",
"MODULE": "MODULE",
"Name": "Name",
@@ -38,6 +49,11 @@
"Source code in": "Source code in",
"TYPE:": "TYPE:",
"Type": "Type",
+ "Type Aliases": "Type Aliases",
+ "Type Aliases:": "Type Aliases:",
+ "TYPE ALIAS": "TYPE ALIAS",
+ "Type Parameters:": "Type Parameters:",
+ "TYPE PARAMETER": "TYPE PARAMETER",
"WARNS": "WARNS",
"Warns:": "Warns:",
"YIELDS": "YIELDS",
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/languages/ja.html b/src/mkdocstrings_handlers/python/templates/material/_base/languages/ja.html
deleted file mode 100644
index 14319499..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/_base/languages/ja.html
+++ /dev/null
@@ -1,11 +0,0 @@
-{% extends "_base/languages/ja.html.jinja" %}
-
-{% block logs scoped %}
- {{ super() }}
- {# TODO: Switch to a warning after some time. #}
- {{ log.info(
- "DeprecationWarning: Extending '_base/languages/ja.html' is deprecated, extend '_base/languages/ja.html.jinja' instead. " ~
- "After some time, this message will be logged as a warning, causing strict builds to fail.",
- once=True,
- ) }}
-{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/languages/ja.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/languages/ja.html.jinja
index 0393ca03..840da89c 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/languages/ja.html.jinja
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/languages/ja.html.jinja
@@ -9,19 +9,30 @@
{% macro t(key) %}{{ {
"ATTRIBUTE": "属性",
+ "Attributes": "属性",
"Attributes:": "属性:",
+ "BOUND:": "境界:",
+ "Bound or Constraints": "境界や制約",
+ "Classes": "クラス",
"Classes:": "クラス:",
+ "Class Type Parameters:": "Class Type Parameters:",
+ "CLASS TYPE PARAMETER": "CLASS TYPE PARAMETER",
"CLASS": "クラス",
+ "CONSTRAINTS:": "制約:",
"DEFAULT:": "デフォルト:",
"Default": "デフォルト",
"default:": "デフォルト:",
"DESCRIPTION": "デスクリプション",
"Description": "デスクリプション",
"Examples:": "例:",
+ "Functions": "関数",
"Functions:": "関数:",
"FUNCTION": "関数",
+ "Init Type Parameters:": "Init Type Parameters:",
+ "INIT TYPE PARAMETER": "INIT TYPE PARAMETER",
"Methods:": "メソッド:",
"METHOD": "メソッド",
+ "Modules": "モジュール",
"Modules:": "モジュール:",
"MODULE": "モジュール",
"Name": "名前",
@@ -38,6 +49,11 @@
"Source code in": "ソースコード位置:",
"TYPE:": "タイプ:",
"Type": "タイプ",
+ "Type Aliases": "型エイリアス",
+ "Type Aliases:": "型エイリアス:",
+ "TYPE ALIAS": "型エイリアス",
+ "Type Parameters:": "型パラメータ:",
+ "TYPE PARAMETER": "型パラメータ",
"WARNS": "警告",
"Warns:": "警告:",
"YIELDS": "返す",
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/languages/zh.html b/src/mkdocstrings_handlers/python/templates/material/_base/languages/zh.html
deleted file mode 100644
index 0b281195..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/_base/languages/zh.html
+++ /dev/null
@@ -1,11 +0,0 @@
-{% extends "_base/languages/zh.html.jinja" %}
-
-{% block logs scoped %}
- {{ super() }}
- {# TODO: Switch to a warning after some time. #}
- {{ log.info(
- "DeprecationWarning: Extending '_base/languages/zh.html' is deprecated, extend '_base/languages/zh.html.jinja' instead. " ~
- "After some time, this message will be logged as a warning, causing strict builds to fail.",
- once=True,
- ) }}
-{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/languages/zh.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/languages/zh.html.jinja
index e57169ad..53888779 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/languages/zh.html.jinja
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/languages/zh.html.jinja
@@ -9,19 +9,30 @@
{% macro t(key) %}{{ {
"ATTRIBUTE": "属性",
+ "Attributes": "属性",
"Attributes:": "属性:",
+ "BOUND:": "边界:",
+ "Bound or Constraints": "边界或约束",
+ "Classes": "类",
"Classes:": "类:",
+ "Class Type Parameters:": "Class Type Parameters:",
+ "CLASS TYPE PARAMETER": "CLASS TYPE PARAMETER",
"CLASS": "类",
+ "CONSTRAINTS:": "约束:",
"DEFAULT:": "默认:",
"Default": "默认",
"default:": "默认:",
"DESCRIPTION": "描述",
"Description": "描述",
"Examples:": "示例:",
+ "Functions": "函数",
"Functions:": "函数:",
"FUNCTION": "函数",
+ "Init Type Parameters:": "Init Type Parameters:",
+ "INIT TYPE PARAMETER": "INIT TYPE PARAMETER",
"Methods:": "方法:",
"METHOD": "方法",
+ "Modules": "模块",
"Modules:": "模块:",
"MODULE": "模块",
"Name": "名称",
@@ -38,6 +49,11 @@
"Source code in": "源代码位于:",
"TYPE:": "类型:",
"Type": "类型",
+ "Type Aliases": "类型别名",
+ "Type Aliases:": "类型别名:",
+ "TYPE ALIAS": "类型别名",
+ "Type Parameters:": "类型形参:",
+ "TYPE PARAMETER": "类型形参",
"Warns:": "警告:",
"WARNS": "警告",
"YIELDS": "产生",
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/module.html b/src/mkdocstrings_handlers/python/templates/material/_base/module.html
deleted file mode 100644
index 918ab6d0..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/_base/module.html
+++ /dev/null
@@ -1,11 +0,0 @@
-{% extends "_base/module.html.jinja" %}
-
-{% block logs scoped %}
- {{ super() }}
- {# TODO: Switch to a warning after some time. #}
- {{ log.info(
- "DeprecationWarning: Extending '_base/module.html' is deprecated, extend '_base/module.html.jinja' instead. " ~
- "After some time, this message will be logged as a warning, causing strict builds to fail.",
- once=True,
- ) }}
-{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/module.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/module.html.jinja
index fa2d2e6a..c0f4a7cb 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/module.html.jinja
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/module.html.jinja
@@ -39,6 +39,7 @@ Context:
id=html_id,
class="doc doc-heading",
toc_label=(' '|safe if config.show_symbol_type_toc else '') + (config.toc_label if config.toc_label and root else module.name),
+ skip_inventory=config.skip_local_inventory,
) %}
{% block heading scoped %}
@@ -47,8 +48,10 @@ Context:
This block renders the heading for the module.
-#}
{% if config.show_symbol_type_heading %}{% endif %}
- {% if config.separate_signature %}
- {{ config.heading if config.heading and root else module_name }}
+ {% if config.heading and root %}
+ {{ config.heading }}
+ {% elif config.separate_signature %}
+ {{ module_name }}
{% else %}
{{ module_name }}
{% endif %}
@@ -60,7 +63,7 @@ Context:
This block renders the labels for the module.
-#}
{% with labels = module.labels %}
- {% include "labels"|get_template with context %}
+ {% include "labels.html.jinja" with context %}
{% endwith %}
{% endblock labels %}
@@ -73,6 +76,7 @@ Context:
id=html_id,
toc_label=(' '|safe if config.show_symbol_type_toc else '') + (config.toc_label if config.toc_label and root else module.name),
hidden=True,
+ skip_inventory=config.skip_local_inventory,
) %}
{% endfilter %}
{% endif %}
@@ -93,16 +97,20 @@ Context:
This block renders the docstring for the module.
-#}
{% with docstring_sections = module.docstring.parsed %}
- {% include "docstring"|get_template with context %}
+ {% include "docstring.html.jinja" with context %}
{% endwith %}
{% endblock docstring %}
+ {% if config.backlinks %}
+
+ {% endif %}
+
{% block summary scoped %}
{#- Summary block.
This block renders auto-summaries for classes, methods, and attributes.
-#}
- {% include "summary"|get_template with context %}
+ {% include "summary.html.jinja" with context %}
{% endblock summary %}
{% block children scoped %}
@@ -112,7 +120,7 @@ Context:
-#}
{% set root = False %}
{% set heading_level = heading_level + 1 %}
- {% include "children"|get_template with context %}
+ {% include "children.html.jinja" with context %}
{% endblock children %}
{% endblock contents %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/signature.html b/src/mkdocstrings_handlers/python/templates/material/_base/signature.html
deleted file mode 100644
index 623879db..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/_base/signature.html
+++ /dev/null
@@ -1,11 +0,0 @@
-{% extends "_base/signature.html.jinja" %}
-
-{% block logs scoped %}
- {{ super() }}
- {# TODO: Switch to a warning after some time. #}
- {{ log.info(
- "DeprecationWarning: Extending '_base/signature.html' is deprecated, extend '_base/signature.html.jinja' instead. " ~
- "After some time, this message will be logged as a warning, causing strict builds to fail.",
- once=True,
- ) }}
-{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/signature.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/signature.html.jinja
index ce5c3f04..7167f1d7 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/signature.html.jinja
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/signature.html.jinja
@@ -49,7 +49,9 @@ Context:
{%- set ns.equal = " = " -%}
{%- if config.separate_signature -%}
{%- with expression = parameter.annotation -%}
- {%- set ns.annotation -%}: {% include "expression"|get_template with context %}{%- endset -%}
+ {%- set ns.annotation -%}: {% with backlink_type = "used-by" -%}
+ {%- include "expression.html.jinja" with context -%}
+ {%- endwith -%}{%- endset -%}
{%- endwith -%}
{%- else -%}
{%- set ns.annotation = ": " + parameter.annotation|safe -%}
@@ -102,8 +104,8 @@ Context:
{%- if ns.default -%}
{{ ns.equal }}
{%- if config.signature_crossrefs and config.separate_signature -%}
- {%- with expression = parameter.default -%}
- {%- include "expression"|get_template with context -%}
+ {%- with expression = parameter.default, backlink_type = "used-by" -%}
+ {%- include "expression.html.jinja" with context -%}
{%- endwith -%}
{%- else -%}
{{ parameter.default|safe }}
@@ -121,7 +123,9 @@ Context:
and function.annotation
and not (config.merge_init_into_class and function.name == "__init__" )
%} -> {% if config.separate_signature and config.signature_crossrefs -%}
- {%- with expression = function.annotation %}{% include "expression"|get_template with context %}{%- endwith -%}
+ {%- with expression = function.annotation, backlink_type = "returned-by" -%}
+ {%- include "expression.html.jinja" with context -%}
+ {%- endwith -%}
{%- else -%}
{{ function.annotation|safe }}
{%- endif -%}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/summary.html b/src/mkdocstrings_handlers/python/templates/material/_base/summary.html
deleted file mode 100644
index aa33dc9c..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/_base/summary.html
+++ /dev/null
@@ -1,11 +0,0 @@
-{% extends "_base/summary.html.jinja" %}
-
-{% block logs scoped %}
- {{ super() }}
- {# TODO: Switch to a warning after some time. #}
- {{ log.info(
- "DeprecationWarning: Extending '_base/summary.html' is deprecated, extend '_base/summary.html.jinja' instead. " ~
- "After some time, this message will be logged as a warning, causing strict builds to fail.",
- once=True,
- ) }}
-{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/summary.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/summary.html.jinja
index 0a4ee071..852af437 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/summary.html.jinja
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/summary.html.jinja
@@ -9,18 +9,22 @@
{% with members_list = config.members if root_members else None %}
{% if config.summary.modules %}
- {% include "summary/modules"|get_template with context %}
+ {% include "summary/modules.html.jinja" with context %}
+ {% endif %}
+
+ {% if config.summary.type_aliases %}
+ {% include "summary/type_aliases.html.jinja" with context %}
{% endif %}
{% if config.summary.classes %}
- {% include "summary/classes"|get_template with context %}
+ {% include "summary/classes.html.jinja" with context %}
{% endif %}
{% if config.summary.functions %}
- {% include "summary/functions"|get_template with context %}
+ {% include "summary/functions.html.jinja" with context %}
{% endif %}
{% if config.summary.attributes %}
- {% include "summary/attributes"|get_template with context %}
+ {% include "summary/attributes.html.jinja" with context %}
{% endif %}
{% endwith %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/summary/attributes.html b/src/mkdocstrings_handlers/python/templates/material/_base/summary/attributes.html
deleted file mode 100644
index f2643791..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/_base/summary/attributes.html
+++ /dev/null
@@ -1,11 +0,0 @@
-{% extends "_base/summary/attributes.html.jinja" %}
-
-{% block logs scoped %}
- {{ super() }}
- {# TODO: Switch to a warning after some time. #}
- {{ log.info(
- "DeprecationWarning: Extending '_base/summary/attributes.html' is deprecated, extend '_base/summary/attributes.html.jinja' instead. " ~
- "After some time, this message will be logged as a warning, causing strict builds to fail.",
- once=True,
- ) }}
-{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/summary/attributes.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/summary/attributes.html.jinja
index 8bc8cb60..be42ed0f 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/summary/attributes.html.jinja
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/summary/attributes.html.jinja
@@ -7,15 +7,17 @@
-#}
{% endblock logs %}
-{% with section = obj.attributes
- |filter_objects(
- filters=config.filters,
- members_list=members_list,
- inherited_members=config.inherited_members,
- keep_no_docstrings=config.show_if_no_docstring,
- )
- |order_members(config.members_order, members_list)
- |as_attributes_section(check_public=not members_list)
- %}
- {% if section %}{% include "docstring/attributes"|get_template with context %}{% endif %}
-{% endwith %}
+{% if not obj.docstring.parsed | selectattr("kind.value", "eq", "attributes") | list %}
+ {% with section = obj.attributes
+ |filter_objects(
+ filters=config.filters,
+ members_list=members_list,
+ inherited_members=config.inherited_members,
+ keep_no_docstrings=config.show_if_no_docstring,
+ )
+ |order_members(config.members_order, members_list)
+ |as_attributes_section(check_public=not members_list)
+ %}
+ {% if section %}{% include "docstring/attributes.html.jinja" with context %}{% endif %}
+ {% endwith %}
+{% endif %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/summary/classes.html b/src/mkdocstrings_handlers/python/templates/material/_base/summary/classes.html
deleted file mode 100644
index 5c6275b4..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/_base/summary/classes.html
+++ /dev/null
@@ -1,11 +0,0 @@
-{% extends "_base/summary/classes.html.jinja" %}
-
-{% block logs scoped %}
- {{ super() }}
- {# TODO: Switch to a warning after some time. #}
- {{ log.info(
- "DeprecationWarning: Extending '_base/summary/classes.html' is deprecated, extend '_base/summary/classes.html.jinja' instead. " ~
- "After some time, this message will be logged as a warning, causing strict builds to fail.",
- once=True,
- ) }}
-{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/summary/classes.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/summary/classes.html.jinja
index 1b1ef8f3..3c0406dd 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/summary/classes.html.jinja
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/summary/classes.html.jinja
@@ -7,15 +7,17 @@
-#}
{% endblock logs %}
-{% with section = obj.classes
- |filter_objects(
- filters=config.filters,
- members_list=members_list,
- inherited_members=config.inherited_members,
- keep_no_docstrings=config.show_if_no_docstring,
- )
- |order_members(config.members_order, members_list)
- |as_classes_section(check_public=not members_list)
- %}
- {% if section %}{% include "docstring/classes"|get_template with context %}{% endif %}
-{% endwith %}
+{% if not obj.docstring.parsed | selectattr("kind.value", "eq", "classes") | list %}
+ {% with section = obj.classes
+ |filter_objects(
+ filters=config.filters,
+ members_list=members_list,
+ inherited_members=config.inherited_members,
+ keep_no_docstrings=config.show_if_no_docstring,
+ )
+ |order_members(config.members_order, members_list)
+ |as_classes_section(check_public=not members_list)
+ %}
+ {% if section %}{% include "docstring/classes.html.jinja" with context %}{% endif %}
+ {% endwith %}
+{% endif %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/summary/functions.html b/src/mkdocstrings_handlers/python/templates/material/_base/summary/functions.html
deleted file mode 100644
index 31887e0a..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/_base/summary/functions.html
+++ /dev/null
@@ -1,11 +0,0 @@
-{% extends "_base/summary/functions.html.jinja" %}
-
-{% block logs scoped %}
- {{ super() }}
- {# TODO: Switch to a warning after some time. #}
- {{ log.info(
- "DeprecationWarning: Extending '_base/summary/functions.html' is deprecated, extend '_base/summary/functions.html.jinja' instead. " ~
- "After some time, this message will be logged as a warning, causing strict builds to fail.",
- once=True,
- ) }}
-{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/summary/functions.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/summary/functions.html.jinja
index f03dfba2..9fc6ea87 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/summary/functions.html.jinja
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/summary/functions.html.jinja
@@ -7,15 +7,17 @@
-#}
{% endblock logs %}
-{% with section = obj.functions
- |filter_objects(
- filters=config.filters,
- members_list=members_list,
- inherited_members=config.inherited_members,
- keep_no_docstrings=config.show_if_no_docstring,
- )
- |order_members(config.members_order, members_list)
- |as_functions_section(check_public=not members_list)
- %}
- {% if section %}{% include "docstring/functions"|get_template with context %}{% endif %}
-{% endwith %}
+{% if not obj.docstring.parsed | selectattr("kind.value", "eq", "functions") | list %}
+ {% with section = obj.functions
+ |filter_objects(
+ filters=config.filters,
+ members_list=members_list,
+ inherited_members=config.inherited_members,
+ keep_no_docstrings=config.show_if_no_docstring,
+ )
+ |order_members(config.members_order, members_list)
+ |as_functions_section(check_public=not members_list)
+ %}
+ {% if section %}{% include "docstring/functions.html.jinja" with context %}{% endif %}
+ {% endwith %}
+{% endif %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/summary/modules.html b/src/mkdocstrings_handlers/python/templates/material/_base/summary/modules.html
deleted file mode 100644
index 31dcb5f0..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/_base/summary/modules.html
+++ /dev/null
@@ -1,11 +0,0 @@
-{% extends "_base/summary/modules.html.jinja" %}
-
-{% block logs scoped %}
- {{ super() }}
- {# TODO: Switch to a warning after some time. #}
- {{ log.info(
- "DeprecationWarning: Extending '_base/summary/modules.html' is deprecated, extend '_base/summary/modules.html.jinja' instead. " ~
- "After some time, this message will be logged as a warning, causing strict builds to fail.",
- once=True,
- ) }}
-{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/summary/modules.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/summary/modules.html.jinja
index 606711c5..6206c6d1 100644
--- a/src/mkdocstrings_handlers/python/templates/material/_base/summary/modules.html.jinja
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/summary/modules.html.jinja
@@ -7,15 +7,17 @@
-#}
{% endblock logs %}
-{% with section = obj.modules
- |filter_objects(
- filters=config.filters,
- members_list=members_list,
- inherited_members=config.inherited_members,
- keep_no_docstrings=config.show_if_no_docstring,
- )
- |order_members("alphabetical", members_list)
- |as_modules_section(check_public=not members_list)
- %}
- {% if section %}{% include "docstring/modules"|get_template with context %}{% endif %}
-{% endwith %}
+{% if not obj.docstring.parsed | selectattr("kind.value", "eq", "modules") | list %}
+ {% with section = obj.modules
+ |filter_objects(
+ filters=config.filters,
+ members_list=members_list,
+ inherited_members=config.inherited_members,
+ keep_no_docstrings=config.show_if_no_docstring,
+ )
+ |order_members("alphabetical", members_list)
+ |as_modules_section(check_public=not members_list)
+ %}
+ {% if section %}{% include "docstring/modules.html.jinja" with context %}{% endif %}
+ {% endwith %}
+{% endif %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/summary/type_aliases.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/summary/type_aliases.html.jinja
new file mode 100644
index 00000000..ed0d2ef5
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/summary/type_aliases.html.jinja
@@ -0,0 +1,23 @@
+{#- Summary of type aliases. -#}
+
+{% block logs scoped %}
+ {#- Logging block.
+
+ This block can be used to log debug messages, deprecation messages, warnings, etc.
+ -#}
+{% endblock logs %}
+
+{% if not obj.docstring.parsed | selectattr("kind.value", "eq", "type aliases") | list %}
+ {% with section = obj.type_aliases
+ |filter_objects(
+ filters=config.filters,
+ members_list=members_list,
+ inherited_members=config.inherited_members,
+ keep_no_docstrings=config.show_if_no_docstring,
+ )
+ |order_members("alphabetical", members_list)
+ |as_type_aliases_section(check_public=not members_list)
+ %}
+ {% if section %}{% include "docstring/type_aliases.html.jinja" with context %}{% endif %}
+ {% endwith %}
+{% endif %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/type_alias.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/type_alias.html.jinja
new file mode 100644
index 00000000..ff1e8464
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/type_alias.html.jinja
@@ -0,0 +1,117 @@
+{#- Template for Python type aliases.
+
+This template renders a Python type alias.
+
+Context:
+ type_alias (griffe.TypeAlias): The type alias to render.
+ root (bool): Whether this is the root object, injected with `:::` in a Markdown page.
+ heading_level (int): The HTML heading level to use.
+ config (dict): The configuration options.
+-#}
+
+{% block logs scoped %}
+ {#- Logging block.
+
+ This block can be used to log debug messages, deprecation messages, warnings, etc.
+ -#}
+ {{ log.debug("Rendering " + type_alias.path) }}
+{% endblock logs %}
+
+
+ {% with obj = type_alias, html_id = type_alias.path %}
+
+ {% if root %}
+ {% set show_full_path = config.show_root_full_path %}
+ {% set root_members = True %}
+ {% elif root_members %}
+ {% set show_full_path = config.show_root_members_full_path or config.show_object_full_path %}
+ {% set root_members = False %}
+ {% else %}
+ {% set show_full_path = config.show_object_full_path %}
+ {% endif %}
+
+ {% set type_alias_name = type_alias.path if show_full_path else type_alias.name %}
+
+ {% if not root or config.show_root_heading %}
+ {% filter heading(
+ heading_level,
+ role="typealias",
+ id=html_id,
+ class="doc doc-heading",
+ toc_label=(' '|safe if config.show_symbol_type_toc else '') + type_alias.name,
+ ) %}
+
+ {% block heading scoped %}
+ {#- Heading block.
+
+ This block renders the heading for the type alias.
+ -#}
+ {% if config.show_symbol_type_heading %}{% endif %}
+ {% if config.separate_signature %}
+ {{ type_alias_name }}
+ {% else %}
+ {%+ filter highlight(language="python", inline=True) %}
+ {{ type_alias_name }}{% include "type_parameters.html.jinja" with context %} = {{ type_alias.value }}
+ {% endfilter %}
+ {% endif %}
+ {% endblock heading %}
+
+ {% block labels scoped %}
+ {#- Labels block.
+
+ This block renders the labels for the type alias.
+ -#}
+ {% with labels = type_alias.labels %}
+ {% include "labels.html.jinja" with context %}
+ {% endwith %}
+ {% endblock labels %}
+
+ {% endfilter %}
+
+ {% block signature scoped %}
+ {#- Signature block.
+
+ This block renders the signature for the type alias.
+ -#}
+ {% if config.separate_signature %}
+ {% filter format_type_alias(type_alias, config.line_length, crossrefs=config.signature_crossrefs) %}
+ {{ type_alias.name }}
+ {% endfilter %}
+ {% endif %}
+ {% endblock signature %}
+
+ {% else %}
+ {% if config.show_root_toc_entry %}
+ {% filter heading(heading_level,
+ role="typealias",
+ id=html_id,
+ toc_label=(' '|safe if config.show_symbol_type_toc else '') + type_alias.name,
+ hidden=True,
+ ) %}
+ {% endfilter %}
+ {% endif %}
+ {% set heading_level = heading_level - 1 %}
+ {% endif %}
+
+
+ {% block contents scoped %}
+ {#- Contents block.
+
+ This block renders the contents of the type alias.
+ It contains other blocks that users can override.
+ Overriding the contents block allows to rearrange the order of the blocks.
+ -#}
+ {% block docstring scoped %}
+ {#- Docstring block.
+
+ This block renders the docstring for the type alias.
+ -#}
+ {% with docstring_sections = type_alias.docstring.parsed %}
+ {% include "docstring.html.jinja" with context %}
+ {% endwith %}
+ {% endblock docstring %}
+ {% endblock contents %}
+
+
+ {% endwith %}
+
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/type_parameters.html.jinja b/src/mkdocstrings_handlers/python/templates/material/_base/type_parameters.html.jinja
new file mode 100644
index 00000000..47100924
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/_base/type_parameters.html.jinja
@@ -0,0 +1,87 @@
+{#- Template for type parameters.
+
+This template renders the type parameters of a generic obj.
+It iterates over the type parameters of the object to rebuild the signature.
+The signature is the list of type parameters of a generic object, including their names, default values, and bound or constraints.
+
+Context:
+ obj (griffe.Object): The object to render.
+ config (dict): The configuration options.
+-#}
+
+{%- if config.show_signature_type_parameters -%}
+ {%- block logs scoped -%}
+ {#- Logging block.
+
+ This block can be used to log debug messages, deprecation messages, warnings, etc.
+ -#}
+ {{ log.debug("Rendering type parameters") }}
+ {%- endblock logs -%}
+
+ {%- with ns = namespace(annotation="", equal="=", default=False) -%}
+ {%- if obj.is_generic -%}
+ [
+ {%- for type_parameter in obj.type_parameters -%}
+ {#- Prepare type bound or constraints. -#}
+ {%- if config.show_signature_annotations and type_parameter.annotation is not none -%}
+ {%- set ns.equal = " = " -%}
+ {%- if config.separate_signature and config.signature_crossrefs -%}
+ {%- with expression = type_parameter.annotation -%}
+ {%- set ns.annotation -%}: {% include "expression.html.jinja" with context %}{%- endset -%}
+ {%- endwith -%}
+ {%- else -%}
+ {%- set ns.annotation = ": " + type_parameter.annotation|safe -%}
+ {%- endif -%}
+ {%- else -%}
+ {%- set ns.equal = "=" -%}
+ {%- set ns.annotation = "" -%}
+ {%- endif -%}
+
+ {#- Prepare default value. -#}
+ {%- if type_parameter.default is not none -%}
+ {%- set ns.default = True -%}
+ {%- else -%}
+ {%- set ns.default = False -%}
+ {%- endif -%}
+
+ {#- Prepare name. -#}
+ {%- set type_param_prefix -%}
+ {%- if type_parameter.kind == "type-var-tuple" -%}
+ *
+ {%- elif type_parameter.kind == "param-spec" -%}
+ **
+ {%- endif -%}
+ {%- endset -%}
+
+ {#- Render type parameter name with optional cross-reference to its heading. -#}
+ {{ type_param_prefix }}
+ {%- if config.separate_signature and config.type_parameter_headings and config.signature_crossrefs -%}
+ {%- filter stash_crossref(length=type_parameter.name|length) -%}
+ {{ type_parameter.name }}
+ {%- endfilter -%}
+ {%- else -%}
+ {{ type_parameter.name }}
+ {%- endif -%}
+
+ {#- Render type parameter bound or constraints. -#}
+ {{ ns.annotation }}
+
+ {#- Render type parameter default value. -#}
+ {%- if ns.default -%}
+ {{ ns.equal }}
+ {%- if config.signature_crossrefs and config.separate_signature -%}
+ {%- with expression = type_parameter.default -%}
+ {%- include "expression.html.jinja" with context -%}
+ {%- endwith -%}
+ {%- else -%}
+ {{ type_parameter.default|safe }}
+ {%- endif -%}
+ {%- endif -%}
+
+ {%- if not loop.last %}, {% endif -%}
+ {%- endfor -%}
+ ]
+ {%- endif -%}
+
+ {%- endwith -%}
+{%- endif -%}
diff --git a/src/mkdocstrings_handlers/python/templates/material/attribute.html b/src/mkdocstrings_handlers/python/templates/material/attribute.html
deleted file mode 100644
index a3c27503..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/attribute.html
+++ /dev/null
@@ -1 +0,0 @@
-{% extends "_base/attribute.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/backlinks.html.jinja b/src/mkdocstrings_handlers/python/templates/material/backlinks.html.jinja
new file mode 100644
index 00000000..08ba4922
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/backlinks.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/backlinks.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/children.html b/src/mkdocstrings_handlers/python/templates/material/children.html
deleted file mode 100644
index 2c2a73ab..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/children.html
+++ /dev/null
@@ -1 +0,0 @@
-{% extends "_base/children.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/docstring.html b/src/mkdocstrings_handlers/python/templates/material/docstring.html
deleted file mode 100644
index a7ccd66c..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/docstring.html
+++ /dev/null
@@ -1 +0,0 @@
-{% extends "_base/docstring.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/docstring/admonition.html b/src/mkdocstrings_handlers/python/templates/material/docstring/admonition.html
deleted file mode 100644
index e9da5e9a..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/docstring/admonition.html
+++ /dev/null
@@ -1 +0,0 @@
-{% extends "_base/docstring/admonition.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/docstring/attributes.html b/src/mkdocstrings_handlers/python/templates/material/docstring/attributes.html
deleted file mode 100644
index 4ac364b0..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/docstring/attributes.html
+++ /dev/null
@@ -1 +0,0 @@
-{% extends "_base/docstring/attributes.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/docstring/classes.html b/src/mkdocstrings_handlers/python/templates/material/docstring/classes.html
deleted file mode 100644
index 035b3102..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/docstring/classes.html
+++ /dev/null
@@ -1 +0,0 @@
-{% extends "_base/docstring/classes.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/docstring/examples.html b/src/mkdocstrings_handlers/python/templates/material/docstring/examples.html
deleted file mode 100644
index 34e9c4ba..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/docstring/examples.html
+++ /dev/null
@@ -1 +0,0 @@
-{% extends "_base/docstring/examples.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/docstring/functions.html b/src/mkdocstrings_handlers/python/templates/material/docstring/functions.html
deleted file mode 100644
index f3eaed78..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/docstring/functions.html
+++ /dev/null
@@ -1 +0,0 @@
-{% extends "_base/docstring/functions.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/docstring/modules.html b/src/mkdocstrings_handlers/python/templates/material/docstring/modules.html
deleted file mode 100644
index 8ea02a33..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/docstring/modules.html
+++ /dev/null
@@ -1 +0,0 @@
-{% extends "_base/docstring/modules.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/docstring/other_parameters.html b/src/mkdocstrings_handlers/python/templates/material/docstring/other_parameters.html
deleted file mode 100644
index 7c50379b..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/docstring/other_parameters.html
+++ /dev/null
@@ -1 +0,0 @@
-{% extends "_base/docstring/other_parameters.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/docstring/parameters.html b/src/mkdocstrings_handlers/python/templates/material/docstring/parameters.html
deleted file mode 100644
index 70c557fb..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/docstring/parameters.html
+++ /dev/null
@@ -1 +0,0 @@
-{% extends "_base/docstring/parameters.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/docstring/raises.html b/src/mkdocstrings_handlers/python/templates/material/docstring/raises.html
deleted file mode 100644
index f8c3cf03..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/docstring/raises.html
+++ /dev/null
@@ -1 +0,0 @@
-{% extends "_base/docstring/raises.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/docstring/receives.html b/src/mkdocstrings_handlers/python/templates/material/docstring/receives.html
deleted file mode 100644
index 004ff00e..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/docstring/receives.html
+++ /dev/null
@@ -1 +0,0 @@
-{% extends "_base/docstring/receives.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/docstring/returns.html b/src/mkdocstrings_handlers/python/templates/material/docstring/returns.html
deleted file mode 100644
index 979ce9ef..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/docstring/returns.html
+++ /dev/null
@@ -1 +0,0 @@
-{% extends "_base/docstring/returns.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/docstring/type_aliases.html b/src/mkdocstrings_handlers/python/templates/material/docstring/type_aliases.html
new file mode 100644
index 00000000..78bd497a
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/docstring/type_aliases.html
@@ -0,0 +1 @@
+{% extends "_base/docstring/type_aliases.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/docstring/type_aliases.html.jinja b/src/mkdocstrings_handlers/python/templates/material/docstring/type_aliases.html.jinja
new file mode 100644
index 00000000..78bd497a
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/docstring/type_aliases.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/docstring/type_aliases.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/docstring/type_parameters.html b/src/mkdocstrings_handlers/python/templates/material/docstring/type_parameters.html
new file mode 100644
index 00000000..223fbb04
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/docstring/type_parameters.html
@@ -0,0 +1 @@
+{% extends "_base/docstring/type_parameters.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/docstring/type_parameters.html.jinja b/src/mkdocstrings_handlers/python/templates/material/docstring/type_parameters.html.jinja
new file mode 100644
index 00000000..223fbb04
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/docstring/type_parameters.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/docstring/type_parameters.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/docstring/warns.html b/src/mkdocstrings_handlers/python/templates/material/docstring/warns.html
deleted file mode 100644
index bb06cc85..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/docstring/warns.html
+++ /dev/null
@@ -1 +0,0 @@
-{% extends "_base/docstring/warns.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/docstring/yields.html b/src/mkdocstrings_handlers/python/templates/material/docstring/yields.html
deleted file mode 100644
index 717ef5d4..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/docstring/yields.html
+++ /dev/null
@@ -1 +0,0 @@
-{% extends "_base/docstring/yields.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/expression.html b/src/mkdocstrings_handlers/python/templates/material/expression.html
deleted file mode 100644
index 60c64d79..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/expression.html
+++ /dev/null
@@ -1 +0,0 @@
-{% extends "_base/expression.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/function.html b/src/mkdocstrings_handlers/python/templates/material/function.html
deleted file mode 100644
index 54bba061..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/function.html
+++ /dev/null
@@ -1 +0,0 @@
-{% extends "_base/function.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/labels.html b/src/mkdocstrings_handlers/python/templates/material/labels.html
deleted file mode 100644
index 51cb29d6..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/labels.html
+++ /dev/null
@@ -1 +0,0 @@
-{% extends "_base/labels.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/language.html b/src/mkdocstrings_handlers/python/templates/material/language.html
deleted file mode 100644
index b905cff4..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/language.html
+++ /dev/null
@@ -1 +0,0 @@
-{% extends "_base/language.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/languages/en.html b/src/mkdocstrings_handlers/python/templates/material/languages/en.html
deleted file mode 100644
index 931967c1..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/languages/en.html
+++ /dev/null
@@ -1 +0,0 @@
-{% extends "_base/languages/en.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/languages/ja.html b/src/mkdocstrings_handlers/python/templates/material/languages/ja.html
deleted file mode 100644
index 17070edf..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/languages/ja.html
+++ /dev/null
@@ -1 +0,0 @@
-{% extends "_base/languages/ja.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/languages/zh.html b/src/mkdocstrings_handlers/python/templates/material/languages/zh.html
deleted file mode 100644
index e4ea3116..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/languages/zh.html
+++ /dev/null
@@ -1 +0,0 @@
-{% extends "_base/languages/zh.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/module.html b/src/mkdocstrings_handlers/python/templates/material/module.html
deleted file mode 100644
index 9d8efea5..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/module.html
+++ /dev/null
@@ -1 +0,0 @@
-{% extends "_base/module.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/signature.html b/src/mkdocstrings_handlers/python/templates/material/signature.html
deleted file mode 100644
index 33b266c8..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/signature.html
+++ /dev/null
@@ -1 +0,0 @@
-{% extends "_base/signature.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/style.css b/src/mkdocstrings_handlers/python/templates/material/style.css
index 7e819d8b..7bb97041 100644
--- a/src/mkdocstrings_handlers/python/templates/material/style.css
+++ b/src/mkdocstrings_handlers/python/templates/material/style.css
@@ -9,6 +9,11 @@
display: inline;
}
+/* No text transformation from Material for MkDocs for H5 headings. */
+.md-typeset h5 .doc-object-name {
+ text-transform: none;
+}
+
/* Max width for docstring sections tables. */
.doc .md-typeset__table,
.doc .md-typeset__table table {
@@ -21,17 +26,25 @@
}
/* Defaults in Spacy table style. */
-.doc-param-default {
+.doc-param-default,
+.doc-type_param-default {
float: right;
}
/* Parameter headings must be inline, not blocks. */
-.doc-heading-parameter {
+.doc-heading-parameter,
+.doc-heading-type_parameter {
display: inline;
}
+/* Default font size for parameter headings. */
+.md-typeset .doc-heading-parameter {
+ font-size: inherit;
+}
+
/* Prefer space on the right, not the left of parameter permalinks. */
-.doc-heading-parameter .headerlink {
+.doc-heading-parameter .headerlink,
+.doc-heading-type_parameter .headerlink {
margin-left: 0 !important;
margin-right: 0.2rem;
}
@@ -41,37 +54,67 @@
font-weight: bold;
}
+/* Backlinks crumb separator. */
+.doc-backlink-crumb {
+ display: inline-flex;
+ gap: .2rem;
+ white-space: nowrap;
+ align-items: center;
+ vertical-align: middle;
+}
+.doc-backlink-crumb:not(:first-child)::before {
+ background-color: var(--md-default-fg-color--lighter);
+ content: "";
+ display: inline;
+ height: 1rem;
+ --md-path-icon: url('data:image/svg+xml;charset=utf-8,');
+ -webkit-mask-image: var(--md-path-icon);
+ mask-image: var(--md-path-icon);
+ width: 1rem;
+}
+.doc-backlink-crumb.last {
+ font-weight: bold;
+}
+
/* Symbols in Navigation and ToC. */
:root, :host,
[data-md-color-scheme="default"] {
--doc-symbol-parameter-fg-color: #df50af;
+ --doc-symbol-type_parameter-fg-color: #df50af;
--doc-symbol-attribute-fg-color: #953800;
--doc-symbol-function-fg-color: #8250df;
--doc-symbol-method-fg-color: #8250df;
--doc-symbol-class-fg-color: #0550ae;
+ --doc-symbol-type_alias-fg-color: #0550ae;
--doc-symbol-module-fg-color: #5cad0f;
--doc-symbol-parameter-bg-color: #df50af1a;
+ --doc-symbol-type_parameter-bg-color: #df50af1a;
--doc-symbol-attribute-bg-color: #9538001a;
--doc-symbol-function-bg-color: #8250df1a;
--doc-symbol-method-bg-color: #8250df1a;
--doc-symbol-class-bg-color: #0550ae1a;
+ --doc-symbol-type_alias-bg-color: #0550ae1a;
--doc-symbol-module-bg-color: #5cad0f1a;
}
[data-md-color-scheme="slate"] {
--doc-symbol-parameter-fg-color: #ffa8cc;
+ --doc-symbol-type_parameter-fg-color: #ffa8cc;
--doc-symbol-attribute-fg-color: #ffa657;
--doc-symbol-function-fg-color: #d2a8ff;
--doc-symbol-method-fg-color: #d2a8ff;
--doc-symbol-class-fg-color: #79c0ff;
+ --doc-symbol-type_alias-fg-color: #79c0ff;
--doc-symbol-module-fg-color: #baff79;
--doc-symbol-parameter-bg-color: #ffa8cc1a;
+ --doc-symbol-type_parameter-bg-color: #ffa8cc1a;
--doc-symbol-attribute-bg-color: #ffa6571a;
--doc-symbol-function-bg-color: #d2a8ff1a;
--doc-symbol-method-bg-color: #d2a8ff1a;
--doc-symbol-class-bg-color: #79c0ff1a;
+ --doc-symbol-type_alias-bg-color: #79c0ff1a;
--doc-symbol-module-bg-color: #baff791a;
}
@@ -82,7 +125,8 @@ code.doc-symbol {
font-weight: bold;
}
-code.doc-symbol-parameter {
+code.doc-symbol-parameter,
+a code.doc-symbol-parameter {
color: var(--doc-symbol-parameter-fg-color);
background-color: var(--doc-symbol-parameter-bg-color);
}
@@ -91,7 +135,18 @@ code.doc-symbol-parameter::after {
content: "param";
}
-code.doc-symbol-attribute {
+code.doc-symbol-type_parameter,
+a code.doc-symbol-type_parameter {
+ color: var(--doc-symbol-type_parameter-fg-color);
+ background-color: var(--doc-symbol-type_parameter-bg-color);
+}
+
+code.doc-symbol-type_parameter::after {
+ content: "type-param";
+}
+
+code.doc-symbol-attribute,
+a code.doc-symbol-attribute {
color: var(--doc-symbol-attribute-fg-color);
background-color: var(--doc-symbol-attribute-bg-color);
}
@@ -100,7 +155,8 @@ code.doc-symbol-attribute::after {
content: "attr";
}
-code.doc-symbol-function {
+code.doc-symbol-function,
+a code.doc-symbol-function {
color: var(--doc-symbol-function-fg-color);
background-color: var(--doc-symbol-function-bg-color);
}
@@ -109,7 +165,8 @@ code.doc-symbol-function::after {
content: "func";
}
-code.doc-symbol-method {
+code.doc-symbol-method,
+a code.doc-symbol-method {
color: var(--doc-symbol-method-fg-color);
background-color: var(--doc-symbol-method-bg-color);
}
@@ -118,7 +175,8 @@ code.doc-symbol-method::after {
content: "meth";
}
-code.doc-symbol-class {
+code.doc-symbol-class,
+a code.doc-symbol-class {
color: var(--doc-symbol-class-fg-color);
background-color: var(--doc-symbol-class-bg-color);
}
@@ -127,7 +185,19 @@ code.doc-symbol-class::after {
content: "class";
}
-code.doc-symbol-module {
+
+code.doc-symbol-type_alias,
+a code.doc-symbol-type_alias {
+ color: var(--doc-symbol-type_alias-fg-color);
+ background-color: var(--doc-symbol-type_alias-bg-color);
+}
+
+code.doc-symbol-type_alias::after {
+ content: "type";
+}
+
+code.doc-symbol-module,
+a code.doc-symbol-module {
color: var(--doc-symbol-module-fg-color);
background-color: var(--doc-symbol-module-bg-color);
}
@@ -140,3 +210,27 @@ code.doc-symbol-module::after {
color: inherit;
border-bottom: 1px dotted currentcolor;
}
+
+/* Source code blocks (admonitions). */
+:root {
+ --md-admonition-icon--mkdocstrings-source: url('data:image/svg+xml;charset=utf-8,')
+}
+.md-typeset .admonition.mkdocstrings-source,
+.md-typeset details.mkdocstrings-source {
+ border: none;
+ padding: 0;
+}
+.md-typeset .admonition.mkdocstrings-source:focus-within,
+.md-typeset details.mkdocstrings-source:focus-within {
+ box-shadow: none;
+}
+.md-typeset .mkdocstrings-source > .admonition-title,
+.md-typeset .mkdocstrings-source > summary {
+ background-color: inherit;
+}
+.md-typeset .mkdocstrings-source > .admonition-title::before,
+.md-typeset .mkdocstrings-source > summary::before {
+ background-color: var(--md-default-fg-color);
+ -webkit-mask-image: var(--md-admonition-icon--mkdocstrings-source);
+ mask-image: var(--md-admonition-icon--mkdocstrings-source);
+}
diff --git a/src/mkdocstrings_handlers/python/templates/material/summary.html b/src/mkdocstrings_handlers/python/templates/material/summary.html
deleted file mode 100644
index 59eddea0..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/summary.html
+++ /dev/null
@@ -1 +0,0 @@
-{% extends "_base/summary.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/summary/attributes.html b/src/mkdocstrings_handlers/python/templates/material/summary/attributes.html
deleted file mode 100644
index c69755c6..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/summary/attributes.html
+++ /dev/null
@@ -1 +0,0 @@
-{% extends "_base/summary/attributes.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/summary/classes.html b/src/mkdocstrings_handlers/python/templates/material/summary/classes.html
deleted file mode 100644
index 825eb1bb..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/summary/classes.html
+++ /dev/null
@@ -1 +0,0 @@
-{% extends "_base/summary/classes.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/summary/functions.html b/src/mkdocstrings_handlers/python/templates/material/summary/functions.html
deleted file mode 100644
index fc609bda..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/summary/functions.html
+++ /dev/null
@@ -1 +0,0 @@
-{% extends "_base/summary/functions.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/summary/modules.html b/src/mkdocstrings_handlers/python/templates/material/summary/modules.html
deleted file mode 100644
index 46db0023..00000000
--- a/src/mkdocstrings_handlers/python/templates/material/summary/modules.html
+++ /dev/null
@@ -1 +0,0 @@
-{% extends "_base/summary/modules.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/summary/type_aliases.html b/src/mkdocstrings_handlers/python/templates/material/summary/type_aliases.html
new file mode 100644
index 00000000..ca10bc88
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/summary/type_aliases.html
@@ -0,0 +1 @@
+{% extends "_base/summary/type_aliases.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/summary/type_aliases.html.jinja b/src/mkdocstrings_handlers/python/templates/material/summary/type_aliases.html.jinja
new file mode 100644
index 00000000..ca10bc88
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/summary/type_aliases.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/summary/type_aliases.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/type_alias.html b/src/mkdocstrings_handlers/python/templates/material/type_alias.html
new file mode 100644
index 00000000..5139a2db
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/type_alias.html
@@ -0,0 +1 @@
+{% extends "_base/type_alias.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/type_alias.html.jinja b/src/mkdocstrings_handlers/python/templates/material/type_alias.html.jinja
new file mode 100644
index 00000000..5139a2db
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/type_alias.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/type_alias.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/type_parameters.html b/src/mkdocstrings_handlers/python/templates/material/type_parameters.html
new file mode 100644
index 00000000..c39ca528
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/type_parameters.html
@@ -0,0 +1 @@
+{% extends "_base/type_parameters.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/type_parameters.html.jinja b/src/mkdocstrings_handlers/python/templates/material/type_parameters.html.jinja
new file mode 100644
index 00000000..c39ca528
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/material/type_parameters.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/type_parameters.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/_base/class.html b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/class.html
similarity index 100%
rename from src/mkdocstrings_handlers/python/templates/material/_base/class.html
rename to src/mkdocstrings_handlers/python/templates/readthedocs/_base/class.html
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/class.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/class.html.jinja
new file mode 100644
index 00000000..5f011000
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/class.html.jinja
@@ -0,0 +1,239 @@
+{#- Template for Python classes.
+
+This template renders a Python class.
+
+Context:
+ class (griffe.Class): The class to render.
+ root (bool): Whether this is the root object, injected with `:::` in a Markdown page.
+ heading_level (int): The HTML heading level to use.
+ config (dict): The configuration options.
+-#}
+
+{% block logs scoped %}
+ {#- Logging block.
+
+ This block can be used to log debug messages, deprecation messages, warnings, etc.
+ -#}
+ {{ log.debug("Rendering " + class.path) }}
+{% endblock logs %}
+
+
+ {% with obj = class, html_id = class.path %}
+
+ {% if root %}
+ {% set show_full_path = config.show_root_full_path %}
+ {% set root_members = True %}
+ {% elif root_members %}
+ {% set show_full_path = config.show_root_members_full_path or config.show_object_full_path %}
+ {% set root_members = False %}
+ {% else %}
+ {% set show_full_path = config.show_object_full_path %}
+ {% endif %}
+
+ {% set class_name = class.path if show_full_path else class.name %}
+
+ {% if not root or config.show_root_heading %}
+ {% filter heading(
+ heading_level,
+ role="class",
+ id=html_id,
+ class="doc doc-heading",
+ toc_label=(' '|safe if config.show_symbol_type_toc else '') + class.name,
+ ) %}
+
+ {% block heading scoped %}
+ {#- Heading block.
+
+ This block renders the heading for the class.
+ -#}
+ {% if config.show_symbol_type_heading %}{% endif %}
+ {% if config.separate_signature %}
+ {{ class_name }}
+ {% elif config.merge_init_into_class and "__init__" in class.all_members %}
+ {% with function = class.all_members["__init__"] %}
+ {%+ filter highlight(language="python", inline=True) %}
+ {{ class_name }}{% include "signature.html.jinja" with context %}
+ {% endfilter %}
+ {% endwith %}
+ {% else %}
+ {{ class_name }}
+ {% endif %}
+ {% endblock heading %}
+
+ {% block labels scoped %}
+ {#- Labels block.
+
+ This block renders the labels for the class.
+ -#}
+ {% with labels = class.labels %}
+ {% include "labels.html.jinja" with context %}
+ {% endwith %}
+ {% endblock labels %}
+
+ {% endfilter %}
+
+ {% block signature scoped %}
+ {#- Signature block.
+
+ This block renders the signature for the class.
+ -#}
+ {% if config.separate_signature and config.merge_init_into_class %}
+ {% if "__init__" in class.all_members %}
+ {% with function = class.all_members["__init__"] %}
+ {% filter format_signature(function, config.line_length, crossrefs=config.signature_crossrefs) %}
+ {{ class.name }}
+ {% endfilter %}
+ {% endwith %}
+ {% endif %}
+ {% endif %}
+ {% endblock signature %}
+
+ {% else %}
+ {% if config.show_root_toc_entry %}
+ {% filter heading(heading_level,
+ role="class",
+ id=html_id,
+ toc_label=(' '|safe if config.show_symbol_type_toc else '') + class.name,
+ hidden=True,
+ ) %}
+ {% endfilter %}
+ {% endif %}
+ {% set heading_level = heading_level - 1 %}
+ {% endif %}
+
+
+ {% block contents scoped %}
+ {#- Contents block.
+
+ This block renders the contents of the class.
+ It contains other blocks that users can override.
+ Overriding the contents block allows to rearrange the order of the blocks.
+ -#}
+ {% block bases scoped %}
+ {#- Class bases block.
+
+ This block renders the bases for the class.
+ -#}
+ {% if config.show_bases and class.bases %}
+
+ Bases: {% for expression in class.bases -%}
+ {% include "expression.html.jinja" with context %}{% if not loop.last %}, {% endif %}
+ {% endfor -%}
+
+ {% endif %}
+ {% endblock bases %}
+
+ {% block inheritance_diagram scoped %}
+ {#- Inheritance diagram block.
+
+ This block renders the inheritance diagram for the class,
+ using Mermaid syntax and a bit of JavaScript to make the nodes clickable,
+ linking to the corresponding class documentation.
+ -#}
+ {% if config.show_inheritance_diagram and class.bases %}
+ {% macro edges(class) %}
+ {% for base in class.resolved_bases %}
+ {{ base.path }} --> {{ class.path }}
+ {{ edges(base) }}
+ {% endfor %}
+ {% endmacro %}
+
+
+ flowchart {{ config.inheritance_diagram_direction }}
+ {{ class.path }}[{{ class.name }}]
+ {% for base in class.mro() %}
+ {{ base.path }}[{{ base.name }}]
+ {% endfor %}
+
+ {{ edges(class) | safe }}
+
+ click {{ class.path }} href "" "{{ class.path }}"
+ {% for base in class.mro() %}
+ click {{ base.path }} href "" "{{ base.path }}"
+ {% endfor %}
+
+
+ {% endif %}
+ {% endblock inheritance_diagram %}
+
+ {% block docstring scoped %}
+ {#- Docstring block.
+
+ This block renders the docstring for the class.
+ -#}
+ {% with docstring_sections = class.docstring.parsed %}
+ {% include "docstring.html.jinja" with context %}
+ {% endwith %}
+ {% if config.merge_init_into_class %}
+ {% if "__init__" in class.all_members and class.all_members["__init__"].has_docstring %}
+ {% with function = class.all_members["__init__"] %}
+ {% with obj = function, docstring_sections = function.docstring.parsed %}
+ {% include "docstring.html.jinja" with context %}
+ {% endwith %}
+ {% endwith %}
+ {% endif %}
+ {% endif %}
+ {% endblock docstring %}
+
+ {% block summary scoped %}
+ {#- Summary block.
+
+ This block renders auto-summaries for classes, methods, and attributes.
+ -#}
+ {% include "summary.html.jinja" with context %}
+ {% endblock summary %}
+
+ {% block source scoped %}
+ {#- Source block.
+
+ This block renders the source code for the class.
+ -#}
+ {% if config.show_source %}
+ {% if config.merge_init_into_class %}
+ {% if "__init__" in class.all_members and class.all_members["__init__"].source %}
+ {% with init = class.all_members["__init__"] %}
+
+ Source code in {{ init|source_location }}
+ {{ init.source|highlight(language="python", linestart=init.lineno or 0, linenums=True) }}
+
+ {% endwith %}
+ {% endif %}
+ {% elif class.source %}
+
+ Source code in {{ class|source_location }}
+ {{ class.source|highlight(language="python", linestart=class.lineno or 0, linenums=True) }}
+
+ {% endif %}
+ {% endif %}
+ {% endblock source %}
+
+ {% block children scoped %}
+ {#- Children block.
+
+ This block renders the children (members) of the class.
+ -#}
+ {% set root = False %}
+ {% set heading_level = heading_level + 1 %}
+ {% include "children.html.jinja" with context %}
+ {% endblock children %}
+ {% endblock contents %}
+
+
+ {% endwith %}
+
+
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/attributes.html b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/attributes.html
deleted file mode 100644
index cd4b05be..00000000
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/attributes.html
+++ /dev/null
@@ -1,11 +0,0 @@
-{% extends "_base/docstring/attributes.html.jinja" %}
-
-{% block logs scoped %}
- {{ super() }}
- {# TODO: Switch to a warning after some time. #}
- {{ log.info(
- "DeprecationWarning: Extending '_base/docstring/attributes.html' is deprecated, extend '_base/docstring/attributes.html.jinja' instead. " ~
- "After some time, this message will be logged as a warning, causing strict builds to fail.",
- once=True,
- ) }}
-{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/attributes.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/attributes.html.jinja
index ad798971..a3817449 100644
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/attributes.html.jinja
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/attributes.html.jinja
@@ -15,7 +15,7 @@ Context:
{{ log.debug() }}
{% endblock %}
-{% import "language"|get_template as lang with context %}
+{% import "language.html.jinja" as lang with context %}
{#- Language module providing the `t` translation method. -#}
@@ -33,7 +33,7 @@ Context:
{{ attribute.name }}
{% if attribute.annotation %}
{% with expression = attribute.annotation %}
- ({% include "expression"|get_template with context %})
+ ({% include "expression.html.jinja" with context %})
{% endwith %}
{% endif %}
–
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/other_parameters.html b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/other_parameters.html
deleted file mode 100644
index eae60aa7..00000000
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/other_parameters.html
+++ /dev/null
@@ -1,11 +0,0 @@
-{% extends "_base/docstring/other_parameters.html.jinja" %}
-
-{% block logs scoped %}
- {{ super() }}
- {# TODO: Switch to a warning after some time. #}
- {{ log.info(
- "DeprecationWarning: Extending '_base/docstring/other_parameters.html' is deprecated, extend '_base/docstring/other_parameters.html.jinja' instead. " ~
- "After some time, this message will be logged as a warning, causing strict builds to fail.",
- once=True,
- ) }}
-{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/other_parameters.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/other_parameters.html.jinja
index beb4f678..f7af2121 100644
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/other_parameters.html.jinja
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/other_parameters.html.jinja
@@ -15,7 +15,7 @@ Context:
{{ log.debug() }}
{% endblock %}
-{% import "language"|get_template as lang with context %}
+{% import "language.html.jinja" as lang with context %}
{#- Language module providing the `t` translation method. -#}
@@ -32,8 +32,8 @@ Context:
{{ parameter.name }}
{% if parameter.annotation %}
- {% with expression = parameter.annotation %}
- ({% include "expression"|get_template with context %})
+ {% with expression = parameter.annotation, backlink_type = "used-by" %}
+ ({% include "expression.html.jinja" with context %})
{% endwith %}
{% endif %}
–
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/parameters.html b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/parameters.html
deleted file mode 100644
index f5745464..00000000
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/parameters.html
+++ /dev/null
@@ -1,11 +0,0 @@
-{% extends "_base/docstring/parameters.html.jinja" %}
-
-{% block logs scoped %}
- {{ super() }}
- {# TODO: Switch to a warning after some time. #}
- {{ log.info(
- "DeprecationWarning: Extending '_base/docstring/parameters.html' is deprecated, extend '_base/docstring/parameters.html.jinja' instead. " ~
- "After some time, this message will be logged as a warning, causing strict builds to fail.",
- once=True,
- ) }}
-{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/parameters.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/parameters.html.jinja
index 295ab082..95c480fa 100644
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/parameters.html.jinja
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/parameters.html.jinja
@@ -15,7 +15,7 @@ Context:
{{ log.debug() }}
{% endblock %}
-{% import "language"|get_template as lang with context %}
+{% import "language.html.jinja" as lang with context %}
{#- Language module providing the `t` translation method. -#}
@@ -32,11 +32,11 @@ Context:
{{ parameter.name }}
{% if parameter.annotation %}
- {% with expression = parameter.annotation %}
- ({% include "expression"|get_template with context %}
+ {% with expression = parameter.annotation, backlink_type = "used-by" %}
+ ({% include "expression.html.jinja" with context %}
{%- if parameter.default %}, {{ lang.t("default:") }}
- {% with expression = parameter.default %}
- {% include "expression"|get_template with context %}
+ {% with expression = parameter.default, backlink_type = "used-by" %}
+ {% include "expression.html.jinja" with context %}
{% endwith %}
{% endif %})
{% endwith %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/raises.html b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/raises.html
deleted file mode 100644
index 361b9732..00000000
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/raises.html
+++ /dev/null
@@ -1,11 +0,0 @@
-{% extends "_base/docstring/raises.html.jinja" %}
-
-{% block logs scoped %}
- {{ super() }}
- {# TODO: Switch to a warning after some time. #}
- {{ log.info(
- "DeprecationWarning: Extending '_base/docstring/raises.html' is deprecated, extend '_base/docstring/raises.html.jinja' instead. " ~
- "After some time, this message will be logged as a warning, causing strict builds to fail.",
- once=True,
- ) }}
-{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/raises.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/raises.html.jinja
index 7fa8cd86..71beb34c 100644
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/raises.html.jinja
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/raises.html.jinja
@@ -15,7 +15,7 @@ Context:
{{ log.debug() }}
{% endblock %}
-{% import "language"|get_template as lang with context %}
+{% import "language.html.jinja" as lang with context %}
{#- Language module providing the `t` translation method. -#}
@@ -31,8 +31,8 @@ Context:
{% for raises in section.value %}
{% if raises.annotation %}
- {% with expression = raises.annotation %}
- {% include "expression"|get_template with context %}
+ {% with expression = raises.annotation, backlink_type = "raised-by" %}
+ {% include "expression.html.jinja" with context %}
{% endwith %}
{% endif %}
–
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/receives.html b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/receives.html
deleted file mode 100644
index e5a115c1..00000000
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/receives.html
+++ /dev/null
@@ -1,11 +0,0 @@
-{% extends "_base/docstring/receives.html.jinja" %}
-
-{% block logs scoped %}
- {{ super() }}
- {# TODO: Switch to a warning after some time. #}
- {{ log.info(
- "DeprecationWarning: Extending '_base/docstring/receives.html' is deprecated, extend '_base/docstring/receives.html.jinja' instead. " ~
- "After some time, this message will be logged as a warning, causing strict builds to fail.",
- once=True,
- ) }}
-{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/receives.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/receives.html.jinja
index 9ee189bc..8ad9cae3 100644
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/receives.html.jinja
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/receives.html.jinja
@@ -15,7 +15,7 @@ Context:
{{ log.debug() }}
{% endblock %}
-{% import "language"|get_template as lang with context %}
+{% import "language.html.jinja" as lang with context %}
{#- Language module providing the `t` translation method. -#}
@@ -32,9 +32,9 @@ Context:
{% if receives.name %}{{ receives.name }}{% endif %}
{% if receives.annotation %}
- {% with expression = receives.annotation %}
+ {% with expression = receives.annotation, backlink_type = "received-by" %}
{% if receives.name %}({% endif %}
- {% include "expression"|get_template with context %}
+ {% include "expression.html.jinja" with context %}
{% if receives.name %}){% endif %}
{% endwith %}
{% endif %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/returns.html b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/returns.html
deleted file mode 100644
index 0e7807ac..00000000
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/returns.html
+++ /dev/null
@@ -1,11 +0,0 @@
-{% extends "_base/docstring/returns.html.jinja" %}
-
-{% block logs scoped %}
- {{ super() }}
- {# TODO: Switch to a warning after some time. #}
- {{ log.info(
- "DeprecationWarning: Extending '_base/docstring/returns.html' is deprecated, extend '_base/docstring/returns.html.jinja' instead. " ~
- "After some time, this message will be logged as a warning, causing strict builds to fail.",
- once=True,
- ) }}
-{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/returns.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/returns.html.jinja
index 2dbd21af..2201f545 100644
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/returns.html.jinja
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/returns.html.jinja
@@ -15,7 +15,7 @@ Context:
{{ log.debug() }}
{% endblock %}
-{% import "language"|get_template as lang with context %}
+{% import "language.html.jinja" as lang with context %}
{#- Language module providing the `t` translation method. -#}
@@ -32,9 +32,9 @@ Context:
{% if returns.name %}{{ returns.name }}{% endif %}
{% if returns.annotation %}
- {% with expression = returns.annotation %}
+ {% with expression = returns.annotation, backlink_type = "returned-by" %}
{% if returns.name %}({% endif %}
- {% include "expression"|get_template with context %}
+ {% include "expression.html.jinja" with context %}
{% if returns.name %}){% endif %}
{% endwith %}
{% endif %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/warns.html b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/warns.html
deleted file mode 100644
index b7b937a9..00000000
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/warns.html
+++ /dev/null
@@ -1,11 +0,0 @@
-{% extends "_base/docstring/warns.html.jinja" %}
-
-{% block logs scoped %}
- {{ super() }}
- {# TODO: Switch to a warning after some time. #}
- {{ log.info(
- "DeprecationWarning: Extending '_base/docstring/warns.html' is deprecated, extend '_base/docstring/warns.html.jinja' instead. " ~
- "After some time, this message will be logged as a warning, causing strict builds to fail.",
- once=True,
- ) }}
-{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/warns.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/warns.html.jinja
index 61f3c839..97cbc1de 100644
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/warns.html.jinja
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/warns.html.jinja
@@ -15,7 +15,7 @@ Context:
{{ log.debug() }}
{% endblock %}
-{% import "language"|get_template as lang with context %}
+{% import "language.html.jinja" as lang with context %}
{#- Language module providing the `t` translation method. -#}
@@ -31,8 +31,8 @@ Context:
{% for warns in section.value %}
{% if warns.annotation %}
- {% with expression = warns.annotation %}
- {% include "expression"|get_template with context %}
+ {% with expression = warns.annotation, backlink_type = "emitted-by" %}
+ {% include "expression.html.jinja" with context %}
{% endwith %}
{% endif %}
–
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/yields.html b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/yields.html
deleted file mode 100644
index ecd6f513..00000000
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/yields.html
+++ /dev/null
@@ -1,11 +0,0 @@
-{% extends "_base/docstring/yields.html.jinja" %}
-
-{% block logs scoped %}
- {{ super() }}
- {# TODO: Switch to a warning after some time. #}
- {{ log.info(
- "DeprecationWarning: Extending '_base/docstring/yields.html' is deprecated, extend '_base/docstring/yields.html.jinja' instead. " ~
- "After some time, this message will be logged as a warning, causing strict builds to fail.",
- once=True,
- ) }}
-{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/yields.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/yields.html.jinja
index 0fa6fcbc..8298421f 100644
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/yields.html.jinja
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/docstring/yields.html.jinja
@@ -15,7 +15,7 @@ Context:
{{ log.debug() }}
{% endblock %}
-{% import "language"|get_template as lang with context %}
+{% import "language.html.jinja" as lang with context %}
{#- Language module providing the `t` translation method. -#}
@@ -32,9 +32,9 @@ Context:
{% if yields.name %}{{ yields.name }}{% endif %}
{% if yields.annotation %}
- {% with expression = yields.annotation %}
+ {% with expression = yields.annotation, backlink_type = "yielded-by" %}
{% if yields.name %}({% endif %}
- {% include "expression"|get_template with context %}
+ {% include "expression.html.jinja" with context %}
{% if yields.name %}){% endif %}
{% endwith %}
{% endif %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/language.html b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/language.html
deleted file mode 100644
index c97d0c31..00000000
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/language.html
+++ /dev/null
@@ -1,11 +0,0 @@
-{% extends "_base/language.html.jinja" %}
-
-{% block logs scoped %}
- {{ super() }}
- {# TODO: Switch to a warning after some time. #}
- {{ log.info(
- "DeprecationWarning: Extending '_base/language.html' is deprecated, extend '_base/language.html.jinja' instead. " ~
- "After some time, this message will be logged as a warning, causing strict builds to fail.",
- once=True,
- ) }}
-{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/language.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/language.html.jinja
index 21163f47..31ecfdd6 100644
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/language.html.jinja
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/language.html.jinja
@@ -7,12 +7,12 @@
-#}
{% endblock logs %}
-{% set lang_pth = "languages/" ~ locale | get_template %}
+{% set lang_pth = "languages/" ~ locale ~ ".html.jinja" %}
{% if lang_pth is existing_template %}
{% import lang_pth as lang %}
- {% import "languages/en"|get_template as fallback %}
+ {% import "languages/en.html.jinja" as fallback %}
{% macro t(key) %}{{ lang.t(key) or fallback.t(key) }}{% endmacro %}
{% else %}
- {% import "languages/en"|get_template as lang %}
+ {% import "languages/en.html.jinja" as lang %}
{% macro t(key) %}{{ lang.t(key) }}{% endmacro %}
{% endif %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/languages/en.html b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/languages/en.html
deleted file mode 100644
index eab87415..00000000
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/languages/en.html
+++ /dev/null
@@ -1,11 +0,0 @@
-{% extends "_base/languages/en.html.jinja" %}
-
-{% block logs scoped %}
- {{ super() }}
- {# TODO: Switch to a warning after some time. #}
- {{ log.info(
- "DeprecationWarning: Extending '_base/languages/en.html' is deprecated, extend '_base/languages/en.html.jinja' instead. " ~
- "After some time, this message will be logged as a warning, causing strict builds to fail.",
- once=True,
- ) }}
-{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/languages/ja.html b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/languages/ja.html
deleted file mode 100644
index 14319499..00000000
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/languages/ja.html
+++ /dev/null
@@ -1,11 +0,0 @@
-{% extends "_base/languages/ja.html.jinja" %}
-
-{% block logs scoped %}
- {{ super() }}
- {# TODO: Switch to a warning after some time. #}
- {{ log.info(
- "DeprecationWarning: Extending '_base/languages/ja.html' is deprecated, extend '_base/languages/ja.html.jinja' instead. " ~
- "After some time, this message will be logged as a warning, causing strict builds to fail.",
- once=True,
- ) }}
-{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/languages/zh.html b/src/mkdocstrings_handlers/python/templates/readthedocs/_base/languages/zh.html
deleted file mode 100644
index 0b281195..00000000
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/_base/languages/zh.html
+++ /dev/null
@@ -1,11 +0,0 @@
-{% extends "_base/languages/zh.html.jinja" %}
-
-{% block logs scoped %}
- {{ super() }}
- {# TODO: Switch to a warning after some time. #}
- {{ log.info(
- "DeprecationWarning: Extending '_base/languages/zh.html' is deprecated, extend '_base/languages/zh.html.jinja' instead. " ~
- "After some time, this message will be logged as a warning, causing strict builds to fail.",
- once=True,
- ) }}
-{% endblock logs %}
diff --git a/src/mkdocstrings_handlers/python/templates/material/class.html b/src/mkdocstrings_handlers/python/templates/readthedocs/class.html
similarity index 100%
rename from src/mkdocstrings_handlers/python/templates/material/class.html
rename to src/mkdocstrings_handlers/python/templates/readthedocs/class.html
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/class.html.jinja b/src/mkdocstrings_handlers/python/templates/readthedocs/class.html.jinja
new file mode 100644
index 00000000..5e7329df
--- /dev/null
+++ b/src/mkdocstrings_handlers/python/templates/readthedocs/class.html.jinja
@@ -0,0 +1 @@
+{% extends "_base/class.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/attributes.html b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/attributes.html
deleted file mode 100644
index 4ac364b0..00000000
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/attributes.html
+++ /dev/null
@@ -1 +0,0 @@
-{% extends "_base/docstring/attributes.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/other_parameters.html b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/other_parameters.html
deleted file mode 100644
index 7c50379b..00000000
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/other_parameters.html
+++ /dev/null
@@ -1 +0,0 @@
-{% extends "_base/docstring/other_parameters.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/parameters.html b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/parameters.html
deleted file mode 100644
index 70c557fb..00000000
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/parameters.html
+++ /dev/null
@@ -1 +0,0 @@
-{% extends "_base/docstring/parameters.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/raises.html b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/raises.html
deleted file mode 100644
index f8c3cf03..00000000
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/raises.html
+++ /dev/null
@@ -1 +0,0 @@
-{% extends "_base/docstring/raises.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/receives.html b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/receives.html
deleted file mode 100644
index 004ff00e..00000000
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/receives.html
+++ /dev/null
@@ -1 +0,0 @@
-{% extends "_base/docstring/receives.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/returns.html b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/returns.html
deleted file mode 100644
index 979ce9ef..00000000
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/returns.html
+++ /dev/null
@@ -1 +0,0 @@
-{% extends "_base/docstring/returns.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/warns.html b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/warns.html
deleted file mode 100644
index bb06cc85..00000000
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/warns.html
+++ /dev/null
@@ -1 +0,0 @@
-{% extends "_base/docstring/warns.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/yields.html b/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/yields.html
deleted file mode 100644
index 717ef5d4..00000000
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/yields.html
+++ /dev/null
@@ -1 +0,0 @@
-{% extends "_base/docstring/yields.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/language.html b/src/mkdocstrings_handlers/python/templates/readthedocs/language.html
deleted file mode 100644
index b905cff4..00000000
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/language.html
+++ /dev/null
@@ -1 +0,0 @@
-{% extends "_base/language.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/languages/en.html b/src/mkdocstrings_handlers/python/templates/readthedocs/languages/en.html
deleted file mode 100644
index 931967c1..00000000
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/languages/en.html
+++ /dev/null
@@ -1 +0,0 @@
-{% extends "_base/languages/en.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/languages/ja.html b/src/mkdocstrings_handlers/python/templates/readthedocs/languages/ja.html
deleted file mode 100644
index 17070edf..00000000
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/languages/ja.html
+++ /dev/null
@@ -1 +0,0 @@
-{% extends "_base/languages/ja.html.jinja" %}
diff --git a/src/mkdocstrings_handlers/python/templates/readthedocs/languages/zh.html b/src/mkdocstrings_handlers/python/templates/readthedocs/languages/zh.html
deleted file mode 100644
index e4ea3116..00000000
--- a/src/mkdocstrings_handlers/python/templates/readthedocs/languages/zh.html
+++ /dev/null
@@ -1 +0,0 @@
-{% extends "_base/languages/zh.html.jinja" %}
diff --git a/tests/conftest.py b/tests/conftest.py
index 1c53cba4..926c4b83 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -15,9 +15,9 @@
from markdown.core import Markdown
from mkdocs.config.defaults import MkDocsConfig
- from mkdocstrings.plugin import MkdocstringsPlugin
+ from mkdocstrings import MkdocstringsPlugin
- from mkdocstrings_handlers.python.handler import PythonHandler
+ from mkdocstrings_handlers.python import PythonHandler
# --------------------------------------------
diff --git a/tests/helpers.py b/tests/helpers.py
index 37c127e4..d7fb7e1d 100644
--- a/tests/helpers.py
+++ b/tests/helpers.py
@@ -14,9 +14,9 @@
from pathlib import Path
import pytest
- from mkdocstrings.plugin import MkdocstringsPlugin
+ from mkdocstrings import MkdocstringsPlugin
- from mkdocstrings_handlers.python.handler import PythonHandler
+ from mkdocstrings_handlers.python import PythonHandler
@contextmanager
diff --git a/tests/snapshots/__init__.py b/tests/snapshots/__init__.py
deleted file mode 100644
index 4469afed..00000000
--- a/tests/snapshots/__init__.py
+++ /dev/null
@@ -1,405 +0,0 @@
-"""Snaphots for the inline-snapshot pytest plugin."""
-
-from inline_snapshot import external, snapshot
-
-snapshots_signatures = snapshot(
- {
- (
- ("separate_signature", True),
- ("show_signature_annotations", False),
- ("signature_crossrefs", False),
- ): external("4370d843cc76*.html"),
- (
- ("separate_signature", True),
- ("show_signature_annotations", True),
- ("signature_crossrefs", True),
- ): external("955e5111f426*.html"),
- (
- ("separate_signature", False),
- ("show_signature_annotations", True),
- ("signature_crossrefs", True),
- ): external("735fc6ffdb82*.html"),
- (
- ("separate_signature", False),
- ("show_signature_annotations", False),
- ("signature_crossrefs", True),
- ): external("6a02b544c12c*.html"),
- (
- ("separate_signature", False),
- ("show_signature_annotations", False),
- ("signature_crossrefs", False),
- ): external("b060b701543e*.html"),
- (
- ("separate_signature", True),
- ("show_signature_annotations", True),
- ("signature_crossrefs", False),
- ): external("f5ce06acbb7a*.html"),
- (
- ("separate_signature", True),
- ("show_signature_annotations", False),
- ("signature_crossrefs", True),
- ): external("9c0bfc0ee407*.html"),
- (
- ("separate_signature", False),
- ("show_signature_annotations", True),
- ("signature_crossrefs", False),
- ): external("d1216ebf8e30*.html"),
- },
-)
-
-snapshots_members = snapshot(
- {
- (
- ("filters", ()),
- ("inherited_members", ("method1",)),
- ("members", False),
- ): external("ab0ddac637b5*.html"),
- (("filters", None), ("inherited_members", True), ("members", True)): external(
- "0b1372d7f7c0*.html",
- ),
- (("filters", ()), ("inherited_members", False), ("members", True)): external(
- "59a9e1ffb2f0*.html",
- ),
- (
- ("filters", ("!module_attribute",)),
- ("inherited_members", ()),
- ("members", ("module_attribute",)),
- ): external("6d12192d6b4d*.html"),
- (("filters", ()), ("inherited_members", ()), ("members", False)): external(
- "366b0537fe06*.html",
- ),
- (
- ("filters", ()),
- ("inherited_members", ("method1",)),
- ("members", ("module_attribute",)),
- ): external("e90c3e0c85dd*.html"),
- (("filters", ()), ("inherited_members", True), ("members", True)): external(
- "e8be7a9b1410*.html",
- ),
- (
- ("filters", ("module_attribute",)),
- ("inherited_members", ("method1",)),
- ("members", ()),
- ): external("f8f32ea6a0c8*.html"),
- (
- ("filters", ()),
- ("inherited_members", ("method1",)),
- ("members", True),
- ): external("d540895f6bf9*.html"),
- (("filters", ()), ("inherited_members", False), ("members", False)): external(
- "5cf0130e3b4f*.html",
- ),
- (
- ("filters", ("!module_attribute",)),
- ("inherited_members", True),
- ("members", True),
- ): external("7c988c9e13ef*.html"),
- (
- ("filters", ("!module_attribute",)),
- ("inherited_members", False),
- ("members", ()),
- ): external("fb5ebb7546d8*.html"),
- (
- ("filters", None),
- ("inherited_members", ("method1",)),
- ("members", ("module_attribute",)),
- ): external("afd5c166367d*.html"),
- (
- ("filters", ("!module_attribute",)),
- ("inherited_members", ("method1",)),
- ("members", ("module_attribute",)),
- ): external("26bc66c2ba29*.html"),
- (
- ("filters", ("!module_attribute",)),
- ("inherited_members", False),
- ("members", ("module_attribute",)),
- ): external("247a6063b698*.html"),
- (
- ("filters", ("module_attribute",)),
- ("inherited_members", False),
- ("members", ("module_attribute",)),
- ): external("5a9c10410801*.html"),
- (("filters", ()), ("inherited_members", False), ("members", ())): external(
- "fba0d78ae23e*.html",
- ),
- (
- ("filters", ("module_attribute",)),
- ("inherited_members", ("method1",)),
- ("members", None),
- ): external("cfcd41685591*.html"),
- (("filters", ()), ("inherited_members", False), ("members", None)): external(
- "a2c5be9bd5d1*.html",
- ),
- (
- ("filters", ("module_attribute",)),
- ("inherited_members", ()),
- ("members", False),
- ): external("76ee8e01e1c0*.html"),
- (
- ("filters", ("!module_attribute",)),
- ("inherited_members", ("method1",)),
- ("members", ()),
- ): external("42c053a5e567*.html"),
- (
- ("filters", None),
- ("inherited_members", ("method1",)),
- ("members", ()),
- ): external("4f60da13e2d4*.html"),
- (("filters", ()), ("inherited_members", True), ("members", ())): external(
- "c915eb92fd5d*.html",
- ),
- (
- ("filters", ("module_attribute",)),
- ("inherited_members", ()),
- ("members", None),
- ): external("c9a15552eed3*.html"),
- (
- ("filters", ("!module_attribute",)),
- ("inherited_members", ("method1",)),
- ("members", None),
- ): external("3d072a22b951*.html"),
- (("filters", None), ("inherited_members", False), ("members", False)): external(
- "9bd282a6f2fe*.html",
- ),
- (
- ("filters", None),
- ("inherited_members", ()),
- ("members", ("module_attribute",)),
- ): external("166b8dfab738*.html"),
- (("filters", None), ("inherited_members", ()), ("members", False)): external(
- "44e42f27bfe3*.html",
- ),
- (("filters", None), ("inherited_members", False), ("members", None)): external(
- "f7711b8af768*.html",
- ),
- (
- ("filters", ("!module_attribute",)),
- ("inherited_members", True),
- ("members", ()),
- ): external("28d8862dd086*.html"),
- (
- ("filters", ("module_attribute",)),
- ("inherited_members", True),
- ("members", False),
- ): external("f3f3acb6b51b*.html"),
- (("filters", None), ("inherited_members", ()), ("members", True)): external(
- "347d4ffe2cb3*.html",
- ),
- (
- ("filters", ("!module_attribute",)),
- ("inherited_members", True),
- ("members", None),
- ): external("ba51e100acd4*.html"),
- (
- ("filters", ("!module_attribute",)),
- ("inherited_members", False),
- ("members", False),
- ): external("eee65d3705a6*.html"),
- (
- ("filters", None),
- ("inherited_members", False),
- ("members", ("module_attribute",)),
- ): external("a200913d9a7d*.html"),
- (
- ("filters", None),
- ("inherited_members", True),
- ("members", ("module_attribute",)),
- ): external("bd6594ae3b51*.html"),
- (
- ("filters", ("module_attribute",)),
- ("inherited_members", True),
- ("members", ("module_attribute",)),
- ): external("8d4e1f9af997*.html"),
- (
- ("filters", ("module_attribute",)),
- ("inherited_members", False),
- ("members", ()),
- ): external("d5a6bf59c663*.html"),
- (("filters", None), ("inherited_members", ()), ("members", None)): external(
- "88855b028417*.html",
- ),
- (("filters", ()), ("inherited_members", True), ("members", None)): external(
- "981438492e38*.html",
- ),
- (
- ("filters", ()),
- ("inherited_members", False),
- ("members", ("module_attribute",)),
- ): external("09d96d69d9dc*.html"),
- (
- ("filters", None),
- ("inherited_members", ("method1",)),
- ("members", None),
- ): external("ae74b5980f9b*.html"),
- (
- ("filters", ("module_attribute",)),
- ("inherited_members", True),
- ("members", ()),
- ): external("95f8e480937f*.html"),
- (("filters", None), ("inherited_members", False), ("members", True)): external(
- "831198033381*.html",
- ),
- (
- ("filters", ("module_attribute",)),
- ("inherited_members", True),
- ("members", True),
- ): external("052c34f22e4c*.html"),
- (
- ("filters", ("!module_attribute",)),
- ("inherited_members", False),
- ("members", None),
- ): external("cdc8126d78b6*.html"),
- (
- ("filters", ("module_attribute",)),
- ("inherited_members", ("method1",)),
- ("members", False),
- ): external("f0014d9505ec*.html"),
- (
- ("filters", ("!module_attribute",)),
- ("inherited_members", True),
- ("members", ("module_attribute",)),
- ): external("96cf94f4822a*.html"),
- (("filters", None), ("inherited_members", True), ("members", ())): external(
- "ce06da7f07b3*.html",
- ),
- (
- ("filters", ("!module_attribute",)),
- ("inherited_members", ()),
- ("members", False),
- ): external("74bfab19cbd4*.html"),
- (
- ("filters", None),
- ("inherited_members", ("method1",)),
- ("members", True),
- ): external("7d5fe6653919*.html"),
- (
- ("filters", ("!module_attribute",)),
- ("inherited_members", True),
- ("members", False),
- ): external("d726cb8367d9*.html"),
- (("filters", None), ("inherited_members", False), ("members", ())): external(
- "fb770e6537bc*.html",
- ),
- (
- ("filters", ("module_attribute",)),
- ("inherited_members", True),
- ("members", None),
- ): external("2bf34b4dd82e*.html"),
- (
- ("filters", ()),
- ("inherited_members", ("method1",)),
- ("members", ()),
- ): external("4892e0fe1920*.html"),
- (
- ("filters", ("module_attribute",)),
- ("inherited_members", ()),
- ("members", True),
- ): external("46e56f39b10d*.html"),
- (
- ("filters", ()),
- ("inherited_members", ()),
- ("members", ("module_attribute",)),
- ): external("388a13d71284*.html"),
- (("filters", None), ("inherited_members", True), ("members", False)): external(
- "3f5d794823a4*.html",
- ),
- (
- ("filters", ()),
- ("inherited_members", True),
- ("members", ("module_attribute",)),
- ): external("9d03089a46fa*.html"),
- (
- ("filters", ("module_attribute",)),
- ("inherited_members", ("method1",)),
- ("members", ("module_attribute",)),
- ): external("8b097c69ac2f*.html"),
- (
- ("filters", ("module_attribute",)),
- ("inherited_members", False),
- ("members", True),
- ): external("052e71e7e9d5*.html"),
- (
- ("filters", None),
- ("inherited_members", ("method1",)),
- ("members", False),
- ): external("e3defc3620e5*.html"),
- (
- ("filters", ("!module_attribute",)),
- ("inherited_members", ()),
- ("members", True),
- ): external("b4b490164ab1*.html"),
- (
- ("filters", ("!module_attribute",)),
- ("inherited_members", ("method1",)),
- ("members", False),
- ): external("c6e7ef9564cd*.html"),
- (
- ("filters", ("module_attribute",)),
- ("inherited_members", False),
- ("members", None),
- ): external("62e18d3e5777*.html"),
- (
- ("filters", ("!module_attribute",)),
- ("inherited_members", ()),
- ("members", None),
- ): external("728c13446301*.html"),
- (("filters", None), ("inherited_members", ()), ("members", ())): external(
- "f77f1c850398*.html",
- ),
- (
- ("filters", ("!module_attribute",)),
- ("inherited_members", False),
- ("members", True),
- ): external("0fac4f5e7f45*.html"),
- (("filters", None), ("inherited_members", True), ("members", None)): external(
- "cc19537fdba4*.html",
- ),
- (("filters", ()), ("inherited_members", ()), ("members", None)): external(
- "e6a9b76f268c*.html",
- ),
- (
- ("filters", ("!module_attribute",)),
- ("inherited_members", ()),
- ("members", ()),
- ): external("c260e7f4ef3b*.html"),
- (
- ("filters", ("!module_attribute",)),
- ("inherited_members", ("method1",)),
- ("members", True),
- ): external("0c2924ff976f*.html"),
- (
- ("filters", ("module_attribute",)),
- ("inherited_members", ()),
- ("members", ("module_attribute",)),
- ): external("f6e292b8358a*.html"),
- (("filters", ()), ("inherited_members", True), ("members", False)): external(
- "b0a9b08f1f72*.html",
- ),
- (("filters", ()), ("inherited_members", ()), ("members", True)): external(
- "fb65efbbfc3e*.html",
- ),
- (
- ("filters", ("module_attribute",)),
- ("inherited_members", False),
- ("members", False),
- ): external("710706687213*.html"),
- (("filters", ()), ("inherited_members", ()), ("members", ())): external(
- "11598fec2d07*.html",
- ),
- (
- ("filters", ("module_attribute",)),
- ("inherited_members", ("method1",)),
- ("members", True),
- ): external("a1167b14f5a7*.html"),
- (
- ("filters", ()),
- ("inherited_members", ("method1",)),
- ("members", None),
- ): external("f848d4a9e516*.html"),
- (
- ("filters", ("module_attribute",)),
- ("inherited_members", ()),
- ("members", ()),
- ): external("a185e216dc7b*.html"),
- },
-)
diff --git a/tests/snapshots/external/.gitignore b/tests/snapshots/external/.gitignore
deleted file mode 100644
index 45bef68b..00000000
--- a/tests/snapshots/external/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-# ignore all snapshots which are not refered in the source
-*-new.*
diff --git a/tests/snapshots/headings/heading=,separate_signature=False.html b/tests/snapshots/headings/heading=,separate_signature=False.html
new file mode 100644
index 00000000..2be154b9
--- /dev/null
+++ b/tests/snapshots/headings/heading=,separate_signature=False.html
@@ -0,0 +1,18 @@
+
+
+
+
+
+ headings_package
+
+
+
+
+
+
+
diff --git a/tests/snapshots/headings/heading=,separate_signature=True.html b/tests/snapshots/headings/heading=,separate_signature=True.html
new file mode 100644
index 00000000..c73f0184
--- /dev/null
+++ b/tests/snapshots/headings/heading=,separate_signature=True.html
@@ -0,0 +1,18 @@
+
+
+
+
+
+ headings_package
+
+
+
+
+
+
+
diff --git a/tests/snapshots/headings/heading=Some heading,separate_signature=False.html b/tests/snapshots/headings/heading=Some heading,separate_signature=False.html
new file mode 100644
index 00000000..b000bf14
--- /dev/null
+++ b/tests/snapshots/headings/heading=Some heading,separate_signature=False.html
@@ -0,0 +1,16 @@
+
+
+
+
+ Some heading
+
+
+
+
+
+
diff --git a/tests/snapshots/headings/heading=Some heading,separate_signature=True.html b/tests/snapshots/headings/heading=Some heading,separate_signature=True.html
new file mode 100644
index 00000000..852b7487
--- /dev/null
+++ b/tests/snapshots/headings/heading=Some heading,separate_signature=True.html
@@ -0,0 +1,16 @@
+
+
+
+
+ Some heading
+
+
+
+
+
+
diff --git a/tests/snapshots/external/26bc66c2ba29feddfbd06c2490eca42ec5a8f62db8d650231b0748ddce8c85f1.html b/tests/snapshots/members/filters=('!module_attribute',),inherited_members=('method1',),members=('module_attribute',).html
similarity index 100%
rename from tests/snapshots/external/26bc66c2ba29feddfbd06c2490eca42ec5a8f62db8d650231b0748ddce8c85f1.html
rename to tests/snapshots/members/filters=('!module_attribute',),inherited_members=('method1',),members=('module_attribute',).html
diff --git a/tests/snapshots/external/42c053a5e567a777dfde62cd0d061112dc8098f90e71f71d5aceba8be188fcf7.html b/tests/snapshots/members/filters=('!module_attribute',),inherited_members=('method1',),members=().html
similarity index 100%
rename from tests/snapshots/external/42c053a5e567a777dfde62cd0d061112dc8098f90e71f71d5aceba8be188fcf7.html
rename to tests/snapshots/members/filters=('!module_attribute',),inherited_members=('method1',),members=().html
diff --git a/tests/snapshots/external/c6e7ef9564cdc8449a98c0ef790d652dee02c47b1339f858fc1d7a54aae9ed46.html b/tests/snapshots/members/filters=('!module_attribute',),inherited_members=('method1',),members=False.html
similarity index 100%
rename from tests/snapshots/external/c6e7ef9564cdc8449a98c0ef790d652dee02c47b1339f858fc1d7a54aae9ed46.html
rename to tests/snapshots/members/filters=('!module_attribute',),inherited_members=('method1',),members=False.html
diff --git a/tests/snapshots/external/3d072a22b9513eecb51c6a5f39b978c1c1d3ef56a572031a307fe1cad1f17eff.html b/tests/snapshots/members/filters=('!module_attribute',),inherited_members=('method1',),members=None.html
similarity index 97%
rename from tests/snapshots/external/3d072a22b9513eecb51c6a5f39b978c1c1d3ef56a572031a307fe1cad1f17eff.html
rename to tests/snapshots/members/filters=('!module_attribute',),inherited_members=('method1',),members=None.html
index f950f69b..dce4e148 100644
--- a/tests/snapshots/external/3d072a22b9513eecb51c6a5f39b978c1c1d3ef56a572031a307fe1cad1f17eff.html
+++ b/tests/snapshots/members/filters=('!module_attribute',),inherited_members=('method1',),members=None.html
@@ -237,7 +237,7 @@
Bases:
-
+
Class
diff --git a/tests/snapshots/external/0c2924ff976fa0e32ba66558a4f9e1eff4cd66196506a37977cdb33325a50718.html b/tests/snapshots/members/filters=('!module_attribute',),inherited_members=('method1',),members=True.html
similarity index 98%
rename from tests/snapshots/external/0c2924ff976fa0e32ba66558a4f9e1eff4cd66196506a37977cdb33325a50718.html
rename to tests/snapshots/members/filters=('!module_attribute',),inherited_members=('method1',),members=True.html
index 5fb3da58..6d460dd2 100644
--- a/tests/snapshots/external/0c2924ff976fa0e32ba66558a4f9e1eff4cd66196506a37977cdb33325a50718.html
+++ b/tests/snapshots/members/filters=('!module_attribute',),inherited_members=('method1',),members=True.html
@@ -268,7 +268,7 @@
Bases:
-
+
Class
diff --git a/tests/snapshots/external/6d12192d6b4dc0633bad697a683a3cdf3b2b9ceeb839044c72c63b469914f0a1.html b/tests/snapshots/members/filters=('!module_attribute',),inherited_members=(),members=('module_attribute',).html
similarity index 100%
rename from tests/snapshots/external/6d12192d6b4dc0633bad697a683a3cdf3b2b9ceeb839044c72c63b469914f0a1.html
rename to tests/snapshots/members/filters=('!module_attribute',),inherited_members=(),members=('module_attribute',).html
diff --git a/tests/snapshots/external/c260e7f4ef3b8b228bb25879d3adcf6610f1c2c971c9c46b5665d276716b8821.html b/tests/snapshots/members/filters=('!module_attribute',),inherited_members=(),members=().html
similarity index 100%
rename from tests/snapshots/external/c260e7f4ef3b8b228bb25879d3adcf6610f1c2c971c9c46b5665d276716b8821.html
rename to tests/snapshots/members/filters=('!module_attribute',),inherited_members=(),members=().html
diff --git a/tests/snapshots/external/74bfab19cbd4ba02673f6b9ee736a3b6727936de92f73f299ba238491f619937.html b/tests/snapshots/members/filters=('!module_attribute',),inherited_members=(),members=False.html
similarity index 100%
rename from tests/snapshots/external/74bfab19cbd4ba02673f6b9ee736a3b6727936de92f73f299ba238491f619937.html
rename to tests/snapshots/members/filters=('!module_attribute',),inherited_members=(),members=False.html
diff --git a/tests/snapshots/external/728c1344630190ac84514ebd8e5ae2d95ba8685e16d2c79749f675b5b2a6cea5.html b/tests/snapshots/members/filters=('!module_attribute',),inherited_members=(),members=None.html
similarity index 97%
rename from tests/snapshots/external/728c1344630190ac84514ebd8e5ae2d95ba8685e16d2c79749f675b5b2a6cea5.html
rename to tests/snapshots/members/filters=('!module_attribute',),inherited_members=(),members=None.html
index d6ac202a..793f43a4 100644
--- a/tests/snapshots/external/728c1344630190ac84514ebd8e5ae2d95ba8685e16d2c79749f675b5b2a6cea5.html
+++ b/tests/snapshots/members/filters=('!module_attribute',),inherited_members=(),members=None.html
@@ -235,7 +235,7 @@
Bases:
-
+
Class
diff --git a/tests/snapshots/external/b4b490164ab1a724cac7aba25bbc69a33e7dd44500e9337718cd96da1bb56325.html b/tests/snapshots/members/filters=('!module_attribute',),inherited_members=(),members=True.html
similarity index 97%
rename from tests/snapshots/external/b4b490164ab1a724cac7aba25bbc69a33e7dd44500e9337718cd96da1bb56325.html
rename to tests/snapshots/members/filters=('!module_attribute',),inherited_members=(),members=True.html
index 9f5cbef9..07120341 100644
--- a/tests/snapshots/external/b4b490164ab1a724cac7aba25bbc69a33e7dd44500e9337718cd96da1bb56325.html
+++ b/tests/snapshots/members/filters=('!module_attribute',),inherited_members=(),members=True.html
@@ -266,7 +266,7 @@
Bases:
-
+
Class
diff --git a/tests/snapshots/external/247a6063b698c285bfef7addfd972ddf797f6a90dfd5a3e649e6e4c127b86562.html b/tests/snapshots/members/filters=('!module_attribute',),inherited_members=False,members=('module_attribute',).html
similarity index 100%
rename from tests/snapshots/external/247a6063b698c285bfef7addfd972ddf797f6a90dfd5a3e649e6e4c127b86562.html
rename to tests/snapshots/members/filters=('!module_attribute',),inherited_members=False,members=('module_attribute',).html
diff --git a/tests/snapshots/external/fb5ebb7546d8d63744d7e6713ab5317b8c3d00d1108d28d7ef2949994b41dcbd.html b/tests/snapshots/members/filters=('!module_attribute',),inherited_members=False,members=().html
similarity index 100%
rename from tests/snapshots/external/fb5ebb7546d8d63744d7e6713ab5317b8c3d00d1108d28d7ef2949994b41dcbd.html
rename to tests/snapshots/members/filters=('!module_attribute',),inherited_members=False,members=().html
diff --git a/tests/snapshots/external/eee65d3705a655eec6512c4aa09d55f5d2e7c62dd245fed4b3f002a5e9a4d646.html b/tests/snapshots/members/filters=('!module_attribute',),inherited_members=False,members=False.html
similarity index 100%
rename from tests/snapshots/external/eee65d3705a655eec6512c4aa09d55f5d2e7c62dd245fed4b3f002a5e9a4d646.html
rename to tests/snapshots/members/filters=('!module_attribute',),inherited_members=False,members=False.html
diff --git a/tests/snapshots/external/cdc8126d78b690d11c09e3128df0f8d65379375a6bd390da30f5676bf2289cf2.html b/tests/snapshots/members/filters=('!module_attribute',),inherited_members=False,members=None.html
similarity index 97%
rename from tests/snapshots/external/cdc8126d78b690d11c09e3128df0f8d65379375a6bd390da30f5676bf2289cf2.html
rename to tests/snapshots/members/filters=('!module_attribute',),inherited_members=False,members=None.html
index 158c1ca5..5a87832a 100644
--- a/tests/snapshots/external/cdc8126d78b690d11c09e3128df0f8d65379375a6bd390da30f5676bf2289cf2.html
+++ b/tests/snapshots/members/filters=('!module_attribute',),inherited_members=False,members=None.html
@@ -235,7 +235,7 @@
Bases:
-
+
Class
diff --git a/tests/snapshots/external/0fac4f5e7f455b351c60268567bfcbd0259b652d0534259efea7815aa15b1122.html b/tests/snapshots/members/filters=('!module_attribute',),inherited_members=False,members=True.html
similarity index 97%
rename from tests/snapshots/external/0fac4f5e7f455b351c60268567bfcbd0259b652d0534259efea7815aa15b1122.html
rename to tests/snapshots/members/filters=('!module_attribute',),inherited_members=False,members=True.html
index 47cfb56f..40ebfa36 100644
--- a/tests/snapshots/external/0fac4f5e7f455b351c60268567bfcbd0259b652d0534259efea7815aa15b1122.html
+++ b/tests/snapshots/members/filters=('!module_attribute',),inherited_members=False,members=True.html
@@ -266,7 +266,7 @@
Bases:
-
+
Class
diff --git a/tests/snapshots/external/96cf94f4822a5cf5d72407eab5a5dddda972f16623f7710f738ffe2bcf9130d9.html b/tests/snapshots/members/filters=('!module_attribute',),inherited_members=True,members=('module_attribute',).html
similarity index 100%
rename from tests/snapshots/external/96cf94f4822a5cf5d72407eab5a5dddda972f16623f7710f738ffe2bcf9130d9.html
rename to tests/snapshots/members/filters=('!module_attribute',),inherited_members=True,members=('module_attribute',).html
diff --git a/tests/snapshots/external/28d8862dd086c7d523516dd4091b57e5babd34165edccf619b62a06fc1936cd5.html b/tests/snapshots/members/filters=('!module_attribute',),inherited_members=True,members=().html
similarity index 100%
rename from tests/snapshots/external/28d8862dd086c7d523516dd4091b57e5babd34165edccf619b62a06fc1936cd5.html
rename to tests/snapshots/members/filters=('!module_attribute',),inherited_members=True,members=().html
diff --git a/tests/snapshots/external/d726cb8367d95b67ce78e718e88ee528d3abc2fbd04413d1c11916a243d7567a.html b/tests/snapshots/members/filters=('!module_attribute',),inherited_members=True,members=False.html
similarity index 100%
rename from tests/snapshots/external/d726cb8367d95b67ce78e718e88ee528d3abc2fbd04413d1c11916a243d7567a.html
rename to tests/snapshots/members/filters=('!module_attribute',),inherited_members=True,members=False.html
diff --git a/tests/snapshots/external/ba51e100acd4f6ad91f1ef484aa5f1bd537e661588b1742d93d0a6543cc3592c.html b/tests/snapshots/members/filters=('!module_attribute',),inherited_members=True,members=None.html
similarity index 98%
rename from tests/snapshots/external/ba51e100acd4f6ad91f1ef484aa5f1bd537e661588b1742d93d0a6543cc3592c.html
rename to tests/snapshots/members/filters=('!module_attribute',),inherited_members=True,members=None.html
index b18eb50e..cb43eee6 100644
--- a/tests/snapshots/external/ba51e100acd4f6ad91f1ef484aa5f1bd537e661588b1742d93d0a6543cc3592c.html
+++ b/tests/snapshots/members/filters=('!module_attribute',),inherited_members=True,members=None.html
@@ -235,7 +235,7 @@
Bases:
-
+
Class
diff --git a/tests/snapshots/external/7c988c9e13efeadd20b911a95cc69973b715cceacdadefc540109aad3c274bde.html b/tests/snapshots/members/filters=('!module_attribute',),inherited_members=True,members=True.html
similarity index 98%
rename from tests/snapshots/external/7c988c9e13efeadd20b911a95cc69973b715cceacdadefc540109aad3c274bde.html
rename to tests/snapshots/members/filters=('!module_attribute',),inherited_members=True,members=True.html
index 10b98188..8357168e 100644
--- a/tests/snapshots/external/7c988c9e13efeadd20b911a95cc69973b715cceacdadefc540109aad3c274bde.html
+++ b/tests/snapshots/members/filters=('!module_attribute',),inherited_members=True,members=True.html
@@ -266,7 +266,7 @@
Bases:
-
+
Class
diff --git a/tests/snapshots/external/8b097c69ac2fd52857f33e1b008f4d99a53ed21894c51517b3d79da445b0a705.html b/tests/snapshots/members/filters=('module_attribute',),inherited_members=('method1',),members=('module_attribute',).html
similarity index 100%
rename from tests/snapshots/external/8b097c69ac2fd52857f33e1b008f4d99a53ed21894c51517b3d79da445b0a705.html
rename to tests/snapshots/members/filters=('module_attribute',),inherited_members=('method1',),members=('module_attribute',).html
diff --git a/tests/snapshots/external/f8f32ea6a0c80a63854f8c8d78b3706797feb3042ac88c8fcf0a6da277eddb9d.html b/tests/snapshots/members/filters=('module_attribute',),inherited_members=('method1',),members=().html
similarity index 100%
rename from tests/snapshots/external/f8f32ea6a0c80a63854f8c8d78b3706797feb3042ac88c8fcf0a6da277eddb9d.html
rename to tests/snapshots/members/filters=('module_attribute',),inherited_members=('method1',),members=().html
diff --git a/tests/snapshots/external/f0014d9505eceb38ba1e36c380a97ebe4d43669929ec1cdedba4d418899aecc7.html b/tests/snapshots/members/filters=('module_attribute',),inherited_members=('method1',),members=False.html
similarity index 100%
rename from tests/snapshots/external/f0014d9505eceb38ba1e36c380a97ebe4d43669929ec1cdedba4d418899aecc7.html
rename to tests/snapshots/members/filters=('module_attribute',),inherited_members=('method1',),members=False.html
diff --git a/tests/snapshots/external/cfcd41685591bcc497f9d1e9fd20006fc3acd857f068e78e6d1c2461bbd4063f.html b/tests/snapshots/members/filters=('module_attribute',),inherited_members=('method1',),members=None.html
similarity index 100%
rename from tests/snapshots/external/cfcd41685591bcc497f9d1e9fd20006fc3acd857f068e78e6d1c2461bbd4063f.html
rename to tests/snapshots/members/filters=('module_attribute',),inherited_members=('method1',),members=None.html
diff --git a/tests/snapshots/external/a1167b14f5a71a283817bf5866d2bb0bd08bf23dc054c6f7938a04f42feab99d.html b/tests/snapshots/members/filters=('module_attribute',),inherited_members=('method1',),members=True.html
similarity index 95%
rename from tests/snapshots/external/a1167b14f5a71a283817bf5866d2bb0bd08bf23dc054c6f7938a04f42feab99d.html
rename to tests/snapshots/members/filters=('module_attribute',),inherited_members=('method1',),members=True.html
index bb9001d8..795378be 100644
--- a/tests/snapshots/external/a1167b14f5a71a283817bf5866d2bb0bd08bf23dc054c6f7938a04f42feab99d.html
+++ b/tests/snapshots/members/filters=('module_attribute',),inherited_members=('method1',),members=True.html
@@ -80,7 +80,7 @@
Bases:
-
+
Class
diff --git a/tests/snapshots/external/f6e292b8358a04e3471ba11c8820307076be3cf83b0a9ec2fb5c949324b7e172.html b/tests/snapshots/members/filters=('module_attribute',),inherited_members=(),members=('module_attribute',).html
similarity index 100%
rename from tests/snapshots/external/f6e292b8358a04e3471ba11c8820307076be3cf83b0a9ec2fb5c949324b7e172.html
rename to tests/snapshots/members/filters=('module_attribute',),inherited_members=(),members=('module_attribute',).html
diff --git a/tests/snapshots/external/a185e216dc7b7ebb31b46ea0e7ed446cf9da94eee8db306f08bae1ca0db0ca1d.html b/tests/snapshots/members/filters=('module_attribute',),inherited_members=(),members=().html
similarity index 100%
rename from tests/snapshots/external/a185e216dc7b7ebb31b46ea0e7ed446cf9da94eee8db306f08bae1ca0db0ca1d.html
rename to tests/snapshots/members/filters=('module_attribute',),inherited_members=(),members=().html
diff --git a/tests/snapshots/external/76ee8e01e1c0b94de84d79da8443bc24f601f89cab70eae1b2af5ee21cfb1f3a.html b/tests/snapshots/members/filters=('module_attribute',),inherited_members=(),members=False.html
similarity index 100%
rename from tests/snapshots/external/76ee8e01e1c0b94de84d79da8443bc24f601f89cab70eae1b2af5ee21cfb1f3a.html
rename to tests/snapshots/members/filters=('module_attribute',),inherited_members=(),members=False.html
diff --git a/tests/snapshots/external/c9a15552eed32a233795c2086a7c766ad95e05197d30d881540fbe52cdc07ff8.html b/tests/snapshots/members/filters=('module_attribute',),inherited_members=(),members=None.html
similarity index 100%
rename from tests/snapshots/external/c9a15552eed32a233795c2086a7c766ad95e05197d30d881540fbe52cdc07ff8.html
rename to tests/snapshots/members/filters=('module_attribute',),inherited_members=(),members=None.html
diff --git a/tests/snapshots/external/46e56f39b10d1e8ee4017bc11457bf76d169fc80b3d3e465213671b7f6e548eb.html b/tests/snapshots/members/filters=('module_attribute',),inherited_members=(),members=True.html
similarity index 94%
rename from tests/snapshots/external/46e56f39b10d1e8ee4017bc11457bf76d169fc80b3d3e465213671b7f6e548eb.html
rename to tests/snapshots/members/filters=('module_attribute',),inherited_members=(),members=True.html
index 36f35fb4..a7eb7dce 100644
--- a/tests/snapshots/external/46e56f39b10d1e8ee4017bc11457bf76d169fc80b3d3e465213671b7f6e548eb.html
+++ b/tests/snapshots/members/filters=('module_attribute',),inherited_members=(),members=True.html
@@ -78,7 +78,7 @@
Bases:
-
+
Class
diff --git a/tests/snapshots/external/5a9c10410801aa75b33878971b939da701df9a7ce8006dc7781c148d27a89756.html b/tests/snapshots/members/filters=('module_attribute',),inherited_members=False,members=('module_attribute',).html
similarity index 100%
rename from tests/snapshots/external/5a9c10410801aa75b33878971b939da701df9a7ce8006dc7781c148d27a89756.html
rename to tests/snapshots/members/filters=('module_attribute',),inherited_members=False,members=('module_attribute',).html
diff --git a/tests/snapshots/external/d5a6bf59c663338bef9fdc2391f482aee444228e86e23357c11881498e711bb2.html b/tests/snapshots/members/filters=('module_attribute',),inherited_members=False,members=().html
similarity index 100%
rename from tests/snapshots/external/d5a6bf59c663338bef9fdc2391f482aee444228e86e23357c11881498e711bb2.html
rename to tests/snapshots/members/filters=('module_attribute',),inherited_members=False,members=().html
diff --git a/tests/snapshots/external/7107066872137b807b3f9d897e75eff78f5783b14d3c88e71c6477eaa8493113.html b/tests/snapshots/members/filters=('module_attribute',),inherited_members=False,members=False.html
similarity index 100%
rename from tests/snapshots/external/7107066872137b807b3f9d897e75eff78f5783b14d3c88e71c6477eaa8493113.html
rename to tests/snapshots/members/filters=('module_attribute',),inherited_members=False,members=False.html
diff --git a/tests/snapshots/external/62e18d3e57777d911c7fdee1fcc032a9c23ffe82913060e3b66f29bf81a6a585.html b/tests/snapshots/members/filters=('module_attribute',),inherited_members=False,members=None.html
similarity index 100%
rename from tests/snapshots/external/62e18d3e57777d911c7fdee1fcc032a9c23ffe82913060e3b66f29bf81a6a585.html
rename to tests/snapshots/members/filters=('module_attribute',),inherited_members=False,members=None.html
diff --git a/tests/snapshots/external/052e71e7e9d5bec710fb2d36b009122c48eca0a19d0611df530e607f5bacdf6f.html b/tests/snapshots/members/filters=('module_attribute',),inherited_members=False,members=True.html
similarity index 94%
rename from tests/snapshots/external/052e71e7e9d5bec710fb2d36b009122c48eca0a19d0611df530e607f5bacdf6f.html
rename to tests/snapshots/members/filters=('module_attribute',),inherited_members=False,members=True.html
index 6866b45f..e196b599 100644
--- a/tests/snapshots/external/052e71e7e9d5bec710fb2d36b009122c48eca0a19d0611df530e607f5bacdf6f.html
+++ b/tests/snapshots/members/filters=('module_attribute',),inherited_members=False,members=True.html
@@ -78,7 +78,7 @@
Bases:
-
+
Class
diff --git a/tests/snapshots/external/8d4e1f9af9971bd21234c7c45dfbd59a1aee444bfa0cd3b9cfb6d052d378a041.html b/tests/snapshots/members/filters=('module_attribute',),inherited_members=True,members=('module_attribute',).html
similarity index 100%
rename from tests/snapshots/external/8d4e1f9af9971bd21234c7c45dfbd59a1aee444bfa0cd3b9cfb6d052d378a041.html
rename to tests/snapshots/members/filters=('module_attribute',),inherited_members=True,members=('module_attribute',).html
diff --git a/tests/snapshots/external/95f8e480937f7a2b956392ed4d8058052d9748874cdd911feacdd31d1abe5d97.html b/tests/snapshots/members/filters=('module_attribute',),inherited_members=True,members=().html
similarity index 100%
rename from tests/snapshots/external/95f8e480937f7a2b956392ed4d8058052d9748874cdd911feacdd31d1abe5d97.html
rename to tests/snapshots/members/filters=('module_attribute',),inherited_members=True,members=().html
diff --git a/tests/snapshots/external/f3f3acb6b51ba98f5a06e7c62e85b791b6521504f19a8d7496592dee59c7f199.html b/tests/snapshots/members/filters=('module_attribute',),inherited_members=True,members=False.html
similarity index 100%
rename from tests/snapshots/external/f3f3acb6b51ba98f5a06e7c62e85b791b6521504f19a8d7496592dee59c7f199.html
rename to tests/snapshots/members/filters=('module_attribute',),inherited_members=True,members=False.html
diff --git a/tests/snapshots/external/2bf34b4dd82e753b21200ec980cb197c530710fe8c150c4dd3fbbfb7d38928cc.html b/tests/snapshots/members/filters=('module_attribute',),inherited_members=True,members=None.html
similarity index 100%
rename from tests/snapshots/external/2bf34b4dd82e753b21200ec980cb197c530710fe8c150c4dd3fbbfb7d38928cc.html
rename to tests/snapshots/members/filters=('module_attribute',),inherited_members=True,members=None.html
diff --git a/tests/snapshots/external/052c34f22e4c711b1f13f53085cdd5e8edcfae4bdc1d8cb7f2ff76cd1c46cce5.html b/tests/snapshots/members/filters=('module_attribute',),inherited_members=True,members=True.html
similarity index 94%
rename from tests/snapshots/external/052c34f22e4c711b1f13f53085cdd5e8edcfae4bdc1d8cb7f2ff76cd1c46cce5.html
rename to tests/snapshots/members/filters=('module_attribute',),inherited_members=True,members=True.html
index e1a7d15c..26cb9e39 100644
--- a/tests/snapshots/external/052c34f22e4c711b1f13f53085cdd5e8edcfae4bdc1d8cb7f2ff76cd1c46cce5.html
+++ b/tests/snapshots/members/filters=('module_attribute',),inherited_members=True,members=True.html
@@ -78,7 +78,7 @@
Bases:
-
+
Class
diff --git a/tests/snapshots/external/e90c3e0c85ddaa068f3d063c6a1ef718bb3ae2092760b707e838fb73164b3720.html b/tests/snapshots/members/filters=(),inherited_members=('method1',),members=('module_attribute',).html
similarity index 100%
rename from tests/snapshots/external/e90c3e0c85ddaa068f3d063c6a1ef718bb3ae2092760b707e838fb73164b3720.html
rename to tests/snapshots/members/filters=(),inherited_members=('method1',),members=('module_attribute',).html
diff --git a/tests/snapshots/external/4892e0fe1920c0bb22fa4787b6e76cccaa968163b35641d705f288c04fe4937e.html b/tests/snapshots/members/filters=(),inherited_members=('method1',),members=().html
similarity index 100%
rename from tests/snapshots/external/4892e0fe1920c0bb22fa4787b6e76cccaa968163b35641d705f288c04fe4937e.html
rename to tests/snapshots/members/filters=(),inherited_members=('method1',),members=().html
diff --git a/tests/snapshots/external/ab0ddac637b536c06014746a4a8f8e0921b074015ae19680abf5df995c233ba1.html b/tests/snapshots/members/filters=(),inherited_members=('method1',),members=False.html
similarity index 100%
rename from tests/snapshots/external/ab0ddac637b536c06014746a4a8f8e0921b074015ae19680abf5df995c233ba1.html
rename to tests/snapshots/members/filters=(),inherited_members=('method1',),members=False.html
diff --git a/tests/snapshots/external/f848d4a9e516beeb1b1719630e34aa243a093ccd362a63e33dbd6202ae8ab75d.html b/tests/snapshots/members/filters=(),inherited_members=('method1',),members=None.html
similarity index 98%
rename from tests/snapshots/external/f848d4a9e516beeb1b1719630e34aa243a093ccd362a63e33dbd6202ae8ab75d.html
rename to tests/snapshots/members/filters=(),inherited_members=('method1',),members=None.html
index 19c29b39..d9ae307d 100644
--- a/tests/snapshots/external/f848d4a9e516beeb1b1719630e34aa243a093ccd362a63e33dbd6202ae8ab75d.html
+++ b/tests/snapshots/members/filters=(),inherited_members=('method1',),members=None.html
@@ -266,7 +266,7 @@
Bases:
-
+
Class
diff --git a/tests/snapshots/external/d540895f6bf91c8c8e4abc02f40529a61c6cec71b18da2e4f02206ec18b901ef.html b/tests/snapshots/members/filters=(),inherited_members=('method1',),members=True.html
similarity index 98%
rename from tests/snapshots/external/d540895f6bf91c8c8e4abc02f40529a61c6cec71b18da2e4f02206ec18b901ef.html
rename to tests/snapshots/members/filters=(),inherited_members=('method1',),members=True.html
index 2ad1c277..a52964c3 100644
--- a/tests/snapshots/external/d540895f6bf91c8c8e4abc02f40529a61c6cec71b18da2e4f02206ec18b901ef.html
+++ b/tests/snapshots/members/filters=(),inherited_members=('method1',),members=True.html
@@ -266,7 +266,7 @@
Bases:
-
+
Class
diff --git a/tests/snapshots/external/388a13d71284b1a4b0c457e9c8d1ec60dfefb8871c69ceb1d7a035bd3bdadab8.html b/tests/snapshots/members/filters=(),inherited_members=(),members=('module_attribute',).html
similarity index 100%
rename from tests/snapshots/external/388a13d71284b1a4b0c457e9c8d1ec60dfefb8871c69ceb1d7a035bd3bdadab8.html
rename to tests/snapshots/members/filters=(),inherited_members=(),members=('module_attribute',).html
diff --git a/tests/snapshots/external/11598fec2d07bb675dfa8a57e49136f18a94eedec6bc5a036dcecc005e70dc80.html b/tests/snapshots/members/filters=(),inherited_members=(),members=().html
similarity index 100%
rename from tests/snapshots/external/11598fec2d07bb675dfa8a57e49136f18a94eedec6bc5a036dcecc005e70dc80.html
rename to tests/snapshots/members/filters=(),inherited_members=(),members=().html
diff --git a/tests/snapshots/external/366b0537fe0625a10d55203a3532de5c360e49fb403078a82ec408d829afcb72.html b/tests/snapshots/members/filters=(),inherited_members=(),members=False.html
similarity index 100%
rename from tests/snapshots/external/366b0537fe0625a10d55203a3532de5c360e49fb403078a82ec408d829afcb72.html
rename to tests/snapshots/members/filters=(),inherited_members=(),members=False.html
diff --git a/tests/snapshots/external/e6a9b76f268cde81a129e7273038db0ff3fcd73530442a30c48cf01dcbc30aaa.html b/tests/snapshots/members/filters=(),inherited_members=(),members=None.html
similarity index 97%
rename from tests/snapshots/external/e6a9b76f268cde81a129e7273038db0ff3fcd73530442a30c48cf01dcbc30aaa.html
rename to tests/snapshots/members/filters=(),inherited_members=(),members=None.html
index dbcf8c57..9058ed13 100644
--- a/tests/snapshots/external/e6a9b76f268cde81a129e7273038db0ff3fcd73530442a30c48cf01dcbc30aaa.html
+++ b/tests/snapshots/members/filters=(),inherited_members=(),members=None.html
@@ -264,7 +264,7 @@
Bases:
-
+
Class
diff --git a/tests/snapshots/external/fb65efbbfc3ef9c2a06e6f539f8a75bec4276e61254539632a1d5f8f2c6c3452.html b/tests/snapshots/members/filters=(),inherited_members=(),members=True.html
similarity index 97%
rename from tests/snapshots/external/fb65efbbfc3ef9c2a06e6f539f8a75bec4276e61254539632a1d5f8f2c6c3452.html
rename to tests/snapshots/members/filters=(),inherited_members=(),members=True.html
index 3cec9af8..ccfa8d64 100644
--- a/tests/snapshots/external/fb65efbbfc3ef9c2a06e6f539f8a75bec4276e61254539632a1d5f8f2c6c3452.html
+++ b/tests/snapshots/members/filters=(),inherited_members=(),members=True.html
@@ -264,7 +264,7 @@
Bases:
-
+
Class
diff --git a/tests/snapshots/external/09d96d69d9dcbc54c8189fb885e8e06269c51be673389f29fa8b2d90cff54eb2.html b/tests/snapshots/members/filters=(),inherited_members=False,members=('module_attribute',).html
similarity index 100%
rename from tests/snapshots/external/09d96d69d9dcbc54c8189fb885e8e06269c51be673389f29fa8b2d90cff54eb2.html
rename to tests/snapshots/members/filters=(),inherited_members=False,members=('module_attribute',).html
diff --git a/tests/snapshots/external/fba0d78ae23e4f52b5e6f0fe003ea3edf681a937f647b11925e9932006648a11.html b/tests/snapshots/members/filters=(),inherited_members=False,members=().html
similarity index 100%
rename from tests/snapshots/external/fba0d78ae23e4f52b5e6f0fe003ea3edf681a937f647b11925e9932006648a11.html
rename to tests/snapshots/members/filters=(),inherited_members=False,members=().html
diff --git a/tests/snapshots/external/5cf0130e3b4fdd536b1c99ee66c66ec4245e286bf75b989cf50979ce187e1a16.html b/tests/snapshots/members/filters=(),inherited_members=False,members=False.html
similarity index 100%
rename from tests/snapshots/external/5cf0130e3b4fdd536b1c99ee66c66ec4245e286bf75b989cf50979ce187e1a16.html
rename to tests/snapshots/members/filters=(),inherited_members=False,members=False.html
diff --git a/tests/snapshots/external/a2c5be9bd5d1f0db3ff64b44353c1760f5eb69d7db6401da2f28518d0e8065c4.html b/tests/snapshots/members/filters=(),inherited_members=False,members=None.html
similarity index 97%
rename from tests/snapshots/external/a2c5be9bd5d1f0db3ff64b44353c1760f5eb69d7db6401da2f28518d0e8065c4.html
rename to tests/snapshots/members/filters=(),inherited_members=False,members=None.html
index 4738a584..7c90168c 100644
--- a/tests/snapshots/external/a2c5be9bd5d1f0db3ff64b44353c1760f5eb69d7db6401da2f28518d0e8065c4.html
+++ b/tests/snapshots/members/filters=(),inherited_members=False,members=None.html
@@ -264,7 +264,7 @@
Bases:
-
+
Class
diff --git a/tests/snapshots/external/59a9e1ffb2f0807b594a933444c78753a06f359527ea4adac85c72a7812b21d3.html b/tests/snapshots/members/filters=(),inherited_members=False,members=True.html
similarity index 97%
rename from tests/snapshots/external/59a9e1ffb2f0807b594a933444c78753a06f359527ea4adac85c72a7812b21d3.html
rename to tests/snapshots/members/filters=(),inherited_members=False,members=True.html
index ad60041c..d6c51063 100644
--- a/tests/snapshots/external/59a9e1ffb2f0807b594a933444c78753a06f359527ea4adac85c72a7812b21d3.html
+++ b/tests/snapshots/members/filters=(),inherited_members=False,members=True.html
@@ -264,7 +264,7 @@
Bases:
-
+
Class
diff --git a/tests/snapshots/external/9d03089a46fab9a86b0836444cabb6225798eaf25be6fd4171bd73b7354509b6.html b/tests/snapshots/members/filters=(),inherited_members=True,members=('module_attribute',).html
similarity index 100%
rename from tests/snapshots/external/9d03089a46fab9a86b0836444cabb6225798eaf25be6fd4171bd73b7354509b6.html
rename to tests/snapshots/members/filters=(),inherited_members=True,members=('module_attribute',).html
diff --git a/tests/snapshots/external/c915eb92fd5dcc4e2c9da41ca72c726e65fcd85804942be0c67b4f05f452a549.html b/tests/snapshots/members/filters=(),inherited_members=True,members=().html
similarity index 100%
rename from tests/snapshots/external/c915eb92fd5dcc4e2c9da41ca72c726e65fcd85804942be0c67b4f05f452a549.html
rename to tests/snapshots/members/filters=(),inherited_members=True,members=().html
diff --git a/tests/snapshots/external/b0a9b08f1f721721c4dd110cb8f85ffda5caf1f1479851275bc227857fb01400.html b/tests/snapshots/members/filters=(),inherited_members=True,members=False.html
similarity index 100%
rename from tests/snapshots/external/b0a9b08f1f721721c4dd110cb8f85ffda5caf1f1479851275bc227857fb01400.html
rename to tests/snapshots/members/filters=(),inherited_members=True,members=False.html
diff --git a/tests/snapshots/external/981438492e387bc82b23f09e3c5e0b452db5a1ffd88e52479db2b52a170fd8f9.html b/tests/snapshots/members/filters=(),inherited_members=True,members=None.html
similarity index 98%
rename from tests/snapshots/external/981438492e387bc82b23f09e3c5e0b452db5a1ffd88e52479db2b52a170fd8f9.html
rename to tests/snapshots/members/filters=(),inherited_members=True,members=None.html
index 574ec87c..b2490df7 100644
--- a/tests/snapshots/external/981438492e387bc82b23f09e3c5e0b452db5a1ffd88e52479db2b52a170fd8f9.html
+++ b/tests/snapshots/members/filters=(),inherited_members=True,members=None.html
@@ -264,7 +264,7 @@
Bases:
-
+
Class
diff --git a/tests/snapshots/external/e8be7a9b1410e40dac79fe0ee29d3036e707a177b2ba2bdad25a6998bec570b7.html b/tests/snapshots/members/filters=(),inherited_members=True,members=True.html
similarity index 98%
rename from tests/snapshots/external/e8be7a9b1410e40dac79fe0ee29d3036e707a177b2ba2bdad25a6998bec570b7.html
rename to tests/snapshots/members/filters=(),inherited_members=True,members=True.html
index 3dbd9879..7c65c72b 100644
--- a/tests/snapshots/external/e8be7a9b1410e40dac79fe0ee29d3036e707a177b2ba2bdad25a6998bec570b7.html
+++ b/tests/snapshots/members/filters=(),inherited_members=True,members=True.html
@@ -264,7 +264,7 @@
Bases:
-
+
Class
diff --git a/tests/snapshots/external/afd5c166367dd47e4f9843d906b3a1ad12398888fdad84bfbda3de8b19072611.html b/tests/snapshots/members/filters=None,inherited_members=('method1',),members=('module_attribute',).html
similarity index 100%
rename from tests/snapshots/external/afd5c166367dd47e4f9843d906b3a1ad12398888fdad84bfbda3de8b19072611.html
rename to tests/snapshots/members/filters=None,inherited_members=('method1',),members=('module_attribute',).html
diff --git a/tests/snapshots/external/4f60da13e2d45e803f73ed41746d8b3570f0dac7e132efb1bf0cdbf77e9e2c59.html b/tests/snapshots/members/filters=None,inherited_members=('method1',),members=().html
similarity index 100%
rename from tests/snapshots/external/4f60da13e2d45e803f73ed41746d8b3570f0dac7e132efb1bf0cdbf77e9e2c59.html
rename to tests/snapshots/members/filters=None,inherited_members=('method1',),members=().html
diff --git a/tests/snapshots/external/e3defc3620e5fee20f9400c33b7b541fde66297f257d9baf1b0f94b3ea49e6e0.html b/tests/snapshots/members/filters=None,inherited_members=('method1',),members=False.html
similarity index 100%
rename from tests/snapshots/external/e3defc3620e5fee20f9400c33b7b541fde66297f257d9baf1b0f94b3ea49e6e0.html
rename to tests/snapshots/members/filters=None,inherited_members=('method1',),members=False.html
diff --git a/tests/snapshots/external/ae74b5980f9b6996ed6e112d53168fde16c32d92bed42fb3193f98e0e3f04602.html b/tests/snapshots/members/filters=None,inherited_members=('method1',),members=None.html
similarity index 98%
rename from tests/snapshots/external/ae74b5980f9b6996ed6e112d53168fde16c32d92bed42fb3193f98e0e3f04602.html
rename to tests/snapshots/members/filters=None,inherited_members=('method1',),members=None.html
index 34123ecf..ddce47f6 100644
--- a/tests/snapshots/external/ae74b5980f9b6996ed6e112d53168fde16c32d92bed42fb3193f98e0e3f04602.html
+++ b/tests/snapshots/members/filters=None,inherited_members=('method1',),members=None.html
@@ -266,7 +266,7 @@
Bases:
-
+
Class
diff --git a/tests/snapshots/external/7d5fe66539191786245991395e77d8ba0bbb22330cb08eaec2e84159bde4159b.html b/tests/snapshots/members/filters=None,inherited_members=('method1',),members=True.html
similarity index 98%
rename from tests/snapshots/external/7d5fe66539191786245991395e77d8ba0bbb22330cb08eaec2e84159bde4159b.html
rename to tests/snapshots/members/filters=None,inherited_members=('method1',),members=True.html
index 23e38eeb..fa970eca 100644
--- a/tests/snapshots/external/7d5fe66539191786245991395e77d8ba0bbb22330cb08eaec2e84159bde4159b.html
+++ b/tests/snapshots/members/filters=None,inherited_members=('method1',),members=True.html
@@ -266,7 +266,7 @@
Bases:
-
+
Class
diff --git a/tests/snapshots/external/166b8dfab738b90f2ff0df84a048df96539455d9cad42b09b248ab65b5c742e2.html b/tests/snapshots/members/filters=None,inherited_members=(),members=('module_attribute',).html
similarity index 100%
rename from tests/snapshots/external/166b8dfab738b90f2ff0df84a048df96539455d9cad42b09b248ab65b5c742e2.html
rename to tests/snapshots/members/filters=None,inherited_members=(),members=('module_attribute',).html
diff --git a/tests/snapshots/external/f77f1c850398f972a7ae2229f918ba497874115be6c5e9431838b4bb6931b2f4.html b/tests/snapshots/members/filters=None,inherited_members=(),members=().html
similarity index 100%
rename from tests/snapshots/external/f77f1c850398f972a7ae2229f918ba497874115be6c5e9431838b4bb6931b2f4.html
rename to tests/snapshots/members/filters=None,inherited_members=(),members=().html
diff --git a/tests/snapshots/external/44e42f27bfe3d3b5ec14700c247c83195b1c6eea319d1a0679b2baa797d9859c.html b/tests/snapshots/members/filters=None,inherited_members=(),members=False.html
similarity index 100%
rename from tests/snapshots/external/44e42f27bfe3d3b5ec14700c247c83195b1c6eea319d1a0679b2baa797d9859c.html
rename to tests/snapshots/members/filters=None,inherited_members=(),members=False.html
diff --git a/tests/snapshots/external/88855b0284174733b57edd2043e0e8cd6a1a0223055f08b80031452eb05d9484.html b/tests/snapshots/members/filters=None,inherited_members=(),members=None.html
similarity index 97%
rename from tests/snapshots/external/88855b0284174733b57edd2043e0e8cd6a1a0223055f08b80031452eb05d9484.html
rename to tests/snapshots/members/filters=None,inherited_members=(),members=None.html
index 540a2f6a..91614cf0 100644
--- a/tests/snapshots/external/88855b0284174733b57edd2043e0e8cd6a1a0223055f08b80031452eb05d9484.html
+++ b/tests/snapshots/members/filters=None,inherited_members=(),members=None.html
@@ -264,7 +264,7 @@
Bases:
-
+
Class
diff --git a/tests/snapshots/external/347d4ffe2cb3f2ca3f0d1f3f09cffa96645eb2af29983e75d807fccff96d8f75.html b/tests/snapshots/members/filters=None,inherited_members=(),members=True.html
similarity index 97%
rename from tests/snapshots/external/347d4ffe2cb3f2ca3f0d1f3f09cffa96645eb2af29983e75d807fccff96d8f75.html
rename to tests/snapshots/members/filters=None,inherited_members=(),members=True.html
index 9cd4b2fe..2d79edd5 100644
--- a/tests/snapshots/external/347d4ffe2cb3f2ca3f0d1f3f09cffa96645eb2af29983e75d807fccff96d8f75.html
+++ b/tests/snapshots/members/filters=None,inherited_members=(),members=True.html
@@ -264,7 +264,7 @@
Bases:
-
+
Class
diff --git a/tests/snapshots/external/a200913d9a7d51c52ab58f6fc4e9ea7be278d7890c46cf28ecc3cfd35a36fb46.html b/tests/snapshots/members/filters=None,inherited_members=False,members=('module_attribute',).html
similarity index 100%
rename from tests/snapshots/external/a200913d9a7d51c52ab58f6fc4e9ea7be278d7890c46cf28ecc3cfd35a36fb46.html
rename to tests/snapshots/members/filters=None,inherited_members=False,members=('module_attribute',).html
diff --git a/tests/snapshots/external/fb770e6537bc1b98c0de03db7810404967562a2ffd1700ca35c9788949ca55c0.html b/tests/snapshots/members/filters=None,inherited_members=False,members=().html
similarity index 100%
rename from tests/snapshots/external/fb770e6537bc1b98c0de03db7810404967562a2ffd1700ca35c9788949ca55c0.html
rename to tests/snapshots/members/filters=None,inherited_members=False,members=().html
diff --git a/tests/snapshots/external/9bd282a6f2fe82f3ffe66b175bf90ab3e808e3a67f3c15a9f9e3e143d7956e49.html b/tests/snapshots/members/filters=None,inherited_members=False,members=False.html
similarity index 100%
rename from tests/snapshots/external/9bd282a6f2fe82f3ffe66b175bf90ab3e808e3a67f3c15a9f9e3e143d7956e49.html
rename to tests/snapshots/members/filters=None,inherited_members=False,members=False.html
diff --git a/tests/snapshots/external/f7711b8af7689b331209f8c034c8cc3a2ec894372644a8eaee597418e9b55b3c.html b/tests/snapshots/members/filters=None,inherited_members=False,members=None.html
similarity index 97%
rename from tests/snapshots/external/f7711b8af7689b331209f8c034c8cc3a2ec894372644a8eaee597418e9b55b3c.html
rename to tests/snapshots/members/filters=None,inherited_members=False,members=None.html
index 522fd1c1..332a5c53 100644
--- a/tests/snapshots/external/f7711b8af7689b331209f8c034c8cc3a2ec894372644a8eaee597418e9b55b3c.html
+++ b/tests/snapshots/members/filters=None,inherited_members=False,members=None.html
@@ -264,7 +264,7 @@
Bases:
-
+
Class
diff --git a/tests/snapshots/external/83119803338105f101311992d31947e4fcaf2c5a6c68cad6355d8611c1cc2e3f.html b/tests/snapshots/members/filters=None,inherited_members=False,members=True.html
similarity index 97%
rename from tests/snapshots/external/83119803338105f101311992d31947e4fcaf2c5a6c68cad6355d8611c1cc2e3f.html
rename to tests/snapshots/members/filters=None,inherited_members=False,members=True.html
index c9c637e4..cce2be49 100644
--- a/tests/snapshots/external/83119803338105f101311992d31947e4fcaf2c5a6c68cad6355d8611c1cc2e3f.html
+++ b/tests/snapshots/members/filters=None,inherited_members=False,members=True.html
@@ -264,7 +264,7 @@
Bases:
-
+
Class
diff --git a/tests/snapshots/external/bd6594ae3b516bf84cd0b0e6605087f430f62d787c32225ac8b4039c92e20b76.html b/tests/snapshots/members/filters=None,inherited_members=True,members=('module_attribute',).html
similarity index 100%
rename from tests/snapshots/external/bd6594ae3b516bf84cd0b0e6605087f430f62d787c32225ac8b4039c92e20b76.html
rename to tests/snapshots/members/filters=None,inherited_members=True,members=('module_attribute',).html
diff --git a/tests/snapshots/external/ce06da7f07b34e4f9071c5c001a8626f2d5fd8eed9a3ba81abebd76f8afc6861.html b/tests/snapshots/members/filters=None,inherited_members=True,members=().html
similarity index 100%
rename from tests/snapshots/external/ce06da7f07b34e4f9071c5c001a8626f2d5fd8eed9a3ba81abebd76f8afc6861.html
rename to tests/snapshots/members/filters=None,inherited_members=True,members=().html
diff --git a/tests/snapshots/external/3f5d794823a451ec9d4ed8c7e16d1354d39b74380402b255ee60741e97c9960c.html b/tests/snapshots/members/filters=None,inherited_members=True,members=False.html
similarity index 100%
rename from tests/snapshots/external/3f5d794823a451ec9d4ed8c7e16d1354d39b74380402b255ee60741e97c9960c.html
rename to tests/snapshots/members/filters=None,inherited_members=True,members=False.html
diff --git a/tests/snapshots/external/cc19537fdba4a26b10c60d5586b0eb7ef0264a783a3c47d1114d21fa8cfa3947.html b/tests/snapshots/members/filters=None,inherited_members=True,members=None.html
similarity index 98%
rename from tests/snapshots/external/cc19537fdba4a26b10c60d5586b0eb7ef0264a783a3c47d1114d21fa8cfa3947.html
rename to tests/snapshots/members/filters=None,inherited_members=True,members=None.html
index f93ae024..68c7d720 100644
--- a/tests/snapshots/external/cc19537fdba4a26b10c60d5586b0eb7ef0264a783a3c47d1114d21fa8cfa3947.html
+++ b/tests/snapshots/members/filters=None,inherited_members=True,members=None.html
@@ -264,7 +264,7 @@
Bases:
-
+
Class
diff --git a/tests/snapshots/external/0b1372d7f7c057905f665ad506f3dd3bee62fb9b1c8b2a39991550e7845c2b02.html b/tests/snapshots/members/filters=None,inherited_members=True,members=True.html
similarity index 98%
rename from tests/snapshots/external/0b1372d7f7c057905f665ad506f3dd3bee62fb9b1c8b2a39991550e7845c2b02.html
rename to tests/snapshots/members/filters=None,inherited_members=True,members=True.html
index 89a3ea1e..e9f375b2 100644
--- a/tests/snapshots/external/0b1372d7f7c057905f665ad506f3dd3bee62fb9b1c8b2a39991550e7845c2b02.html
+++ b/tests/snapshots/members/filters=None,inherited_members=True,members=True.html
@@ -264,7 +264,7 @@
Bases:
-
+
Class
diff --git a/tests/snapshots/members/filters=public,inherited_members=('method1',),members=('module_attribute',).html b/tests/snapshots/members/filters=public,inherited_members=('method1',),members=('module_attribute',).html
new file mode 100644
index 00000000..befa0078
--- /dev/null
+++ b/tests/snapshots/members/filters=public,inherited_members=('method1',),members=('module_attribute',).html
@@ -0,0 +1,57 @@
+
+
+
+
+
+ members_package
+
+
+
+
+ Docstring for the package.
+
+
+
+
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+
+
+
+
+
diff --git a/tests/snapshots/members/filters=public,inherited_members=('method1',),members=().html b/tests/snapshots/members/filters=public,inherited_members=('method1',),members=().html
new file mode 100644
index 00000000..f7385cf9
--- /dev/null
+++ b/tests/snapshots/members/filters=public,inherited_members=('method1',),members=().html
@@ -0,0 +1,24 @@
+
+
+
+
+
+ members_package
+
+
+
+
+ Docstring for the package.
+
+
+
+
+
diff --git a/tests/snapshots/members/filters=public,inherited_members=('method1',),members=False.html b/tests/snapshots/members/filters=public,inherited_members=('method1',),members=False.html
new file mode 100644
index 00000000..e649c2e7
--- /dev/null
+++ b/tests/snapshots/members/filters=public,inherited_members=('method1',),members=False.html
@@ -0,0 +1,24 @@
+
+
+
+
+
+ members_package
+
+
+
+
+ Docstring for the package.
+
+
+
+
+
diff --git a/tests/snapshots/members/filters=public,inherited_members=('method1',),members=None.html b/tests/snapshots/members/filters=public,inherited_members=('method1',),members=None.html
new file mode 100644
index 00000000..5ca6f9fe
--- /dev/null
+++ b/tests/snapshots/members/filters=public,inherited_members=('method1',),members=None.html
@@ -0,0 +1,353 @@
+
+
+
+
+
+ members_package
+
+
+
+
+ Docstring for the package.
+
+
+
+
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+
+
+
+
+
+ Class
+
+
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+
+
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+
+
+
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+
+
+
+
+
+ NestedClass
+
+
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+
+
+
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+
+
+
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+
+
+
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+
+
+
+
+
+
+
+
+ Subclass
+
+
+
+
+ Bases:
+
+
+ Class
+
+
+
+
+ Docstring for
+
+ Subclass
+
+ .
+
+
+
+
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+
+
+
+
+
+
+
+
+ module_function
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+
+
+
+
+
diff --git a/tests/snapshots/members/filters=public,inherited_members=('method1',),members=True.html b/tests/snapshots/members/filters=public,inherited_members=('method1',),members=True.html
new file mode 100644
index 00000000..a191cb33
--- /dev/null
+++ b/tests/snapshots/members/filters=public,inherited_members=('method1',),members=True.html
@@ -0,0 +1,353 @@
+
+
+
+
+
+ members_package
+
+
+
+
+ Docstring for the package.
+
+
+
+
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+
+
+
+
+
+ Class
+
+
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+
+
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+
+
+
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+
+
+
+
+
+ NestedClass
+
+
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+
+
+
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+
+
+
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+
+
+
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+
+
+
+
+
+
+
+
+ Subclass
+
+
+
+
+ Bases:
+
+
+ Class
+
+
+
+
+ Docstring for
+
+ Subclass
+
+ .
+
+
+
+
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+
+
+
+
+
+
+
+
+ module_function
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+
+
+
+
+
diff --git a/tests/snapshots/members/filters=public,inherited_members=(),members=('module_attribute',).html b/tests/snapshots/members/filters=public,inherited_members=(),members=('module_attribute',).html
new file mode 100644
index 00000000..c8211de8
--- /dev/null
+++ b/tests/snapshots/members/filters=public,inherited_members=(),members=('module_attribute',).html
@@ -0,0 +1,55 @@
+
+
+
+
+
+ members_package
+
+
+
+
+ Docstring for the package.
+
+
+
+
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+
+
+
+
+
diff --git a/tests/snapshots/members/filters=public,inherited_members=(),members=().html b/tests/snapshots/members/filters=public,inherited_members=(),members=().html
new file mode 100644
index 00000000..ac0222f5
--- /dev/null
+++ b/tests/snapshots/members/filters=public,inherited_members=(),members=().html
@@ -0,0 +1,22 @@
+
+
+
+
+
+ members_package
+
+
+
+
+ Docstring for the package.
+
+
+
+
+
diff --git a/tests/snapshots/members/filters=public,inherited_members=(),members=False.html b/tests/snapshots/members/filters=public,inherited_members=(),members=False.html
new file mode 100644
index 00000000..6f76b142
--- /dev/null
+++ b/tests/snapshots/members/filters=public,inherited_members=(),members=False.html
@@ -0,0 +1,22 @@
+
+
+
+
+
+ members_package
+
+
+
+
+ Docstring for the package.
+
+
+
+
+
diff --git a/tests/snapshots/members/filters=public,inherited_members=(),members=None.html b/tests/snapshots/members/filters=public,inherited_members=(),members=None.html
new file mode 100644
index 00000000..5540be65
--- /dev/null
+++ b/tests/snapshots/members/filters=public,inherited_members=(),members=None.html
@@ -0,0 +1,318 @@
+
+
+
+
+
+ members_package
+
+
+
+
+ Docstring for the package.
+
+
+
+
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+
+
+
+
+
+ Class
+
+
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+
+
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+
+
+
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+
+
+
+
+
+ NestedClass
+
+
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+
+
+
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+
+
+
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+
+
+
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+
+
+
+
+
+
+
+
+ Subclass
+
+
+
+
+ Bases:
+
+
+ Class
+
+
+
+
+ Docstring for
+
+ Subclass
+
+ .
+
+
+
+
+
+
+
+
+
+ module_function
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+
+
+
+
+
diff --git a/tests/snapshots/members/filters=public,inherited_members=(),members=True.html b/tests/snapshots/members/filters=public,inherited_members=(),members=True.html
new file mode 100644
index 00000000..7d596388
--- /dev/null
+++ b/tests/snapshots/members/filters=public,inherited_members=(),members=True.html
@@ -0,0 +1,318 @@
+
+
+
+
+
+ members_package
+
+
+
+
+ Docstring for the package.
+
+
+
+
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+
+
+
+
+
+ Class
+
+
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+
+
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+
+
+
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+
+
+
+
+
+ NestedClass
+
+
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+
+
+
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+
+
+
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+
+
+
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+
+
+
+
+
+
+
+
+ Subclass
+
+
+
+
+ Bases:
+
+
+ Class
+
+
+
+
+ Docstring for
+
+ Subclass
+
+ .
+
+
+
+
+
+
+
+
+
+ module_function
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+
+
+
+
+
diff --git a/tests/snapshots/members/filters=public,inherited_members=False,members=('module_attribute',).html b/tests/snapshots/members/filters=public,inherited_members=False,members=('module_attribute',).html
new file mode 100644
index 00000000..e40923d9
--- /dev/null
+++ b/tests/snapshots/members/filters=public,inherited_members=False,members=('module_attribute',).html
@@ -0,0 +1,55 @@
+
+
+
+
+
+ members_package
+
+
+
+
+ Docstring for the package.
+
+
+
+
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+
+
+
+
+
diff --git a/tests/snapshots/members/filters=public,inherited_members=False,members=().html b/tests/snapshots/members/filters=public,inherited_members=False,members=().html
new file mode 100644
index 00000000..e8d65a7e
--- /dev/null
+++ b/tests/snapshots/members/filters=public,inherited_members=False,members=().html
@@ -0,0 +1,22 @@
+
+
+
+
+
+ members_package
+
+
+
+
+ Docstring for the package.
+
+
+
+
+
diff --git a/tests/snapshots/members/filters=public,inherited_members=False,members=False.html b/tests/snapshots/members/filters=public,inherited_members=False,members=False.html
new file mode 100644
index 00000000..12da79f0
--- /dev/null
+++ b/tests/snapshots/members/filters=public,inherited_members=False,members=False.html
@@ -0,0 +1,22 @@
+
+
+
+
+
+ members_package
+
+
+
+
+ Docstring for the package.
+
+
+
+
+
diff --git a/tests/snapshots/members/filters=public,inherited_members=False,members=None.html b/tests/snapshots/members/filters=public,inherited_members=False,members=None.html
new file mode 100644
index 00000000..39cf1b20
--- /dev/null
+++ b/tests/snapshots/members/filters=public,inherited_members=False,members=None.html
@@ -0,0 +1,318 @@
+
+
+
+
+
+ members_package
+
+
+
+
+ Docstring for the package.
+
+
+
+
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+
+
+
+
+
+ Class
+
+
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+
+
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+
+
+
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+
+
+
+
+
+ NestedClass
+
+
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+
+
+
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+
+
+
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+
+
+
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+
+
+
+
+
+
+
+
+ Subclass
+
+
+
+
+ Bases:
+
+
+ Class
+
+
+
+
+ Docstring for
+
+ Subclass
+
+ .
+
+
+
+
+
+
+
+
+
+ module_function
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+
+
+
+
+
diff --git a/tests/snapshots/members/filters=public,inherited_members=False,members=True.html b/tests/snapshots/members/filters=public,inherited_members=False,members=True.html
new file mode 100644
index 00000000..1973e99b
--- /dev/null
+++ b/tests/snapshots/members/filters=public,inherited_members=False,members=True.html
@@ -0,0 +1,318 @@
+
+
+
+
+
+ members_package
+
+
+
+
+ Docstring for the package.
+
+
+
+
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+
+
+
+
+
+ Class
+
+
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+
+
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+
+
+
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+
+
+
+
+
+ NestedClass
+
+
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+
+
+
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+
+
+
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+
+
+
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+
+
+
+
+
+
+
+
+ Subclass
+
+
+
+
+ Bases:
+
+
+ Class
+
+
+
+
+ Docstring for
+
+ Subclass
+
+ .
+
+
+
+
+
+
+
+
+
+ module_function
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+
+
+
+
+
diff --git a/tests/snapshots/members/filters=public,inherited_members=True,members=('module_attribute',).html b/tests/snapshots/members/filters=public,inherited_members=True,members=('module_attribute',).html
new file mode 100644
index 00000000..7b0e60a5
--- /dev/null
+++ b/tests/snapshots/members/filters=public,inherited_members=True,members=('module_attribute',).html
@@ -0,0 +1,55 @@
+
+
+
+
+
+ members_package
+
+
+
+
+ Docstring for the package.
+
+
+
+
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+
+
+
+
+
diff --git a/tests/snapshots/members/filters=public,inherited_members=True,members=().html b/tests/snapshots/members/filters=public,inherited_members=True,members=().html
new file mode 100644
index 00000000..e8f0258e
--- /dev/null
+++ b/tests/snapshots/members/filters=public,inherited_members=True,members=().html
@@ -0,0 +1,22 @@
+
+
+
+
+
+ members_package
+
+
+
+
+ Docstring for the package.
+
+
+
+
+
diff --git a/tests/snapshots/members/filters=public,inherited_members=True,members=False.html b/tests/snapshots/members/filters=public,inherited_members=True,members=False.html
new file mode 100644
index 00000000..85cb268c
--- /dev/null
+++ b/tests/snapshots/members/filters=public,inherited_members=True,members=False.html
@@ -0,0 +1,22 @@
+
+
+
+
+
+ members_package
+
+
+
+
+ Docstring for the package.
+
+
+
+
+
diff --git a/tests/snapshots/members/filters=public,inherited_members=True,members=None.html b/tests/snapshots/members/filters=public,inherited_members=True,members=None.html
new file mode 100644
index 00000000..40c14a7b
--- /dev/null
+++ b/tests/snapshots/members/filters=public,inherited_members=True,members=None.html
@@ -0,0 +1,506 @@
+
+
+
+
+
+ members_package
+
+
+
+
+ Docstring for the package.
+
+
+
+
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+
+
+
+
+
+ Class
+
+
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+
+
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+
+
+
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+
+
+
+
+
+ NestedClass
+
+
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+
+
+
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+
+
+
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+
+
+
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+
+
+
+
+
+
+
+
+ Subclass
+
+
+
+
+ Bases:
+
+
+ Class
+
+
+
+
+ Docstring for
+
+ Subclass
+
+ .
+
+
+
+
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+
+
+
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+
+
+
+
+
+ NestedClass
+
+
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+
+
+
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+
+
+
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+
+
+
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+
+
+
+
+
+
+
+
+
+ module_function
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+
+
+
+
+
diff --git a/tests/snapshots/members/filters=public,inherited_members=True,members=True.html b/tests/snapshots/members/filters=public,inherited_members=True,members=True.html
new file mode 100644
index 00000000..13b2239c
--- /dev/null
+++ b/tests/snapshots/members/filters=public,inherited_members=True,members=True.html
@@ -0,0 +1,506 @@
+
+
+
+
+
+ members_package
+
+
+
+
+ Docstring for the package.
+
+
+
+
+
+
+ module_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ module-attribute
+
+
+
+
+
+
+ Docstring for
+
+ module_attribute
+
+ .
+
+
+
+
+
+
+ Class
+
+
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+
+
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+
+
+
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+
+
+
+
+
+ NestedClass
+
+
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+
+
+
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+
+
+
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+
+
+
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+
+
+
+
+
+
+
+
+ Subclass
+
+
+
+
+ Bases:
+
+
+ Class
+
+
+
+
+ Docstring for
+
+ Subclass
+
+ .
+
+
+
+
+
+
+ class_attribute
+
+
+ =
+
+
+ 42
+
+
+
+
+
+ class-attribute
+
+
+
+
+ instance-attribute
+
+
+
+
+
+
+ Docstring for
+
+ Class.class_attribute
+
+ .
+
+
+
+
+
+
+
+ instance_attribute
+
+
+ =
+
+
+ a
+
+
+ +
+
+
+ b
+
+
+
+
+
+ instance-attribute
+
+
+
+
+
+
+ Docstring for
+
+ Class.instance_attribute
+
+ .
+
+
+
+
+
+
+ NestedClass
+
+
+
+
+ Docstring for
+
+ NestedClass
+
+ .
+
+
+
+
+
+
+
+ __init__
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ Class.__init__
+
+ .
+
+
+
+
+
+
+
+ method1
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ Class.method1
+
+ .
+
+
+
+
+
+
+
+ method2
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ Class.method2
+
+ .
+
+
+
+
+
+
+
+
+
+
+ module_function
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ module_function
+
+ .
+
+
+
+
+
+
diff --git a/tests/snapshots/overloads/overloads_only=False,separate_signature=False,show_overloads=False.html b/tests/snapshots/overloads/overloads_only=False,separate_signature=False,show_overloads=False.html
new file mode 100644
index 00000000..76234631
--- /dev/null
+++ b/tests/snapshots/overloads/overloads_only=False,separate_signature=False,show_overloads=False.html
@@ -0,0 +1,169 @@
+
+
+
+
+
+ overloads_package
+
+
+
+
+
+
+
+ Class
+
+
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+
+
+
+
+ bar
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ Class.bar
+
+ .
+
+
+
+
+
+
+
+ foo
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ Class.foo
+
+ .
+
+
+
+
+
+
+
+
+
+
+ bar
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ bar
+
+ .
+
+
+
+
+
+
+
+ foo
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ foo
+
+ .
+
+
+
+
+
+
diff --git a/tests/snapshots/overloads/overloads_only=False,separate_signature=False,show_overloads=True.html b/tests/snapshots/overloads/overloads_only=False,separate_signature=False,show_overloads=True.html
new file mode 100644
index 00000000..afa94fae
--- /dev/null
+++ b/tests/snapshots/overloads/overloads_only=False,separate_signature=False,show_overloads=True.html
@@ -0,0 +1,189 @@
+
+
+
+
+
+ overloads_package
+
+
+
+
+
+
+
+ Class
+
+
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+
+
+
+
+ bar
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ Class.bar
+
+ .
+
+
+
+
+
+
+
+ foo
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ foo(a: int, b: str) -> float
+
+
+
+ foo(a: str, b: int) -> None
+
+
+
+
+
+ Docstring for
+
+ Class.foo
+
+ .
+
+
+
+
+
+
+
+
+
+
+ bar
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ bar
+
+ .
+
+
+
+
+
+
+
+ foo
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ foo(a: int, b: str) -> float
+
+
+
+ foo(a: str, b: int) -> None
+
+
+
+
+
+ Docstring for
+
+ foo
+
+ .
+
+
+
+
+
+
diff --git a/tests/snapshots/overloads/overloads_only=False,separate_signature=True,show_overloads=False.html b/tests/snapshots/overloads/overloads_only=False,separate_signature=True,show_overloads=False.html
new file mode 100644
index 00000000..96629ba3
--- /dev/null
+++ b/tests/snapshots/overloads/overloads_only=False,separate_signature=True,show_overloads=False.html
@@ -0,0 +1,117 @@
+
+
+
+
+
+ overloads_package
+
+
+
+
+
+
+
+ Class
+
+
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+
+
+
+ bar
+
+
+
+ bar(a, b)
+
+
+
+
+ Docstring for
+
+ Class.bar
+
+ .
+
+
+
+
+
+
+ foo
+
+
+
+ foo(a, b)
+
+
+
+
+ Docstring for
+
+ Class.foo
+
+ .
+
+
+
+
+
+
+
+
+
+ bar
+
+
+
+ bar(a, b)
+
+
+
+
+ Docstring for
+
+ bar
+
+ .
+
+
+
+
+
+
+ foo
+
+
+
+ foo(a, b)
+
+
+
+
+ Docstring for
+
+ foo
+
+ .
+
+
+
+
+
+
diff --git a/tests/snapshots/overloads/overloads_only=False,separate_signature=True,show_overloads=True.html b/tests/snapshots/overloads/overloads_only=False,separate_signature=True,show_overloads=True.html
new file mode 100644
index 00000000..3f231581
--- /dev/null
+++ b/tests/snapshots/overloads/overloads_only=False,separate_signature=True,show_overloads=True.html
@@ -0,0 +1,137 @@
+
+
+
+
+
+ overloads_package
+
+
+
+
+
+
+
+ Class
+
+
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+
+
+
+ bar
+
+
+
+ bar(a, b)
+
+
+
+
+ Docstring for
+
+ Class.bar
+
+ .
+
+
+
+
+
+
+ foo
+
+
+
+
+ foo(a: int, b: str) -> float
+
+
+
+ foo(a: str, b: int) -> None
+
+
+
+
+ foo(a, b)
+
+
+
+
+ Docstring for
+
+ Class.foo
+
+ .
+
+
+
+
+
+
+
+
+
+ bar
+
+
+
+ bar(a, b)
+
+
+
+
+ Docstring for
+
+ bar
+
+ .
+
+
+
+
+
+
+ foo
+
+
+
+
+ foo(a: int, b: str) -> float
+
+
+
+ foo(a: str, b: int) -> None
+
+
+
+
+ foo(a, b)
+
+
+
+
+ Docstring for
+
+ foo
+
+ .
+
+
+
+
+
+
diff --git a/tests/snapshots/overloads/overloads_only=True,separate_signature=False,show_overloads=False.html b/tests/snapshots/overloads/overloads_only=True,separate_signature=False,show_overloads=False.html
new file mode 100644
index 00000000..23a1a9c5
--- /dev/null
+++ b/tests/snapshots/overloads/overloads_only=True,separate_signature=False,show_overloads=False.html
@@ -0,0 +1,169 @@
+
+
+
+
+
+ overloads_package
+
+
+
+
+
+
+
+ Class
+
+
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+
+
+
+
+ bar
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ Class.bar
+
+ .
+
+
+
+
+
+
+
+ foo
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ Class.foo
+
+ .
+
+
+
+
+
+
+
+
+
+
+ bar
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ bar
+
+ .
+
+
+
+
+
+
+
+ foo
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ foo
+
+ .
+
+
+
+
+
+
diff --git a/tests/snapshots/overloads/overloads_only=True,separate_signature=False,show_overloads=True.html b/tests/snapshots/overloads/overloads_only=True,separate_signature=False,show_overloads=True.html
new file mode 100644
index 00000000..79b078af
--- /dev/null
+++ b/tests/snapshots/overloads/overloads_only=True,separate_signature=False,show_overloads=True.html
@@ -0,0 +1,189 @@
+
+
+
+
+
+ overloads_package
+
+
+
+
+
+
+
+ Class
+
+
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+
+
+
+
+ bar
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ Class.bar
+
+ .
+
+
+
+
+
+
+
+ foo
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ foo(a: int, b: str) -> float
+
+
+
+ foo(a: str, b: int) -> None
+
+
+
+
+
+ Docstring for
+
+ Class.foo
+
+ .
+
+
+
+
+
+
+
+
+
+
+ bar
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ Docstring for
+
+ bar
+
+ .
+
+
+
+
+
+
+
+ foo
+
+
+ (
+
+
+ a
+
+
+ ,
+
+
+ b
+
+
+ )
+
+
+
+
+
+ foo(a: int, b: str) -> float
+
+
+
+ foo(a: str, b: int) -> None
+
+
+
+
+
+ Docstring for
+
+ foo
+
+ .
+
+
+
+
+
+
diff --git a/tests/snapshots/overloads/overloads_only=True,separate_signature=True,show_overloads=False.html b/tests/snapshots/overloads/overloads_only=True,separate_signature=True,show_overloads=False.html
new file mode 100644
index 00000000..1f1c5822
--- /dev/null
+++ b/tests/snapshots/overloads/overloads_only=True,separate_signature=True,show_overloads=False.html
@@ -0,0 +1,117 @@
+
+
+
+
+
+ overloads_package
+
+
+
+
+
+
+
+ Class
+
+
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+
+
+
+ bar
+
+
+
+ bar(a, b)
+
+
+
+
+ Docstring for
+
+ Class.bar
+
+ .
+
+
+
+
+
+
+ foo
+
+
+
+ foo(a, b)
+
+
+
+
+ Docstring for
+
+ Class.foo
+
+ .
+
+
+
+
+
+
+
+
+
+ bar
+
+
+
+ bar(a, b)
+
+
+
+
+ Docstring for
+
+ bar
+
+ .
+
+
+
+
+
+
+ foo
+
+
+
+ foo(a, b)
+
+
+
+
+ Docstring for
+
+ foo
+
+ .
+
+
+
+
+
+
diff --git a/tests/snapshots/overloads/overloads_only=True,separate_signature=True,show_overloads=True.html b/tests/snapshots/overloads/overloads_only=True,separate_signature=True,show_overloads=True.html
new file mode 100644
index 00000000..7d4b3416
--- /dev/null
+++ b/tests/snapshots/overloads/overloads_only=True,separate_signature=True,show_overloads=True.html
@@ -0,0 +1,129 @@
+
+
+
+
+
+ overloads_package
+
+
+
+
+
+
+
+ Class
+
+
+
+
+ Docstring for
+
+ Class
+
+ .
+
+
+
+
+
+ bar
+
+
+
+ bar(a, b)
+
+
+
+
+ Docstring for
+
+ Class.bar
+
+ .
+
+
+
+
+
+
+ foo
+
+
+
+
+ foo(a: int, b: str) -> float
+
+
+
+ foo(a: str, b: int) -> None
+
+
+
+
+
+ Docstring for
+
+ Class.foo
+
+ .
+
+
+
+
+
+
+
+
+
+ bar
+
+
+
+ bar(a, b)
+
+
+
+
+ Docstring for
+
+ bar
+
+ .
+
+
+
+
+
+
+ foo
+
+
+
+
+ foo(a: int, b: str) -> float
+
+
+
+ foo(a: str, b: int) -> None
+
+
+
+
+
+ Docstring for
+
+ foo
+
+ .
+
+
+
+
+
+
diff --git a/tests/snapshots/external/b060b701543e5503dc848538a164e80480ab25f8885aa83b97776e6b0cc6b570.html b/tests/snapshots/signatures/separate_signature=False,show_signature_annotations=False,signature_crossrefs=False.html
similarity index 100%
rename from tests/snapshots/external/b060b701543e5503dc848538a164e80480ab25f8885aa83b97776e6b0cc6b570.html
rename to tests/snapshots/signatures/separate_signature=False,show_signature_annotations=False,signature_crossrefs=False.html
diff --git a/tests/snapshots/external/6a02b544c12c68b75d9bf3b85b1800830fd980daabff9df8c3760eb6edea7915.html b/tests/snapshots/signatures/separate_signature=False,show_signature_annotations=False,signature_crossrefs=True.html
similarity index 100%
rename from tests/snapshots/external/6a02b544c12c68b75d9bf3b85b1800830fd980daabff9df8c3760eb6edea7915.html
rename to tests/snapshots/signatures/separate_signature=False,show_signature_annotations=False,signature_crossrefs=True.html
diff --git a/tests/snapshots/external/d1216ebf8e30ec559861678318efb45bef54a847517e5d90e130818c2a06b163.html b/tests/snapshots/signatures/separate_signature=False,show_signature_annotations=True,signature_crossrefs=False.html
similarity index 100%
rename from tests/snapshots/external/d1216ebf8e30ec559861678318efb45bef54a847517e5d90e130818c2a06b163.html
rename to tests/snapshots/signatures/separate_signature=False,show_signature_annotations=True,signature_crossrefs=False.html
diff --git a/tests/snapshots/external/735fc6ffdb82ce35cdab2aed2389a630e4d2c7ad95308bc5c7a56a8a8930b37f.html b/tests/snapshots/signatures/separate_signature=False,show_signature_annotations=True,signature_crossrefs=True.html
similarity index 100%
rename from tests/snapshots/external/735fc6ffdb82ce35cdab2aed2389a630e4d2c7ad95308bc5c7a56a8a8930b37f.html
rename to tests/snapshots/signatures/separate_signature=False,show_signature_annotations=True,signature_crossrefs=True.html
diff --git a/tests/snapshots/external/4370d843cc76138927502402ac39c80414c8441a962f6466afdb280dc022af26.html b/tests/snapshots/signatures/separate_signature=True,show_signature_annotations=False,signature_crossrefs=False.html
similarity index 93%
rename from tests/snapshots/external/4370d843cc76138927502402ac39c80414c8441a962f6466afdb280dc022af26.html
rename to tests/snapshots/signatures/separate_signature=True,show_signature_annotations=False,signature_crossrefs=False.html
index c70d8ae8..03d9e14d 100644
--- a/tests/snapshots/external/4370d843cc76138927502402ac39c80414c8441a962f6466afdb280dc022af26.html
+++ b/tests/snapshots/signatures/separate_signature=True,show_signature_annotations=False,signature_crossrefs=False.html
@@ -36,7 +36,7 @@
- __init__(a, b)
+ __init__(a, b)
diff --git a/tests/snapshots/external/9c0bfc0ee40732505dc3dab8c95ad4ed6582d10df2449c7d92f1e43a91610666.html b/tests/snapshots/signatures/separate_signature=True,show_signature_annotations=False,signature_crossrefs=True.html
similarity index 93%
rename from tests/snapshots/external/9c0bfc0ee40732505dc3dab8c95ad4ed6582d10df2449c7d92f1e43a91610666.html
rename to tests/snapshots/signatures/separate_signature=True,show_signature_annotations=False,signature_crossrefs=True.html
index 6dd48d30..8454da6d 100644
--- a/tests/snapshots/external/9c0bfc0ee40732505dc3dab8c95ad4ed6582d10df2449c7d92f1e43a91610666.html
+++ b/tests/snapshots/signatures/separate_signature=True,show_signature_annotations=False,signature_crossrefs=True.html
@@ -36,7 +36,7 @@
- __init__(a, b)
+ __init__(a, b)
diff --git a/tests/snapshots/external/f5ce06acbb7a31658cc6367db31caaf7a210c0a31e71de950e791c5eb33a6258.html b/tests/snapshots/signatures/separate_signature=True,show_signature_annotations=True,signature_crossrefs=False.html
similarity index 89%
rename from tests/snapshots/external/f5ce06acbb7a31658cc6367db31caaf7a210c0a31e71de950e791c5eb33a6258.html
rename to tests/snapshots/signatures/separate_signature=True,show_signature_annotations=True,signature_crossrefs=False.html
index 08ae8776..9edcf4c5 100644
--- a/tests/snapshots/external/f5ce06acbb7a31658cc6367db31caaf7a210c0a31e71de950e791c5eb33a6258.html
+++ b/tests/snapshots/signatures/separate_signature=True,show_signature_annotations=True,signature_crossrefs=False.html
@@ -36,7 +36,7 @@
- __init__(a: int, b: str) -> None
+ __init__(a: int, b: str) -> None
diff --git a/tests/snapshots/external/955e5111f4262f280b0787a22dfa46c9ea93c80bc49e1a1de100349341d93fb9.html b/tests/snapshots/signatures/separate_signature=True,show_signature_annotations=True,signature_crossrefs=True.html
similarity index 61%
rename from tests/snapshots/external/955e5111f4262f280b0787a22dfa46c9ea93c80bc49e1a1de100349341d93fb9.html
rename to tests/snapshots/signatures/separate_signature=True,show_signature_annotations=True,signature_crossrefs=True.html
index ee00ece7..e9ac18ce 100644
--- a/tests/snapshots/external/955e5111f4262f280b0787a22dfa46c9ea93c80bc49e1a1de100349341d93fb9.html
+++ b/tests/snapshots/signatures/separate_signature=True,show_signature_annotations=True,signature_crossrefs=True.html
@@ -36,7 +36,7 @@
- __init__(a: int , b: str ) -> None
+ __init__(a: int , b: str ) -> None
@@ -56,7 +56,7 @@
- method1(a: int , b: str ) -> None
+ method1(a: int , b: str ) -> None
@@ -79,7 +79,7 @@
- module_function(a: int , b: str ) -> None
+ module_function(a: int , b: str ) -> None
diff --git a/tests/test_api.py b/tests/test_api.py
new file mode 100644
index 00000000..a1c8412c
--- /dev/null
+++ b/tests/test_api.py
@@ -0,0 +1,190 @@
+"""Tests for our own API exposition."""
+
+from __future__ import annotations
+
+from collections import defaultdict
+from pathlib import Path
+from typing import TYPE_CHECKING
+
+import griffe
+import pytest
+from mkdocstrings import Inventory
+
+from mkdocstrings_handlers import python
+
+if TYPE_CHECKING:
+ from collections.abc import Iterator
+
+
+@pytest.fixture(name="loader", scope="module")
+def _fixture_loader() -> griffe.GriffeLoader:
+ loader = griffe.GriffeLoader()
+ loader.load("mkdocstrings")
+ loader.load("mkdocstrings_handlers.python")
+ loader.resolve_aliases()
+ return loader
+
+
+@pytest.fixture(name="internal_api", scope="module")
+def _fixture_internal_api(loader: griffe.GriffeLoader) -> griffe.Module:
+ return loader.modules_collection["mkdocstrings_handlers.python._internal"]
+
+
+@pytest.fixture(name="public_api", scope="module")
+def _fixture_public_api(loader: griffe.GriffeLoader) -> griffe.Module:
+ return loader.modules_collection["mkdocstrings_handlers.python"]
+
+
+def _yield_public_objects(
+ obj: griffe.Module | griffe.Class | griffe.Alias,
+ *,
+ modules: bool = False,
+ modulelevel: bool = True,
+ inherited: bool = False,
+ special: bool = False,
+) -> Iterator[griffe.Object | griffe.Alias]:
+ for member in obj.all_members.values() if inherited else obj.members.values():
+ try:
+ if member.is_module:
+ if member.is_alias or not member.is_public:
+ continue
+ assert isinstance(member, griffe.Module)
+ if modules:
+ yield member
+ yield from _yield_public_objects(
+ member,
+ modules=modules,
+ modulelevel=modulelevel,
+ inherited=inherited,
+ special=special,
+ )
+ elif member.is_public and (special or not member.is_special):
+ yield member
+ else:
+ continue
+ if member.is_class and not modulelevel:
+ assert isinstance(member, (griffe.Class, griffe.Alias))
+ yield from _yield_public_objects(
+ member,
+ modules=modules,
+ modulelevel=False,
+ inherited=inherited,
+ special=special,
+ )
+ except (griffe.AliasResolutionError, griffe.CyclicAliasError):
+ continue
+
+
+@pytest.fixture(name="modulelevel_internal_objects", scope="module")
+def _fixture_modulelevel_internal_objects(internal_api: griffe.Module) -> list[griffe.Object | griffe.Alias]:
+ return list(_yield_public_objects(internal_api, modulelevel=True))
+
+
+@pytest.fixture(name="internal_objects", scope="module")
+def _fixture_internal_objects(internal_api: griffe.Module) -> list[griffe.Object | griffe.Alias]:
+ return list(_yield_public_objects(internal_api, modulelevel=False, special=True))
+
+
+@pytest.fixture(name="public_objects", scope="module")
+def _fixture_public_objects(public_api: griffe.Module) -> list[griffe.Object | griffe.Alias]:
+ return list(_yield_public_objects(public_api, modulelevel=False, inherited=True, special=True))
+
+
+@pytest.fixture(name="inventory", scope="module")
+def _fixture_inventory() -> Inventory:
+ inventory_file = Path(__file__).parent.parent / "site" / "objects.inv"
+ if not inventory_file.exists():
+ pytest.skip("The objects inventory is not available.") # ty: ignore[call-non-callable]
+ with inventory_file.open("rb") as file:
+ return Inventory.parse_sphinx(file)
+
+
+def test_exposed_objects(modulelevel_internal_objects: list[griffe.Object | griffe.Alias]) -> None:
+ """All public objects in the internal API are exposed under `mkdocstrings_handlers.python`."""
+ not_exposed = [
+ obj.path
+ for obj in modulelevel_internal_objects
+ if obj.name not in python.__all__ or not hasattr(python, obj.name)
+ ]
+ assert not not_exposed, "Objects not exposed:\n" + "\n".join(sorted(not_exposed))
+
+
+def test_unique_names(modulelevel_internal_objects: list[griffe.Object | griffe.Alias]) -> None:
+ """All internal objects have unique names."""
+ names_to_paths = defaultdict(list)
+ for obj in modulelevel_internal_objects:
+ names_to_paths[obj.name].append(obj.path)
+ non_unique = [paths for paths in names_to_paths.values() if len(paths) > 1]
+ assert not non_unique, "Non-unique names:\n" + "\n".join(str(paths) for paths in non_unique)
+
+
+def test_single_locations(public_api: griffe.Module) -> None:
+ """All objects have a single public location."""
+
+ def _public_path(obj: griffe.Object | griffe.Alias) -> bool:
+ return obj.is_public and (obj.parent is None or _public_path(obj.parent))
+
+ multiple_locations = {}
+ for obj_name in python.__all__:
+ obj = public_api[obj_name]
+ if obj.aliases and (
+ public_aliases := [path for path, alias in obj.aliases.items() if path != obj.path and _public_path(alias)]
+ ):
+ multiple_locations[obj.path] = public_aliases
+ assert not multiple_locations, "Multiple public locations:\n" + "\n".join(
+ f"{path}: {aliases}" for path, aliases in multiple_locations.items()
+ )
+
+
+def test_api_matches_inventory(inventory: Inventory, public_objects: list[griffe.Object | griffe.Alias]) -> None:
+ """All public objects are added to the inventory."""
+ ignore_names = {"__getattr__", "__init__", "__repr__", "__str__", "__post_init__"}
+ not_in_inventory = [
+ f"{obj.relative_filepath}:{obj.lineno}: {obj.path}"
+ for obj in public_objects
+ if obj.name not in ignore_names and obj.path not in inventory
+ ]
+ msg = "Objects not in the inventory (try running `make run mkdocs build`):\n{paths}"
+ assert not not_in_inventory, msg.format(paths="\n".join(sorted(not_in_inventory)))
+
+
+def _module_or_child(parent: str, name: str) -> bool:
+ parents = [parent[:i] for i, char in enumerate(parent) if char == "."]
+ parents.append(parent)
+ return name in parents or name.startswith(parent + ".")
+
+
+def test_inventory_matches_api(
+ inventory: Inventory,
+ public_objects: list[griffe.Object | griffe.Alias],
+ loader: griffe.GriffeLoader,
+) -> None:
+ """The inventory doesn't contain any additional Python object."""
+ not_in_api = []
+ public_api_paths = {obj.path for obj in public_objects}
+ public_api_paths.add("mkdocstrings_handlers")
+ public_api_paths.add("mkdocstrings_handlers.python")
+
+ for item in inventory.values():
+ if item.domain == "py" and "(" not in item.name and _module_or_child("mkdocstrings_handlers.python", item.name):
+ obj = loader.modules_collection[item.name]
+ if obj.path not in public_api_paths and not any(path in public_api_paths for path in obj.aliases):
+ not_in_api.append(item.name)
+ msg = "Inventory objects not in public API (try running `make run mkdocs build`):\n{paths}"
+ assert not not_in_api, msg.format(paths="\n".join(sorted(not_in_api)))
+
+
+def test_no_module_docstrings_in_internal_api(internal_api: griffe.Module) -> None:
+ """No module docstrings should be written in our internal API.
+
+ The reasoning is that docstrings are addressed to users of the public API,
+ but internal modules are not exposed to users, so they should not have docstrings.
+ """
+
+ def _modules(obj: griffe.Module) -> Iterator[griffe.Module]:
+ for member in obj.modules.values():
+ yield member
+ yield from _modules(member)
+
+ for obj in _modules(internal_api):
+ assert not obj.docstring
diff --git a/tests/test_config.py b/tests/test_config.py
new file mode 100644
index 00000000..5c12a418
--- /dev/null
+++ b/tests/test_config.py
@@ -0,0 +1,61 @@
+"""Tests for configuration options."""
+
+from __future__ import annotations
+
+import inspect
+from dataclasses import asdict, fields
+from typing import TYPE_CHECKING, Any
+
+import pytest
+from griffe import Parser, parse_google, parse_numpy, parse_sphinx
+
+from mkdocstrings_handlers.python import AutoStyleOptions, GoogleStyleOptions, NumpyStyleOptions, SphinxStyleOptions
+from mkdocstrings_handlers.python._internal.handler import _filter_parser_options
+
+if TYPE_CHECKING:
+ from collections.abc import Callable
+
+
+@pytest.mark.parametrize(
+ ("options_class", "parser"),
+ [
+ (GoogleStyleOptions, parse_google),
+ (NumpyStyleOptions, parse_numpy),
+ (SphinxStyleOptions, parse_sphinx),
+ ],
+)
+def test_style_options_match_griffe_parser(options_class: type[Any], parser: Callable[..., object]) -> None:
+ """Ensure style options stay in sync with Griffe parser options."""
+ option_names = {field.name for field in fields(options_class)}
+ parser_parameters = inspect.signature(parser).parameters
+ parser_option_names = set(parser_parameters) - {"docstring"}
+
+ assert parser_option_names <= option_names
+
+
+def test_filter_style_options(caplog: pytest.LogCaptureFixture) -> None:
+ """Ensure unsupported options are not passed to Griffe and are reported."""
+ options = asdict(SphinxStyleOptions())
+
+ filtered_options = _filter_parser_options(Parser.sphinx, options)
+
+ assert filtered_options == {
+ name: value for name, value in options.items() if name in inspect.signature(parse_sphinx).parameters
+ }
+ assert "warn_missing_types" in options
+ for name in set(options) - set(filtered_options or {}):
+ assert f"Ignoring unsupported sphinx docstring parser option: {name}" in caplog.text
+
+
+def test_filter_auto_style_options(caplog: pytest.LogCaptureFixture) -> None:
+ """Ensure unsupported options nested in auto style options are reported."""
+ options = asdict(AutoStyleOptions())
+
+ filtered_options = _filter_parser_options(Parser.auto, options)
+
+ assert filtered_options is not None
+ if "warn_missing_types" in inspect.signature(parse_sphinx).parameters:
+ assert "warn_missing_types" in filtered_options["per_style_options"]["sphinx"]
+ else:
+ assert "warn_missing_types" not in filtered_options["per_style_options"]["sphinx"]
+ assert "Ignoring unsupported sphinx docstring parser option: warn_missing_types" in caplog.text
diff --git a/tests/test_end_to_end.py b/tests/test_end_to_end.py
index 161dcdf2..3363ebd6 100644
--- a/tests/test_end_to_end.py
+++ b/tests/test_end_to_end.py
@@ -9,19 +9,20 @@
import bs4
import pytest
from griffe import LinesCollection, ModulesCollection, TmpPackage, temporary_pypackage
-from inline_snapshot import outsource
-
-from tests.snapshots import snapshots_members, snapshots_signatures
+from inline_snapshot import external_file, register_format_alias
if TYPE_CHECKING:
from collections.abc import Iterator
- from mkdocstrings_handlers.python.handler import PythonHandler
+ from mkdocstrings_handlers.python import PythonHandler
+
+
+register_format_alias(".html", ".txt")
def _normalize_html(html: str) -> str:
soup = bs4.BeautifulSoup(html, features="html.parser")
- html = soup.prettify() # type: ignore[assignment]
+ html = soup.prettify()
html = re.sub(r"\b(0x)[a-f0-9]+\b", r"\1...", html)
html = re.sub(r"^(Build Date UTC ?:).+", r"\1...", html, flags=re.MULTILINE)
html = re.sub(r"\b[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}\b", r"...", html)
@@ -59,13 +60,20 @@ def _render_options(options: dict[str, Any]) -> str:
return f"\n\n"
-# Signature options
+def _snapshot_file(group: str, options: dict[str, Any]) -> str:
+ return f"snapshots/{group}/" + ",".join(f"{k}={v}" for k, v in sorted(options.items())) + ".html"
+
+
+# Signature tests.
@pytest.fixture(name="signature_package", scope="session")
def _signature_package() -> Iterator[TmpPackage]:
code = """
def module_function(a: int, b: str) -> None:
'''Docstring for `module_function`.'''
+ def _private_function(a: int, b: str) -> None:
+ '''Docstring for `_private_function`.'''
+
class Class:
'''Docstring for `Class`.'''
@@ -95,17 +103,78 @@ def test_end_to_end_for_signatures(
identifier: Parametrized identifier.
session_handler: Python handler (fixture).
"""
- final_options = {
+ options = {
"show_signature_annotations": show_signature_annotations,
"signature_crossrefs": signature_crossrefs,
"separate_signature": separate_signature,
}
- html = _render_options(final_options) + _render(session_handler, signature_package, final_options)
- snapshot_key = tuple(sorted(final_options.items()))
- assert outsource(html, suffix=".html") == snapshots_signatures[snapshot_key]
+ html = _render_options(options) + _render(session_handler, signature_package, options)
+ assert html == external_file(_snapshot_file("signatures", options), format=".txt")
+
+
+# Signature overloads tests.
+@pytest.fixture(name="overloads_package", scope="session")
+def _overloads_package() -> Iterator[TmpPackage]:
+ code = """
+ from typing_extensions import overload
+
+ @overload
+ def foo(a: int, b: str) -> float: ...
+
+ @overload
+ def foo(a: str, b: int) -> None: ...
+
+ def foo(a: str | int, b: int | str) -> float | None:
+ '''Docstring for `foo`.'''
+
+ def bar(a: str, b: int | str) -> float | None:
+ '''Docstring for `bar`.'''
+
+ class Class:
+ '''Docstring for `Class`.'''
+
+ @overload
+ def foo(self, a: int, b: str) -> float: ...
+
+ @overload
+ def foo(self, a: str, b: int) -> None: ...
+
+ def foo(self, a: str | int, b: int | str) -> float | None:
+ '''Docstring for `Class.foo`.'''
+
+ def bar(self, a: str, b: int | str) -> float | None:
+ '''Docstring for `Class.bar`.'''
+ """
+ with temporary_pypackage("overloads_package", {"__init__.py": code}) as tmppkg:
+ yield tmppkg
+
+
+@pytest.mark.parametrize("separate_signature", [True, False])
+@pytest.mark.parametrize("show_overloads", [True, False])
+@pytest.mark.parametrize("overloads_only", [True, False])
+def test_end_to_end_for_overloads(
+ session_handler: PythonHandler,
+ overloads_package: TmpPackage,
+ separate_signature: bool,
+ show_overloads: bool,
+ overloads_only: bool,
+) -> None:
+ """Test rendering of a given theme's templates.
+
+ Parameters:
+ identifier: Parametrized identifier.
+ session_handler: Python handler (fixture).
+ """
+ options = {
+ "separate_signature": separate_signature,
+ "show_overloads": show_overloads,
+ "overloads_only": overloads_only,
+ }
+ html = _render_options(options) + _render(session_handler, overloads_package, options)
+ assert html == external_file(_snapshot_file("overloads", options), format=".txt")
-# Members options.
+# Member tests.
@pytest.fixture(name="members_package", scope="session")
def _members_package() -> Iterator[TmpPackage]:
code = """
@@ -146,7 +215,7 @@ class Subclass(Class):
@pytest.mark.parametrize("inherited_members", [(), ("method1",), True, False])
@pytest.mark.parametrize("members", [(), ("module_attribute",), True, False, None])
-@pytest.mark.parametrize("filters", [(), ("!module_attribute",), ("module_attribute",), None])
+@pytest.mark.parametrize("filters", [(), ("!module_attribute",), ("module_attribute",), "public", None])
def test_end_to_end_for_members(
session_handler: PythonHandler,
members_package: TmpPackage,
@@ -160,11 +229,55 @@ def test_end_to_end_for_members(
identifier: Parametrized identifier.
session_handler: Python handler (fixture).
"""
- final_options = {
+ options = {
"inherited_members": inherited_members,
"members": members,
"filters": filters,
}
- html = _render_options(final_options) + _render(session_handler, members_package, final_options)
- snapshot_key = tuple(sorted(final_options.items()))
- assert outsource(html, suffix=".html") == snapshots_members[snapshot_key]
+ html = _render_options(options) + _render(session_handler, members_package, options)
+ assert html == external_file(_snapshot_file("members", options), format=".txt")
+
+
+# Heading tests.
+@pytest.fixture(name="headings_package", scope="session")
+def _headings_package() -> Iterator[TmpPackage]:
+ code = """
+ def module_function(a: int, b: str) -> None:
+ pass
+
+ class Class:
+ class_attribute: int = 42
+
+ def __init__(self, a: int, b: str) -> None:
+ self.instance_attribute = a + b
+
+ def method1(self, a: int, b: str) -> None:
+ pass
+
+ module_attribute: int = 42
+ """
+ with temporary_pypackage("headings_package", {"__init__.py": code}) as tmppkg:
+ yield tmppkg
+
+
+@pytest.mark.parametrize("separate_signature", [True, False])
+@pytest.mark.parametrize("heading", ["", "Some heading"])
+def test_end_to_end_for_headings(
+ session_handler: PythonHandler,
+ headings_package: TmpPackage,
+ separate_signature: bool,
+ heading: str,
+) -> None:
+ """Test rendering of a given theme's templates.
+
+ Parameters:
+ identifier: Parametrized identifier.
+ session_handler: Python handler (fixture).
+ """
+ options = {
+ "separate_signature": separate_signature,
+ "heading": heading,
+ }
+ extra = {"show_if_no_docstring": True, "members": False}
+ html = _render_options(options) + _render(session_handler, headings_package, {**options, **extra})
+ assert html == external_file(_snapshot_file("headings", options), format=".txt")
diff --git a/tests/test_handler.py b/tests/test_handler.py
index 7cf8dc54..323d4266 100644
--- a/tests/test_handler.py
+++ b/tests/test_handler.py
@@ -4,19 +4,30 @@
import os
import sys
+from dataclasses import replace
from glob import glob
+from io import BytesIO
from pathlib import Path
from textwrap import dedent
from typing import TYPE_CHECKING
+import bs4
+import mkdocstrings
import pytest
-from griffe import DocstringSectionExamples, DocstringSectionKind, temporary_visited_module
+from griffe import (
+ Docstring,
+ DocstringSectionExamples,
+ DocstringSectionKind,
+ Module,
+ temporary_inspected_module,
+ temporary_visited_module,
+)
+from mkdocstrings import CollectionError
-from mkdocstrings_handlers.python.config import PythonConfig, PythonOptions
-from mkdocstrings_handlers.python.handler import CollectionError, PythonHandler
+from mkdocstrings_handlers.python import Inventory, PythonConfig, PythonHandler, PythonOptions
if TYPE_CHECKING:
- from mkdocstrings.plugin import MkdocstringsPlugin
+ from mkdocstrings import MkdocstringsPlugin
def test_collect_missing_module(handler: PythonHandler) -> None:
@@ -160,9 +171,6 @@ def function(self):
""",
)
with temporary_visited_module(code) as module:
- # TODO: Remove once Griffe does that automatically.
- module.lines_collection[module.filepath] = code.splitlines() # type: ignore[index]
-
module["Class"].lineno = None
module["Class.function"].lineno = None
module["attribute"].lineno = None
@@ -173,9 +181,230 @@ def test_give_precedence_to_user_paths() -> None:
"""Assert user paths take precedence over default paths."""
last_sys_path = sys.path[-1]
handler = PythonHandler(
+ theme="material",
+ custom_templates=None,
base_dir=Path("."),
config=PythonConfig.from_data(paths=[last_sys_path]),
mdx=[],
mdx_config={},
)
assert handler._paths[0] == last_sys_path
+
+
+@pytest.mark.parametrize(
+ ("section", "code"),
+ [
+ (
+ "Attributes",
+ """
+ class A:
+ '''Summary.
+
+ Attributes:
+ x: X.
+ y: Y.
+ '''
+ x: int = 0
+ '''X.'''
+ y: int = 0
+ '''Y.'''
+ """,
+ ),
+ (
+ "Methods",
+ """
+ class A:
+ '''Summary.
+
+ Methods:
+ x: X.
+ y: Y.
+ '''
+ def x(self): ...
+ '''X.'''
+ def y(self): ...
+ '''Y.'''
+ """,
+ ),
+ (
+ "Functions",
+ """
+ '''Summary.
+
+ Functions:
+ x: X.
+ y: Y.
+ '''
+ def x(): ...
+ '''X.'''
+ def y(): ...
+ '''Y.'''
+ """,
+ ),
+ (
+ "Classes",
+ """
+ '''Summary.
+
+ Classes:
+ A: A.
+ B: B.
+ '''
+ class A: ...
+ '''A.'''
+ class B: ...
+ '''B.'''
+ """,
+ ),
+ (
+ "Modules",
+ """
+ '''Summary.
+
+ Modules:
+ a: A.
+ b: B.
+ '''
+ """,
+ ),
+ ],
+)
+def test_deduplicate_summary_sections(handler: PythonHandler, section: str, code: str) -> None:
+ """Assert summary sections are deduplicated."""
+ summary_section = section.lower()
+ summary_section = "functions" if summary_section == "methods" else summary_section
+ with temporary_visited_module(code, docstring_parser="google") as module:
+ if summary_section == "modules":
+ module.set_member("a", Module("A", docstring=Docstring("A.")))
+ module.set_member("b", Module("B", docstring=Docstring("B.")))
+ html = handler.render(
+ module,
+ handler.get_options(
+ {
+ "summary": {summary_section: True},
+ "show_source": False,
+ "show_submodules": True,
+ },
+ ),
+ )
+ assert html.count(f"{section}:") == 1
+
+
+def test_inheriting_self_from_parent_class(handler: PythonHandler) -> None:
+ """Inspect self only once when inheriting it from parent class."""
+ with temporary_inspected_module(
+ """
+ class A: ...
+ class B(A): ...
+ A.B = B
+ """,
+ ) as module:
+ # Assert no recusrion error.
+ handler.render(
+ module,
+ handler.get_options({"inherited_members": True}),
+ )
+
+
+def test_specifying_inventory_base_url(handler: PythonHandler) -> None:
+ """Assert that the handler renders inventory URLs using the specified base_url."""
+ # Update handler config to include an inventory with a base URL
+ base_url = "https://docs.com/my_library"
+ inventory = Inventory(url="https://example.com/objects.inv", base_url=base_url)
+ handler.config = replace(handler.config, inventories=[inventory])
+
+ # Mock inventory bytes
+ item_name = "my_library.my_module.MyClass"
+ mocked_inventory = mkdocstrings.Inventory()
+ mocked_inventory.register(
+ name=item_name,
+ domain="py",
+ role="class",
+ uri=f"api-reference/#{item_name}",
+ dispname=item_name,
+ )
+ mocked_bytes = BytesIO(mocked_inventory.format_sphinx())
+
+ # Get inventory URL and config
+ url, config = handler.get_inventory_urls()[0]
+
+ # Load the mocked inventory
+ _, item_url = next(handler.load_inventory(mocked_bytes, url, **config))
+
+ # Assert the URL is based on the provided base URL
+ msg = "Expected inventory URL to start with base_url"
+ assert item_url.startswith(base_url), msg
+
+
+def _source_labels(html: str) -> list[Path]:
+ soup = bs4.BeautifulSoup(html, features="html.parser")
+ labels = []
+ for summary in soup.find_all("summary"):
+ if "Source code in" in summary.get_text():
+ code_tag = summary.find("code")
+ assert code_tag is not None
+ labels.append(Path(code_tag.get_text(strip=True)))
+ return labels
+
+
+def _write_site_packages_package(tmp_path: Path, *, single_module: bool) -> None:
+ """Lay out the issue-333 scenario: a package installed in a virtual environment inside the project.
+
+ The environment's `site-packages` directory is relative to the current
+ working directory, so the package's `relative_filepath` is relative too,
+ slipping past `is_absolute()` checks.
+ """
+ code = """
+ class Model:
+ '''Model docstring.'''
+
+ def __init__(self) -> None:
+ '''Init docstring.'''
+ self.model_attribute = 0
+
+ def method(self) -> None:
+ '''Method docstring.'''
+ """
+ site = tmp_path / "site-packages"
+ module_path = site / "pkg.py" if single_module else site / "pkg" / "__init__.py"
+ module_path.parent.mkdir(parents=True)
+ module_path.write_text(dedent(code), encoding="utf-8")
+
+
+@pytest.mark.parametrize(
+ "handler",
+ [
+ {"theme": "readthedocs"},
+ {"theme": {"name": "material"}},
+ ],
+ indirect=["handler"],
+)
+@pytest.mark.parametrize(
+ ("single_module", "extra_options", "expected_label"),
+ [
+ pytest.param(False, {"merge_init_into_class": True}, Path("pkg", "__init__.py"), id="merged-init"),
+ pytest.param(False, {}, Path("pkg", "__init__.py"), id="class-and-methods"),
+ pytest.param(True, {"merge_init_into_class": True}, Path("pkg.py"), id="single-module"),
+ ],
+)
+def test_no_environment_path_in_source_labels(
+ *,
+ tmp_path: Path,
+ monkeypatch: pytest.MonkeyPatch,
+ handler: PythonHandler,
+ single_module: bool,
+ extra_options: dict,
+ expected_label: Path,
+) -> None:
+ """Assert source labels never show an environment path."""
+ _write_site_packages_package(tmp_path, single_module=single_module)
+ monkeypatch.chdir(tmp_path)
+ # `collect()` reads the search paths lazily from this attribute.
+ handler._paths = [str(tmp_path / "site-packages")]
+ options = handler.get_options({"show_source": True, **extra_options})
+ html = handler.render(handler.collect("pkg.Model", options), options)
+ labels = _source_labels(html)
+ assert labels
+ assert set(labels) == {expected_label}
+ # The source bodies themselves are still rendered.
+ assert "model_attribute" in html
diff --git a/tests/test_rendering.py b/tests/test_rendering.py
index 98da5d9c..3709ec95 100644
--- a/tests/test_rendering.py
+++ b/tests/test_rendering.py
@@ -4,12 +4,12 @@
import re
from dataclasses import dataclass
-from typing import TYPE_CHECKING, Any, Callable
+from typing import TYPE_CHECKING, Any, Callable, cast
import pytest
-from griffe import ModulesCollection, temporary_visited_module
+from griffe import Alias, ModulesCollection, Object, temporary_visited_module
-from mkdocstrings_handlers.python import rendering
+from mkdocstrings_handlers.python._internal import rendering
if TYPE_CHECKING:
from markupsafe import Markup
@@ -58,6 +58,8 @@ def test_format_signature(name: Markup, signature: str) -> None:
class _FakeObject:
name: str
inherited: bool = False
+ parent: None = None
+ is_alias: bool = False
@pytest.mark.parametrize(
@@ -76,7 +78,7 @@ def test_filter_objects(names: list[str], filter_params: dict[str, Any], expecte
expected_names: Names expected to be kept.
"""
objects = {name: _FakeObject(name) for name in names}
- filtered = rendering.do_filter_objects(objects, **filter_params) # type: ignore[arg-type]
+ filtered = rendering.do_filter_objects(cast("dict[str, Object | Alias]", objects), **filter_params)
filtered_names = {obj.name for obj in filtered}
assert set(filtered_names) == set(expected_names)
diff --git a/tests/test_themes.py b/tests/test_themes.py
index a7b44795..5a7e9038 100644
--- a/tests/test_themes.py
+++ b/tests/test_themes.py
@@ -7,7 +7,7 @@
import pytest
if TYPE_CHECKING:
- from mkdocstrings.handlers.python import PythonHandler
+ from mkdocstrings_handlers.python import PythonHandler
@pytest.mark.parametrize(
@@ -22,13 +22,9 @@
@pytest.mark.parametrize(
"identifier",
[
- "mkdocstrings.extension",
- "mkdocstrings.inventory",
- "mkdocstrings.loggers",
- "mkdocstrings.plugin",
- "mkdocstrings.handlers.base",
- "mkdocstrings.handlers.rendering",
- "mkdocstrings_handlers.python",
+ "mkdocstrings_handlers.python._internal.config",
+ "mkdocstrings_handlers.python._internal.handler",
+ "mkdocstrings_handlers.python._internal.rendering",
],
)
def test_render_themes_templates_python(identifier: str, handler: PythonHandler) -> None: