Skip to content

Commit 707a348

Browse files
committed
feat: Add extra attribute to objects
This attribute acts as a namespaced dictionary and is used by extensions to add information to the objects. If a particular projects expects to find extra data in `obj.extra["project"]`, then extensions who wish to communicate data to this project can write into its "project" namespace/dictionary. Extensions can also simply write to their own namespace, using their distribution name for example.
1 parent 591bacc commit 707a348

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

src/griffe/dataclasses.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ def __init__(
358358
self.exports: set[str] | list[str | Name] | None = None
359359
self.aliases: dict[str, Alias] = {}
360360
self.runtime: bool = runtime
361+
self.extra: dict[str, dict[str, Any]] = defaultdict(dict)
361362
self._lines_collection: LinesCollection | None = lines_collection
362363
self._modules_collection: ModulesCollection | None = modules_collection
363364

0 commit comments

Comments
 (0)