Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Force inspection #94

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mdelmans opened this issue Aug 1, 2023 · 4 comments · Fixed by #231
Closed

Force inspection #94

mdelmans opened this issue Aug 1, 2023 · 4 comments · Fixed by #231
Labels
feature New feature or request

Comments

@mdelmans
Copy link

mdelmans commented Aug 1, 2023

Is your feature request related to a problem? Please describe.
I have some dynamically-generated classes that need to be inspected rather than visited and I can't find an option to force inspection.

Describe the solution you'd like
Would be nice to have a force_inspection option.

Describe alternatives you've considered
I tried importing classes manually inside extension but extensions do not provide access to griffe inspector to fetch dynamic class attributes.

Additional context
I'm dealing with for Pydantic BaseModel classes and I managed to inject field info through an extension and override the template to render things the way I want. Some of my models are dynamically-generated and their attributes are not picked up.

Inside my extension, I import the class, inspect its fields and add an extra key to each attribute containing field info. But for the dynamically-generated models I have no attributes to inject field info to.

Hope it makes sense.

@pawamoy
Copy link
Member

pawamoy commented Aug 2, 2023

Thanks for the request, I think it makes sense 🙂
You can try and send a PR to the Griffe repo to add such an option if you want.

You might also be interested in the extension we provide for Pydantic: https://mkdocstrings.github.io/griffe-pydantic/. Note that it's only available to sponsors. It's probably possible to improve it to support your use-case.

@pawamoy
Copy link
Member

pawamoy commented Aug 25, 2023

May I ask why you closed your request @mdelmans 🙂?

@pawamoy pawamoy reopened this Aug 30, 2023
@pawamoy
Copy link
Member

pawamoy commented Aug 30, 2023

I'm still interested so I reopened, hope you don't mind.

@mdelmans
Copy link
Author

mdelmans commented Sep 4, 2023

@pawamoy sorry, didn't mean to. Happy if it stays open.

@pawamoy pawamoy added the feature New feature or request label Apr 13, 2024
pawamoy pushed a commit that referenced this issue Jan 23, 2025
Griffe supports this option but mkdocstrings-python didn't allow users to configure it.

Issue-94: #94
PR-231: #231
viktorlashchuk added a commit to viktorlashchuk/mkdocstrings-python that referenced this issue Feb 24, 2025
Griffe supports this option but mkdocstrings-python didn't allow users to configure it.

Issue-94: mkdocstrings/python#94
PR-231: mkdocstrings/python#231
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants