Skip to content

Releases: mkdocstrings/griffe

1.2.0

23 Aug 19:25
Compare
Choose a tag to compare

1.2.0 - 2024-08-23

Compare with 1.1.1

Features

  • Support attribute syntax in __all__ values (ad99794 by Timothée Mazzucotelli). Issue-316

1.1.1

20 Aug 12:37
Compare
Choose a tag to compare

1.1.1 - 2024-08-20

Compare with 1.1.0

Bug Fixes

  • Pre-emptively expand __all__ values and wildcard imports before firing the on_package_loaded event (21b3780 by Timothée Mazzucotelli).

1.1.0

17 Aug 16:08
Compare
Choose a tag to compare

1.1.0 - 2024-08-17

Compare with 1.0.0

Features

  • Add on_wildcard_expansion event (c6bc6fa by Timothée Mazzucotelli). Issue-282
  • Add on_alias event (a760a8c by Timothée Mazzucotelli). Issue-282
  • Pass loader to on_package_loaded hooks (7f82dc3 by Timothée Mazzucotelli).

1.0.0

16 Aug 13:46
Compare
Choose a tag to compare

1.0.0 - 2024-08-15

Compare with 0.49.0

V1! 🚀 🔥 🌈

Breaking changes

Highlights:

  • Extensions inherit from Extension, (VisitorExtension and InspectorExtension are removed)
  • Members are serialized (as_dict/JSON) as a dictionary instead of a list
  • All objects are available in the top-level griffe module, nowhere else

Removed objects:

  • all modules under the griffe package
  • the griffe.DocstringWarningCallable class
  • the griffe.When class
  • the griffe.ExtensionType type
  • the griffe.InspectorExtension class
  • the griffe.VisitorExtension class
  • the griffe.HybridExtension extension
  • the griffe.patch_logger function
  • the griffe.JSONEncoder.docstring_parser attribute
  • the griffe.JSONEncoder.docstring_options attribute
  • the griffe.Extensions.attach_visitor method
  • the griffe.Extensions.attach_inspector method
  • the griffe.Extensions.before_visit method
  • the griffe.Extensions.before_children_visit method
  • the griffe.Extensions.after_children_visit method
  • the griffe.Extensions.after_visit method
  • the griffe.Extensions.before_inspection method
  • the griffe.Extensions.before_children_inspection method
  • the griffe.Extensions.after_children_inspection method
  • the griffe.Extensions.after_inspection method
  • the griffe.GriffeLoader.load_module method
  • the has_special_name and has_private_name properties on objects
  • the is_explicitely_exported and is_implicitely_exported properties on objects
  • the member_is_exported method on objects

Renamed/moved objects:

  • griffe.Function.setter -> griffe.Attribute.setter
  • griffe.Function.deleter -> griffe.Attribute.deleter

Signatures:

  • griffe.docstring_warning(name) parameter was removed
  • griffe.GriffeLoader.load(module) parameter was removed
  • griffe.load(module) parameter was removed
  • griffe.load_git(module) parameter was removed
  • griffe.find_breaking_changes(ignore_private) parameter was removed
  • see previous deprecations

Code Refactoring

0.49.0

14 Aug 17:27
Compare
Choose a tag to compare

0.49.0 - 2024-08-14

Compare with 0.48.0

WARNING: ⚡ Imminent v1! ⚡🚀 See v0.46.

Deprecations

  • Cancel deprecation of get_logger and patch_loggers (and deprecate patch_logger instead). Extensions need loggers too, distinct ones, and they were forgotten... Sorry for the back and forth 🙇
  • Attributes setter and deleter on Function are deprecated. They were moved into the Attribute class since properties are instantiated as attributes, not functions.
  • Extension hooks must accept **kwargs in their signature, to allow forward-compatibility. Accepting **kwargs also makes it possible to remove unused arguments from the signature.
  • In version 1, Griffe will serialize object members as dictionaries instead of lists. Lists were initially used to preserve source order, but source order can be re-obtained thanks to the line number attributes (lineno, endlineno). Version 0.49 is able to load both lists and dictionaries from JSON dumps, and version 1 will maintain this ability. However external tools loading JSON dumps will need to be updated.

Features

  • Add temporary_inspected_package helper (3c4ba16 by Timothée Mazzucotelli).
  • Accept alias resolution related parameters in temporary_visited_package (7d5408a by Timothée Mazzucotelli).
  • Accept inits parameter in temporary_visited_package (a4859b7 by Timothée Mazzucotelli).
  • Warn (DEBUG) when an object coming from a sibling, parent or external module instead of the current module or a submodule is exported (listed in __all__) (f82317a by Timothée Mazzucotelli). Issue-249, Related-to-PR-251
  • Pass down agent to extension hooks (71acb01 by Timothée Mazzucotelli). Issue-312
  • Add source property to docstrings, which return the docstring lines as written in the source (3f6a71a by Timothée Mazzucotelli). Issue-90

Bug Fixes

  • Move setter and deleter to Attribute class instead of Function, since that's how properties are instantiated (309c6e3 by Timothée Mazzucotelli). Issue-311
  • Reduce risk of recursion errors by excluding imported objects from has_docstrings, unless they're public (9296ca7 by Timothée Mazzucotelli). Issue-302
  • Fix retrieval of annotations from parent for Yields section in properties (8a21f4d by Timothée Mazzucotelli). Issue-298
  • Fix parsing Yields section (Google-style) when yielded values are tuples, and the description has more lines than tuple values (9091776 by Timothée Mazzucotelli).
  • Fix condition on objects kinds when merging stubs (727f99b by Timothée Mazzucotelli).

Code Refactoring

  • Sort keys when dumping JSON from the command line (8cdffe9 by Timothée Mazzucotelli). Issue-310
  • Handle both lists and dicts for members when loading JSON data in preparation of v1 (f89050c by Timothée Mazzucotelli). Issue-310
  • Accept **kwargs in extension hooks to allow forward-compatibility (2621d52 by Timothée Mazzucotelli). Issue-312
  • Revert deprecation of patch_loggers in favor of patch_logger (a20796a by Timothée Mazzucotelli).
  • Expose dummy load_pypi in non-Insiders version (a69cffd by Timothée Mazzucotelli).
  • Don't emit deprecation warnings through own usage of deprecated API (9922d74 by Timothée Mazzucotelli). Issue-mkdocstrings#676
  • Finish preparing docstring style auto-detection feature (03bdec6 by Timothée Mazzucotelli). Issue-5
  • Add DocstringStyle literal type to prepare docstring style auto detection feature (b7aaf64 by Timothée Mazzucotelli). Issue-5
  • Inherit from str, Enum instead of StrEnum which needs a backport (77f1544 by Timothée Mazzucotelli). Issue-307

0.48.0

15 Jul 09:22
Compare
Choose a tag to compare

0.48.0 - 2024-07-15

Compare with 0.47.0

WARNING: ⚡ Imminent v1! ⚡🚀 See v0.46.

Deprecations

  • All submodules are deprecated. All objects are now exposed in the top-level griffe module.
  • All logger names are deprecated, and will be replaced with "griffe" in v1. In v1 our single "griffe" logger will provide a method to temporarily disable logging, [logger.disable()][griffe.Logger.disable], since that's the most common third-party use.
  • The get_logger function is deprecated. Instead, we'll use a global logger internally, and users are welcome to use it too.
  • The patch_loggers function is renamed patch_logger.
  • Following the logging changes, the [docstring_warning][griffe.docstring_warning] function can now directly log a warning message instead of returning a callable that does. Passing it a logger name (to get a callable) is deprecated in favor of passing it a docstring, message and offset directly.

Features

  • Support FORCE_COLOR environment variable (e1b7bd9 by Timothée Mazzucotelli).

Bug Fixes

  • Don't take a shortcut to the end of an alias chain when getting/setting/deleting alias members (1930609 by Timothée Mazzucotelli).
  • Short-circuit __all__ convention when checking if a module is public (5abf4e3 by Timothée Mazzucotelli).
  • Reuse existing loggers, preventing overwriting issues (3c2825f by Timothée Mazzucotelli).
  • Ignore .pth files that are not utf-8 encoded (ea299dc by Andrew Sansom). Issue-300, PR-301
  • Attributes without annotations cannot be dataclass parameters (c9b2e09 by Hassan Kibirige). PR-297
  • When deciding to alias an object or not during inspection, consider module paths to be equivalent even with arbitrary private components (8c9f6e6 by Timothée Mazzucotelli). Issue-296
  • Fix target path computation: use qualified names to maintain classes in the path (6e17def by Timothée Mazzucotelli). Issue-296

Code Refactoring

  • Prepare loggers for simplification (381f10f by Timothée Mazzucotelli).
  • Add all previous modules for backward compatibility (a86e44e by Timothée Mazzucotelli).
  • Add main public modules (fb860b3 by Timothée Mazzucotelli).
  • Simplify "is imported" check in is_public property (c2bbc10 by Timothée Mazzucotelli).
  • Use string and integer enumerations (06b383b by Timothée Mazzucotelli).
  • Renamed agents nodes modules (ddc5b0c by Timothée Mazzucotelli).
  • Clean up and document internal API, mark legacy code (92594a9 by Timothée Mazzucotelli).
  • Renamed dataclasses internal modules to models (5555de6 by Timothée Mazzucotelli).
  • Move sources under _griffe internal package (cbce6a5 by Timothée Mazzucotelli).

0.47.0

18 Jun 11:14
Compare
Choose a tag to compare

0.47.0 - 2024-06-18

Compare with 0.46.1

WARNING: ⚡ Imminent v1! ⚡🚀 See v0.46.

Deprecations

  • The has_private_name and has_special_name properties on objects and aliases have been renamed is_private and is_special. The is_private property now only returns true if the name is not special.

Features

  • Add deprecated attribute and is_deprecated property to objects/aliases (2a75d84 by Timothée Mazzucotelli).
  • Add is_imported property to objects/aliases (de926cc by Timothée Mazzucotelli).
  • Add is_class_private property to objects/aliases (491b6c4 by Timothée Mazzucotelli).

Code Refactoring

  • Rename has_private_name and has_special_name to is_private and is_special (ae7c7e7 by Timothée Mazzucotelli).

0.46.1

17 Jun 10:19
Compare
Choose a tag to compare

0.46.1 - 2024-06-17

Compare with 0.46.0

WARNING: ⚡ Imminent v1! ⚡🚀 See v0.46.

Bug Fixes

  • Always consider special objects ("dunder" attributes/methods/etc.) to be public (3319410 by Timothée Mazzucotelli). Issue-294, Issue-295
  • Don't consider imported objects as public (ea90952 by Timothée Mazzucotelli). Discussion-169

0.46.0

16 Jun 17:32
Compare
Choose a tag to compare

0.46.0 - 2024-06-16

Compare with 0.45.3

WARNING: ⚡ Imminent v1! ⚡🚀
We are working on v1, and it will come soon, so we recommend that you consider adding an upper bound on Griffe. Version 1 will remove all legacy code! There will be a couple more v0 before so that you get all the deprecation warnings needed to upgrade your code using Griffe before upgrading to v1. See breaking changes and deprecations for v0.46 below.

Breaking Changes

We are still in v0, so no major bump yet.

  • Calling objects' [has_labels()][griffe.Object.has_labels] method with a labels keyword argument is not supported anymore. The parameter became a variadic positional parameter, so it cannot be used as a keyword argument anymore. Passing a sequence instead of multiple positional arguments still works but will emit a deprecation warning.
  • Calling the [load_extensions()][griffe.load_extensions] function with an exts keyword argument is not supported anymore. The parameter became a variadic positional parameter, so it cannot be used as a keyword argument anymore. Passing a sequence instead of multiple positional arguments still works but will emit a deprecation warning.

Deprecations

  • As seen above in the breaking changes section, the only parameters of [Object.has_labels()][griffe.Object.has_labels] and [load_extensions()][griffe.load_extensions] both became variadic positional parameters. Passing a sequence as single argument is deprecated in favor of passing multiple arguments. This is an ergonomic change: I myself often forgot to wrap extensions in a list. Passing sequences of labels (lists, sets, tuples) is also difficult from Jinja templates.
  • The following methods and properties on objects and aliases are deprecated: [member_is_exported()][griffe.Object.member_is_exported], [is_explicitely_exported][griffe.mixins.ObjectAliasMixin.is_explicitely_exported], [is_implicitely_exported][griffe.mixins.ObjectAliasMixin.is_implicitely_exported]. Use the [is_exported][griffe.mixins.ObjectAliasMixin.is_exported] property instead. See issue 281.
  • The [is_exported()][griffe.mixins.ObjectAliasMixin.is_exported] and [is_public()][griffe.mixins.ObjectAliasMixin.is_public] methods became properties. They can still be called like methods, but will emit deprecation warnings when doing so. See issue 281.
  • The ignore_private parameter of the [find_breaking_changes()][griffe.find_breaking_changes] function is now deprecated and unused. With the reworked "exported" and "public" API, this parameter became useless. See issue 281.
  • Using stats() instead of [Stats][griffe.stats.Stats] will now emit a deprecation warning.

Features

Bug Fixes

  • Handle partials as functions while inspecting (be29c32 by Timothée Mazzucotelli).
  • Populate lines collection before visiting/inspecting modules within helpers (08c3f40 by Timothée Mazzucotelli). Issue-272
  • Don't return all lines when line numbers are missing (9e6dcaa by Timothée Mazzucotelli). Issue-271

Code Refactoring

  • Emit deprecation warning when accessing stats instead of Stats (e5572d2 by Timothée Mazzucotelli).
  • Rework "exported" and "public" logic (b327b90 by Timothée Mazzucotelli). Issue-281
  • Allow passing multiple extensions to load_extensions instead of a sequence (fadb72b by Timothée Mazzucotelli). Issue-268
  • Allow passing multiple labels to Object.has_labels instead of set (c4e3bf2 by Timothée Mazzucotelli). Issue-267

0.45.3

09 Jun 11:16
Compare
Choose a tag to compare

0.45.3 - 2024-06-09

Compare with 0.45.2

Bug Fixes

  • Always call on_package_loaded hook on a package, and not any other object (40db38d by Timothée Mazzucotelli). Issue-283