mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-22 09:36:48 +03:00
Update docs
This commit is contained in:
parent
4e66c47f59
commit
38c9d2f18a
|
@ -15,6 +15,13 @@ from dependency_injector import errors
|
|||
def inject(*args, **kwargs):
|
||||
"""Dependency injection decorator.
|
||||
|
||||
.. warning::
|
||||
|
||||
:py:func:`inject` decorator has been deprecated since version 2.2.0.
|
||||
|
||||
Usage of :py:func:`inject` decorator can lead to bad design and could
|
||||
be considered as anti-pattern.
|
||||
|
||||
:py:func:`inject` decorator can be used for making inline dependency
|
||||
injections. It patches decorated callable in such way that dependency
|
||||
injection will be done during every call of decorated callable.
|
||||
|
|
|
@ -9,6 +9,10 @@ Current section of documentation describes advanced usage of
|
|||
|
||||
.. currentmodule:: dependency_injector.injections
|
||||
|
||||
.. warning::
|
||||
|
||||
:py:func:`inject` decorator has been deprecated since version 2.2.0.
|
||||
|
||||
:py:func:`inject` decorator is a part of
|
||||
:py:mod:`dependency_injector.injections` module.
|
||||
|
||||
|
|
|
@ -7,6 +7,5 @@ API Documentation
|
|||
top_level
|
||||
providers
|
||||
containers
|
||||
injections
|
||||
utils
|
||||
errors
|
||||
|
|
|
@ -9,8 +9,8 @@ Examples
|
|||
"Dependency Injector" framework.
|
||||
|
||||
Current section of documentation is designed to provide several example mini
|
||||
applications that are built on the top of inversion of control principle and
|
||||
powered by *Dependency Injector* framework.
|
||||
applications that are built according to the inversion of control principle
|
||||
and powered by *Dependency Injector* framework.
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
|
|
@ -20,14 +20,14 @@ Like Martin says:
|
|||
|
||||
While original Martin's MovieLister example was a bit modified here, it
|
||||
makes sense to provide some description. So, the idea of this example is to
|
||||
create ``movies`` library that can be configurable to work with different
|
||||
movie databases (csv, sqlite) and provide 2 main features:
|
||||
create ``movies`` library that can be configured to work with different
|
||||
movie databases (csv, sqlite, etc...) and provide 2 main features:
|
||||
|
||||
1. List all movies that were directed by certain person.
|
||||
2. List all movies that were released in certain year.
|
||||
|
||||
Also this example contains 3 mini applications that are based on ``movies``
|
||||
library :
|
||||
library:
|
||||
|
||||
1. ``app_csv.py`` - list movies by certain criteria from csv file database.
|
||||
2. ``app_db.py`` - list movies by certain criteria from sqlite database.
|
||||
|
@ -38,8 +38,6 @@ Instructions for running:
|
|||
|
||||
.. code-block:: bash
|
||||
|
||||
python create_db.py
|
||||
|
||||
python app_csv.py
|
||||
python app_db.py
|
||||
python app_db_csv.py
|
||||
|
@ -74,6 +72,30 @@ Listing of ``movies/__init__.py``:
|
|||
:language: python
|
||||
:linenos:
|
||||
|
||||
Example application
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Example application structure:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
/example
|
||||
/__init__.py
|
||||
/db.py
|
||||
/main.py
|
||||
|
||||
Listing of ``examples/main.py``:
|
||||
|
||||
.. literalinclude:: ../../examples/miniapps/movie_lister/example/main.py
|
||||
:language: python
|
||||
:linenos:
|
||||
|
||||
Listing of ``examples/db.py``:
|
||||
|
||||
.. literalinclude:: ../../examples/miniapps/movie_lister/example/db.py
|
||||
:language: python
|
||||
:linenos:
|
||||
|
||||
Csv application
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
|
|
|
@ -59,7 +59,6 @@ Contents
|
|||
main/installation
|
||||
providers/index
|
||||
containers/index
|
||||
advanced_usage/index
|
||||
examples/index
|
||||
api/index
|
||||
main/feedback
|
||||
|
|
|
@ -9,7 +9,7 @@ follows `Semantic versioning`_
|
|||
|
||||
Development version
|
||||
-------------------
|
||||
- No features.
|
||||
- Deprecate ``inject`` decorator.
|
||||
|
||||
2.1.1
|
||||
-----
|
||||
|
|
|
@ -12,8 +12,8 @@ csv file movies database.
|
|||
import movies
|
||||
import movies.finders
|
||||
|
||||
import example.main
|
||||
import example.db
|
||||
import example.main
|
||||
|
||||
import settings
|
||||
|
||||
|
|
|
@ -14,8 +14,8 @@ import sqlite3
|
|||
import movies
|
||||
import movies.finders
|
||||
|
||||
import example.main
|
||||
import example.db
|
||||
import example.main
|
||||
|
||||
import settings
|
||||
|
||||
|
|
|
@ -14,8 +14,8 @@ import sqlite3
|
|||
import movies
|
||||
import movies.finders
|
||||
|
||||
import example.main
|
||||
import example.db
|
||||
import example.main
|
||||
|
||||
import settings
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user