Skip to content
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

API checks: double pass, static+dynamic analysis #211

Closed
pawamoy opened this issue Sep 21, 2023 · 4 comments
Closed

API checks: double pass, static+dynamic analysis #211

pawamoy opened this issue Sep 21, 2023 · 4 comments
Assignees
Labels
feature New feature or request fund Issue priority can be boosted insiders Candidate for Insiders

Comments

@pawamoy
Copy link
Member

pawamoy commented Sep 21, 2023

Is your feature request related to a problem? Please describe.
Sometimes classes/functions/methods are decorated with callables that modify them. It's always possible to write Griffe extensions to support those statically, and they're not that hard to write, but that still requires some development time, maybe even maintenancev.

Describe the solution you'd like
For quick reports on possible breaking changes, it would be nice to allow checking breakages with dynamic analysis.

Describe alternatives you've considered
If we implement a force_inspection option, users could run both static and dynamic analysis separately. Maybe that's a simpler alternative indeed.

Boost priority

  • Boost priority in our backlog through Polar.sh. Higher pledge, higher priority.
  • Minimum pledge by user/organization is $5, minimum amount for boost is $30.
  • View all issues with pledges.
  • We receive the funds once the issue is completed and confirmed by you.
  • Features with the insiders label are released to sponsors first, and tied to a funding goal.
Fund with Polar
@pawamoy pawamoy added the feature New feature or request label Sep 21, 2023
@pawamoy pawamoy self-assigned this Jun 8, 2024
@kilianyp
Copy link

kilianyp commented Aug 8, 2024

I believe I am currently running into this.

There's the following use case:

class Foo:
	"""Foo"""

class Bar:
	__doc__ = Foo.__doc__

This currently doesn't work in the static context to my understanding, only in the dynamic. There's no way to specify forcing an object to be read dynamically AFAIK.

@pawamoy
Copy link
Member Author

pawamoy commented Aug 8, 2024

There is, with a Griffe extension 🙂 I'm yet to cover this common use-case in the docs.

@pawamoy pawamoy added fund Issue priority can be boosted insiders Candidate for Insiders labels Oct 22, 2024
@multimeric
Copy link

This option appears in the docs. Does that mean it has been implemented?

@pawamoy
Copy link
Member Author

pawamoy commented Jan 20, 2025

Yes, you can now use griffe check -x to force dynamic analysis 🙂

We also have this how-to: https://mkdocstrings.github.io/griffe/guide/users/how-to/selectively-inspect/.

Thanks for the reminder @multimeric, I'll close this for now since users can use static or dynamic analysis when checking. I don't think providing an option to do a double pass would be very useful: correct API loading must be done thanks to extension rather than blind static+dynamic analysis.

Upvoters, let me know if I'm wrong and why! 🥰

@pawamoy pawamoy closed this as not planned Won't fix, can't repro, duplicate, stale Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request fund Issue priority can be boosted insiders Candidate for Insiders
Projects
None yet
Development

No branches or pull requests

3 participants