-
I tried to follow the documentation here: https://mkdocstrings.github.io/griffe/guide/users/how-to/selectively-inspect/ Creating a file called import griffe
class InspectSpecificObjects(griffe.Extension):
"""An extension to inspect just a few specific objects."""
def __init__(self, objects: list[str]) -> None:
self.objects = objects
def on_instance(self, *, obj: griffe.Object, **kwargs) -> None:
if obj.path not in self.objects:
return
inspected_module = griffe.inspect(obj.module.path, filepath=obj.filepath)
obj.parent.set_member(obj.name, inspected_module[obj.name]) and get the following error
When I instead try to simplify to import griffe
class InspectSpecificObjects(griffe.Extension):
"""An extension to inspect just a few specific objects."""
def on_instance(self, *, obj: griffe.Object, **kwargs) -> None:
inspected_module = griffe.inspect(obj.module.path, filepath=obj.filepath)
if obj.module.path == 'module_qc_database_tools.review.checks' and isinstance(obj, griffe.Function):
obj.parent.set_member(obj.name, inspected_module[obj.name]) I instead get
which confuses me quite a lot... I'm not sure how to write a functional extension that updates some function's docstrings using dynamic introspection. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Indeed in the first example the extension requires an argument: plugins:
- mkdocstrings:
handlers:
python:
options:
extensions:
- docs/my_extension.py:
objects: [some, objects] Your second error message looks super weird to me. "No such command 'build'" then proceeds to build anyway?
Try running in verbose mode to get more logs: |
Beta Was this translation helpful? Give feedback.
Indeed in the first example the extension requires an argument:
Your second error message looks super weird to me. "No such command 'build'" then proceeds to build anyway?
Try running in verbose mode to get more logs:
mkdocs build -v
. I won't be able to help without more info 😄