Update docs

This commit is contained in:
Roman Mogilatov 2016-09-23 00:24:45 +03:00
parent 4e66c47f59
commit 38c9d2f18a
10 changed files with 44 additions and 13 deletions

View File

@ -15,6 +15,13 @@ from dependency_injector import errors
def inject(*args, **kwargs): def inject(*args, **kwargs):
"""Dependency injection decorator. """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 :py:func:`inject` decorator can be used for making inline dependency
injections. It patches decorated callable in such way that dependency injections. It patches decorated callable in such way that dependency
injection will be done during every call of decorated callable. injection will be done during every call of decorated callable.

View File

@ -9,6 +9,10 @@ Current section of documentation describes advanced usage of
.. currentmodule:: dependency_injector.injections .. 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:func:`inject` decorator is a part of
:py:mod:`dependency_injector.injections` module. :py:mod:`dependency_injector.injections` module.

View File

@ -7,6 +7,5 @@ API Documentation
top_level top_level
providers providers
containers containers
injections
utils utils
errors errors

View File

@ -9,8 +9,8 @@ Examples
"Dependency Injector" framework. "Dependency Injector" framework.
Current section of documentation is designed to provide several example mini Current section of documentation is designed to provide several example mini
applications that are built on the top of inversion of control principle and applications that are built according to the inversion of control principle
powered by *Dependency Injector* framework. and powered by *Dependency Injector* framework.
.. toctree:: .. toctree::
:maxdepth: 2 :maxdepth: 2

View File

@ -20,14 +20,14 @@ Like Martin says:
While original Martin's MovieLister example was a bit modified here, it 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 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 create ``movies`` library that can be configured to work with different
movie databases (csv, sqlite) and provide 2 main features: movie databases (csv, sqlite, etc...) and provide 2 main features:
1. List all movies that were directed by certain person. 1. List all movies that were directed by certain person.
2. List all movies that were released in certain year. 2. List all movies that were released in certain year.
Also this example contains 3 mini applications that are based on ``movies`` 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. 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. 2. ``app_db.py`` - list movies by certain criteria from sqlite database.
@ -38,8 +38,6 @@ Instructions for running:
.. code-block:: bash .. code-block:: bash
python create_db.py
python app_csv.py python app_csv.py
python app_db.py python app_db.py
python app_db_csv.py python app_db_csv.py
@ -74,6 +72,30 @@ Listing of ``movies/__init__.py``:
:language: python :language: python
:linenos: :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 Csv application
~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~

View File

@ -59,7 +59,6 @@ Contents
main/installation main/installation
providers/index providers/index
containers/index containers/index
advanced_usage/index
examples/index examples/index
api/index api/index
main/feedback main/feedback

View File

@ -9,7 +9,7 @@ follows `Semantic versioning`_
Development version Development version
------------------- -------------------
- No features. - Deprecate ``inject`` decorator.
2.1.1 2.1.1
----- -----

View File

@ -12,8 +12,8 @@ csv file movies database.
import movies import movies
import movies.finders import movies.finders
import example.main
import example.db import example.db
import example.main
import settings import settings

View File

@ -14,8 +14,8 @@ import sqlite3
import movies import movies
import movies.finders import movies.finders
import example.main
import example.db import example.db
import example.main
import settings import settings

View File

@ -14,8 +14,8 @@ import sqlite3
import movies import movies
import movies.finders import movies.finders
import example.main
import example.db import example.db
import example.main
import settings import settings