Griffe: Signatures for entire Python programs

I figured I could announce Griffe here since it reached v1 recently.

Griffe is a tool that uses static and dynamic analysis to extract API information from your code base. Thanks to this API data, it is able to compare snapshots of your code base (at different Git references) to find breaking changes in your API. This can help make SemVer a bit more reliable, or simply prevent breakages by running Griffe in CI. Other downstream tools can also use this API data to render API documentation. Griffe is actually what powers mkdocstrings-python (in short, a MkDocs plugin to render Python API docs), and quartodoc (a similar plugin for Quarto). Other projects use it to parse docstrings, as it supports parsing Google-style, Numpydoc-style and Sphinx-style docstrings into dataclasses shared between all styles.

Griffe heavily relies on the awesome ast module from the standard library: my warmest thanks to its maintainers and contributors!

An extension system allows Python developers to enhance or modify the data Griffe extracts by writing Griffe extensions, for example to support third-party libraries or draft PEPs.

Well, I could say more, but I’ve put a lot of effort into rewriting the documentation, so if I got you interested, please head over to the docs and let me know what you think of it :smiling_face: Happy to answer any question here!

11 Likes

By the way we have a discussion on the repo about standardizing the serialization format (or even the Python structures) for representing Python APIs: Adopt a shared specification for api structure · mkdocstrings/griffe · Discussion #287 · GitHub. Could be an interesting discussion to have here too.

This is exceptional, congratulations! I think the cargo-semver author is working on a similar thing too, for Python of course.

Griffe was exceptional and this is yet another cherry on top!

1 Like

Thanks a lot!

I checked https://github.com/obi1kenobi’s GitHub repositories but couldn’t find anything like Griffe :thinking: If you have a link, I’d love to check it out :smile: