griffe icon indicating copy to clipboard operation
griffe copied to clipboard

API checks: double pass, static+dynamic analysis

Open pawamoy opened this issue 2 years ago • 2 comments

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 avatar Sep 21 '23 16:09 pawamoy

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.

kilianyp avatar Aug 08 '24 11:08 kilianyp

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

pawamoy avatar Aug 08 '24 12:08 pawamoy

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

multimeric avatar Jan 20 '25 05:01 multimeric

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 avatar Jan 20 '25 10:01 pawamoy