Update custom provider docs formatting

This commit is contained in:
Roman Mogylatov 2022-12-18 21:42:55 -05:00
parent 781d3b9c4c
commit a79ea1790c
2 changed files with 5 additions and 3 deletions

View File

@ -15,6 +15,7 @@ Development version
and ``actions/download-artifact@v3``. and ``actions/download-artifact@v3``.
- Fix install crash on non-utf8 systems `#644 <https://github.com/ets-labs/python-dependency-injector/pull/644>`_. - 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 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. - Regenerate C sources using Cython 0.29.32.
4.40.0 4.40.0

View File

@ -17,9 +17,10 @@ To create a custom provider you need to follow these rules:
2. You need to implement the ``Provider._provide()`` method. 2. You need to implement the ``Provider._provide()`` method.
3. You need to implement the ``Provider.__deepcopy__()`` method. It should return an 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 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 from the ``providers`` module. It's essential to pass ``memo`` into ``deepcopy`` in order to keep
``Provider._copy_overriding()`` method to copy all overriding providers. See the example the preconfigured ``args`` and ``kwargs`` of stored providers. After the a new provider object
below. 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 4. If new provider has a ``__init__()`` method, it should call the parent
``Provider.__init__()``. ``Provider.__init__()``.
5. If new provider stores any other providers, these providers should be listed in 5. If new provider stores any other providers, these providers should be listed in