mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-21 17:16:46 +03:00
Update custom provider docs formatting
This commit is contained in:
parent
781d3b9c4c
commit
a79ea1790c
|
@ -15,6 +15,7 @@ Development version
|
|||
and ``actions/download-artifact@v3``.
|
||||
- Fix install crash on non-utf8 systems `#644 <https://github.com/ets-labs/python-dependency-injector/pull/644>`_.
|
||||
- Update FastAPI Redis example to use ``aioredis`` version 2 `#613 <https://github.com/ets-labs/python-dependency-injector/pull/613>`_.
|
||||
- Update documentation on creating custom providers `#598 <https://github.com/ets-labs/python-dependency-injector/pull/598>`_.
|
||||
- Regenerate C sources using Cython 0.29.32.
|
||||
|
||||
4.40.0
|
||||
|
|
|
@ -17,9 +17,10 @@ To create a custom provider you need to follow these rules:
|
|||
2. You need to implement the ``Provider._provide()`` method.
|
||||
3. You need to implement the ``Provider.__deepcopy__()`` method. It should return an
|
||||
equivalent copy of a provider. All providers must be copied with the ``deepcopy()`` function
|
||||
from the ``providers`` module. It's essential to pass ``memo`` into ``deepcopy`` in order to keep the preconfigured ``args`` and ``kwargs`` of stored providers. After the a new provider object is created, use
|
||||
``Provider._copy_overriding()`` method to copy all overriding providers. See the example
|
||||
below.
|
||||
from the ``providers`` module. It's essential to pass ``memo`` into ``deepcopy`` in order to keep
|
||||
the preconfigured ``args`` and ``kwargs`` of stored providers. After the a new provider object
|
||||
is created, use ``Provider._copy_overriding()`` method to copy all overriding providers. See the
|
||||
example below.
|
||||
4. If new provider has a ``__init__()`` method, it should call the parent
|
||||
``Provider.__init__()``.
|
||||
5. If new provider stores any other providers, these providers should be listed in
|
||||
|
|
Loading…
Reference in New Issue
Block a user