Releases: mkdocstrings/griffe
Releases · mkdocstrings/griffe
1.2.0
1.2.0 - 2024-08-23
Features
1.1.1
1.1.0
1.0.0
1.0.0 - 2024-08-15
V1! 🚀 🔥 🌈
Breaking changes
Highlights:
- Extensions inherit from
Extension
, (VisitorExtension
andInspectorExtension
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
andhas_private_name
properties on objects - the
is_explicitely_exported
andis_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 removedgriffe.GriffeLoader.load(module)
parameter was removedgriffe.load(module)
parameter was removedgriffe.load_git(module)
parameter was removedgriffe.find_breaking_changes(ignore_private)
parameter was removed- see previous deprecations
Code Refactoring
0.49.0
0.49.0 - 2024-08-14
WARNING: ⚡ Imminent v1! ⚡🚀 See v0.46.
Deprecations
- Cancel deprecation of
get_logger
andpatch_loggers
(and deprecatepatch_logger
instead). Extensions need loggers too, distinct ones, and they were forgotten... Sorry for the back and forth 🙇 - Attributes
setter
anddeleter
onFunction
are deprecated. They were moved into theAttribute
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 intemporary_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
anddeleter
toAttribute
class instead ofFunction
, 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 ofpatch_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 ofStrEnum
which needs a backport (77f1544 by Timothée Mazzucotelli). Issue-307
0.48.0
0.48.0 - 2024-07-15
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 globallogger
internally, and users are welcome to use it too. - The
patch_loggers
function is renamedpatch_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 tomodels
(5555de6 by Timothée Mazzucotelli). - Move sources under
_griffe
internal package (cbce6a5 by Timothée Mazzucotelli).
0.47.0
0.47.0 - 2024-06-18
WARNING: ⚡ Imminent v1! ⚡🚀 See v0.46.
Deprecations
- The
has_private_name
andhas_special_name
properties on objects and aliases have been renamedis_private
andis_special
. Theis_private
property now only returns true if the name is not special.
Features
- Add
deprecated
attribute andis_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
andhas_special_name
tois_private
andis_special
(ae7c7e7 by Timothée Mazzucotelli).
0.46.1
0.46.0
0.46.0 - 2024-06-16
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 alabels
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 anexts
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
- Add
docstring
attribute to parameters (e21eabe by Hassan Kibirige). Issue-286, Related-to-mkdocstrings/griffe#252, PR-288, Co-authored-by: Timothée Mazzucotelli [email protected] - Provide line numbers for classes and functions when inspecting (b6ddcc4 by Timothée Mazzucotelli). Issue-272
- Populate lines collection within helpers (ab2e947 by Timothée Mazzucotelli). GitHub-issue-270, Radicle-issue-0d6a513
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 ofStats
(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