Skip to content

Commit b14ae38

Browse files
docs: visualize the User example dependency graph
1 parent 5daed12 commit b14ae38

6 files changed

Lines changed: 119 additions & 2 deletions

File tree

‎CHANGES‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ Backwards incompatible:
160160
- Removed previously deprecated constructs: with_injector, Injector.install_into, Binder.bind_scope
161161
- Dependencies are no longer injected into Module.configure and raw module functions (previously
162162
deprecated)
163-
- Removed unofficial support for injecting into parent class constructors
163+
- Removed unofficial support for injecting into parent class constructors
164164

165165
0.15.0
166166
------

‎MANIFEST.in‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ include pytest.ini
1010
recursive-include docs *.html
1111
recursive-include docs *.py
1212
recursive-include docs *.rst
13+
recursive-include docs *.png
14+
recursive-include docs *.svg
1315
recursive-include docs Makefile
1416
exclude .readthedocs.yaml
1517
exclude .coveragerc
10.8 KB
Loading

‎docs/_static/user-dependency-graph.svg‎

Lines changed: 98 additions & 0 deletions
Loading

‎docs/conf.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@
244244

245245

246246
# Example configuration for intersphinx: refer to the Python standard library.
247-
intersphinx_mapping = {'http://docs.python.org/': None}
247+
intersphinx_mapping = {'python': ('https://docs.python.org/3', None)}
248248

249249

250250
def setup(app):

‎docs/terminology.rst‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,23 @@ Or transitively::
133133
>>> user.description
134134
'Sherlock is a man of astounding insight'
135135

136+
The example above forms the following dependency graph. Arrows point from
137+
an object or provider to the binding key it requires: ``User`` needs both
138+
``Name`` and ``Description``, and the ``Description`` provider also needs
139+
``Name``. The same ``Name`` binding supplies both injection sites.
140+
141+
.. figure:: _static/user-dependency-graph.png
142+
:alt: User depends on Name and Description; the provider for Description also depends on Name.
143+
:width: 854px
144+
145+
Dependencies in the User example. ``Name`` is bound to ``'Sherlock'``;
146+
``Description`` is supplied by ``UserAttributeModule.describe``.
147+
:download:`Editable SVG <_static/user-dependency-graph.svg>`.
148+
Diagram created with `svgdiagram.ai <https://svgdiagram.ai>`_.
149+
150+
This graph describes binding dependencies. Instance reuse is controlled by
151+
:ref:`scopes`, so a shared binding key does not by itself imply singleton scope.
152+
136153
Assisted injection
137154
``````````````````
138155

0 commit comments

Comments
 (0)