diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d154658..5120a58a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [2.0.3](https://github.com/mkdocstrings/python/releases/tag/2.0.3) - 2026-02-20 + +[Compare with 2.0.2](https://github.com/mkdocstrings/python/compare/2.0.2...2.0.3) + +### Build + +- Depend on griffelib instead of griffe ([770a5f6](https://github.com/mkdocstrings/python/commit/770a5f69d801f24f0b36d1e671a540196e06f710) by Timothée Mazzucotelli). + ## [2.0.2](https://github.com/mkdocstrings/python/releases/tag/2.0.2) - 2026-02-09 [Compare with 2.0.1](https://github.com/mkdocstrings/python/compare/2.0.1...2.0.2) diff --git a/README.md b/README.md index 6210b54a..2d559588 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,6 @@ dependencies = [
diff --git a/pyproject.toml b/pyproject.toml index 2d6c7188..96d3c713 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,7 +32,7 @@ classifiers = [ dependencies = [ "mkdocstrings>=0.30", "mkdocs-autorefs>=1.4", - "griffe>=1.13", + "griffelib>=2.0", "typing-extensions>=4.0; python_version < '3.11'", ] diff --git a/scripts/gen_credits.py b/scripts/gen_credits.py index 6a81e239..0eab7685 100644 --- a/scripts/gen_credits.py +++ b/scripts/gen_credits.py @@ -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/griffe_extensions.py b/scripts/griffe_extensions.py index eb50f5f2..5a4447ca 100644 --- a/scripts/griffe_extensions.py +++ b/scripts/griffe_extensions.py @@ -24,7 +24,7 @@ def on_attribute_instance( if attr.docstring: return try: - field: griffe.ExprCall = attr.annotation.slice.elements[1] # type: ignore[union-attr] + field: griffe.ExprCall = attr.annotation.slice.elements[1] except AttributeError: return diff --git a/src/mkdocstrings_handlers/python/_internal/config.py b/src/mkdocstrings_handlers/python/_internal/config.py index 79ba87f9..f9f8963b 100644 --- a/src/mkdocstrings_handlers/python/_internal/config.py +++ b/src/mkdocstrings_handlers/python/_internal/config.py @@ -498,7 +498,7 @@ class PythonInputOptions: those added to `__all__` or not starting with an underscore (except for special methods/attributes). """, ), - ] = field(default_factory=lambda: _DEFAULT_FILTERS.copy()) + ] = field(default_factory=_DEFAULT_FILTERS.copy) find_stubs_package: Annotated[ bool, diff --git a/src/mkdocstrings_handlers/python/_internal/handler.py b/src/mkdocstrings_handlers/python/_internal/handler.py index 0fae5dc1..b84cd8ba 100644 --- a/src/mkdocstrings_handlers/python/_internal/handler.py +++ b/src/mkdocstrings_handlers/python/_internal/handler.py @@ -203,7 +203,7 @@ def collect(self, identifier: str, options: PythonOptions) -> CollectorItem: extensions=load_extensions(*extensions), search_paths=self._paths, docstring_parser=parser, - docstring_options=parser_options, # type: ignore[arg-type] + docstring_options=parser_options, modules_collection=self._modules_collection, lines_collection=self._lines_collection, allow_inspection=options.allow_inspection, diff --git a/src/mkdocstrings_handlers/python/_internal/rendering.py b/src/mkdocstrings_handlers/python/_internal/rendering.py index 20ae7c54..a906b465 100644 --- a/src/mkdocstrings_handlers/python/_internal/rendering.py +++ b/src/mkdocstrings_handlers/python/_internal/rendering.py @@ -414,15 +414,15 @@ def _keep_object(name: str, filters: Sequence[tuple[Pattern, bool]]) -> bool: def _parents(obj: Alias) -> set[str]: - parent: Object | Alias = obj.parent # type: ignore[assignment] + parent: Object | Alias = obj.parent parents = {obj.path, parent.path} if parent.is_alias: - parents.add(parent.final_target.path) # type: ignore[union-attr] + parents.add(parent.final_target.path) while parent.parent: parent = parent.parent parents.add(parent.path) if parent.is_alias: - parents.add(parent.final_target.path) # type: ignore[union-attr] + parents.add(parent.final_target.path) return parents @@ -431,7 +431,7 @@ def _remove_cycles(objects: list[Object | Alias]) -> Iterator[Object | Alias]: for obj in objects: if obj.is_alias: with suppress_errors: - if obj.final_target.path in _parents(obj): # type: ignore[arg-type,union-attr] + if obj.final_target.path in _parents(obj): continue yield obj @@ -778,7 +778,7 @@ def expand_identifier(self, identifier: str) -> str: obj = self.current_object while identifier and identifier[0] == ".": identifier = identifier[1:] - obj = obj.parent # type: ignore[assignment] + obj = obj.parent identifier = f"{obj.path}.{identifier}" if identifier else obj.path # We resolve the identifier to its full path. @@ -809,8 +809,8 @@ def get_context(self) -> AutorefsHookInterface.Context: }.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] + filepath = self.current_object.docstring.parent.filepath + lineno = self.current_object.docstring.lineno or 0 except AttributeError: filepath = self.current_object.filepath lineno = 0 diff --git a/tests/test_api.py b/tests/test_api.py index 3322e2e6..85432b54 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -51,7 +51,7 @@ def _yield_public_objects( if modules: yield member yield from _yield_public_objects( - member, # type: ignore[arg-type] + member, modules=modules, modulelevel=modulelevel, inherited=inherited, @@ -63,7 +63,7 @@ def _yield_public_objects( continue if member.is_class and not modulelevel: yield from _yield_public_objects( - member, # type: ignore[arg-type] + member, modules=modules, modulelevel=False, inherited=inherited, diff --git a/tests/test_rendering.py b/tests/test_rendering.py index 2616610f..91f945a8 100644 --- a/tests/test_rendering.py +++ b/tests/test_rendering.py @@ -78,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(objects, **filter_params) filtered_names = {obj.name for obj in filtered} assert set(filtered_names) == set(expected_names)