Rename Objects to Dependency Injector

This commit is contained in:
Roman Mogilatov 2015-08-31 16:31:38 +03:00
parent c9374038be
commit 6d0f892f8a
54 changed files with 308 additions and 308 deletions

View File

@ -1,3 +1,3 @@
[run] [run]
include = objects/* include = dependency_injector/*
omit = tests/* omit = tests/*

View File

@ -11,7 +11,7 @@ modification, are permitted provided that the following conditions are met:
this list of conditions and the following disclaimer in the documentation this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution. and/or other materials provided with the distribution.
* Neither the name of Objects nor the names of its * Neither the name of "Dependency Injector" nor the names of its
contributors may be used to endorse or promote products derived from contributors may be used to endorse or promote products derived from
this software without specific prior written permission. this software without specific prior written permission.

View File

@ -1,4 +1,4 @@
include objects/* include dependency_injector/*
include README.rst include README.rst
include LICENSE include LICENSE
include VERSION include VERSION

View File

@ -1,58 +1,59 @@
Objects Dependency Injector
======= ===================
Dependency injection framework for Python projects. Dependency injection framework for Python projects.
+---------------------------------------+-------------------------------------------------------------------+ +---------------------------------------+-------------------------------------------------------------------------------+
| *PyPi* | .. image:: https://img.shields.io/pypi/v/Objects.svg | | *PyPi* | .. image:: https://img.shields.io/pypi/v/dependency_injector.svg |
| | :target: https://pypi.python.org/pypi/Objects/ | | | :target: https://pypi.python.org/pypi/dependency_injector/ |
| | :alt: Latest Version | | | :alt: Latest Version |
| | .. image:: https://img.shields.io/pypi/dm/Objects.svg | | | .. image:: https://img.shields.io/pypi/dm/dependency_injector.svg |
| | :target: https://pypi.python.org/pypi/Objects/ | | | :target: https://pypi.python.org/pypi/dependency_injector/ |
| | :alt: Downloads | | | :alt: Downloads |
| | .. image:: https://img.shields.io/pypi/l/Objects.svg | | | .. image:: https://img.shields.io/pypi/l/dependency_injector.svg |
| | :target: https://pypi.python.org/pypi/Objects/ | | | :target: https://pypi.python.org/pypi/dependency_injector/ |
| | :alt: License | | | :alt: License |
+---------------------------------------+-------------------------------------------------------------------+ +---------------------------------------+-------------------------------------------------------------------------------+
| *Python versions and implementations* | .. image:: https://img.shields.io/pypi/pyversions/Objects.svg | | *Python versions and implementations* | .. image:: https://img.shields.io/pypi/pyversions/dependency_injector.svg |
| | :target: https://pypi.python.org/pypi/Objects/ | | | :target: https://pypi.python.org/pypi/dependency_injector/ |
| | :alt: Supported Python versions | | | :alt: Supported Python versions |
| | .. image:: https://img.shields.io/pypi/implementation/Objects.svg | | | .. image:: https://img.shields.io/pypi/implementation/dependency_injector.svg |
| | :target: https://pypi.python.org/pypi/Objects/ | | | :target: https://pypi.python.org/pypi/dependency_injector/ |
| | :alt: Supported Python implementations | | | :alt: Supported Python implementations |
+---------------------------------------+-------------------------------------------------------------------+ +---------------------------------------+-------------------------------------------------------------------------------+
| *Builds and tests coverage* | .. image:: https://travis-ci.org/rmk135/objects.svg?branch=master | | *Builds and tests coverage* | .. image:: https://travis-ci.org/rmk135/dependency_injector.svg?branch=master |
| | :target: https://travis-ci.org/rmk135/objects | | | :target: https://travis-ci.org/rmk135/dependency_injector |
| | :alt: Build Status | | | :alt: Build Status |
| | .. image:: https://coveralls.io/repos/rmk135/objects/badge.svg | | | .. image:: https://coveralls.io/repos/rmk135/dependency_injector/badge.svg |
| | :target: https://coveralls.io/r/rmk135/objects | | | :target: https://coveralls.io/r/rmk135/dependency_injector |
| | :alt: Coverage Status | | | :alt: Coverage Status |
+---------------------------------------+-------------------------------------------------------------------+ +---------------------------------------+-------------------------------------------------------------------------------+
*Objects* is a dependency injection framework for Python projects. *Dependency Injector* is a dependency injection framework for Python projects.
It was designed to be unified, developer's friendly tool for managing any kind It was designed to be unified, developer's friendly tool for managing any kind
of Python objects and their dependencies in formal, pretty way. of Python objects and their dependencies in formal, pretty way.
Below is a list of some key features and points of *Objects* framework: Below is a list of some key features and points of *Dependency Injector*
framework:
- Easy, smart, pythonic style. - Easy, smart, pythonic style.
- Obvious, clear structure. - Obvious, clear structure.
- Memory efficiency. - Memory efficiency.
- Semantic versioning. - Semantic versioning.
Main idea of *Objects* is to keep dependencies under control. Main idea of *Dependency Injector* is to keep dependencies under control.
Installation Installation
------------ ------------
*Objects* library is available on PyPi_:: *Dependency Injector* library is available on PyPi_::
pip install objects pip install dependency_injector
Documentation Documentation
------------- -------------
*Objects* documentation is hosted on ReadTheDocs: *Dependency Injector* documentation is hosted on ReadTheDocs:
- `Stable version`_ - `Stable version`_
- `Latest version`_ - `Latest version`_
@ -62,16 +63,16 @@ Examples
.. code-block:: python .. code-block:: python
"""Concept example of `Objects`.""" """Concept example of `Dependency Injector`."""
from objects.catalog import AbstractCatalog from dependency_injector.catalog import AbstractCatalog
from objects.providers import Factory from dependency_injector.providers import Factory
from objects.providers import Singleton from dependency_injector.providers import Singleton
from objects.injections import KwArg from dependency_injector.injections import KwArg
from objects.injections import Attribute from dependency_injector.injections import Attribute
from objects.injections import inject from dependency_injector.injections import inject
import sqlite3 import sqlite3
@ -97,21 +98,21 @@ Examples
class Catalog(AbstractCatalog): class Catalog(AbstractCatalog):
"""Catalog of objects providers.""" """Catalog of dependency_injector providers."""
database = Singleton(sqlite3.Connection, database = Singleton(sqlite3.Connection,
KwArg('database', ':memory:'), KwArg('database', ':memory:'),
Attribute('row_factory', sqlite3.Row)) Attribute('row_factory', sqlite3.Row))
""":type: (objects.Provider) -> sqlite3.Connection""" """:type: (dependency_injector.Provider) -> sqlite3.Connection"""
object_a_factory = Factory(ObjectA, object_a_factory = Factory(ObjectA,
KwArg('db', database)) KwArg('db', database))
""":type: (objects.Provider) -> ObjectA""" """:type: (dependency_injector.Provider) -> ObjectA"""
object_b_factory = Factory(ObjectB, object_b_factory = Factory(ObjectB,
KwArg('a', object_a_factory), KwArg('a', object_a_factory),
KwArg('db', database)) KwArg('db', database))
""":type: (objects.Provider) -> ObjectB""" """:type: (dependency_injector.Provider) -> ObjectB"""
# Catalog static provides. # Catalog static provides.
@ -134,26 +135,26 @@ Examples
example() example()
You can get more *Objects* examples in ``/examples`` directory on You can get more *Dependency Injector* examples in ``/examples`` directory on
GitHub: GitHub:
https://github.com/rmk135/objects https://github.com/rmk135/dependency_injector
Feedback Feedback
-------- --------
Feel free to post questions, bugs, feature requests, proposals etc. on Feel free to post questions, bugs, feature requests, proposals etc. on
*Objects* GitHub Issues: *Dependency Injector* GitHub Issues:
https://github.com/rmk135/objects/issues https://github.com/rmk135/dependency_injector/issues
Your feedback is quite important! Your feedback is quite important!
.. _PyPi: https://pypi.python.org/pypi/Objects .. _PyPi: https://pypi.python.org/pypi/dependency_injector
.. _Stable version: http://objects.readthedocs.org/en/stable/ .. _Stable version: http://dependency_injector.readthedocs.org/en/stable/
.. _Latest version: http://objects.readthedocs.org/en/latest/ .. _Latest version: http://dependency_injector.readthedocs.org/en/latest/
.. _SLOC: http://en.wikipedia.org/wiki/Source_lines_of_code .. _SLOC: http://en.wikipedia.org/wiki/Source_lines_of_code
.. _SOLID: http://en.wikipedia.org/wiki/SOLID_%28object-oriented_design%29 .. _SOLID: http://en.wikipedia.org/wiki/SOLID_%28object-oriented_design%29
.. _IoC: http://en.wikipedia.org/wiki/Inversion_of_control .. _IoC: http://en.wikipedia.org/wiki/Inversion_of_control

View File

@ -1 +1 @@
0.7.8 0.8.0

View File

@ -1,7 +1,4 @@
"""Objects. """Dependency injector."""
Dependency management tool for Python projects.
"""
from .catalog import AbstractCatalog from .catalog import AbstractCatalog
from .catalog import override from .catalog import override

View File

@ -87,9 +87,9 @@ qthelp:
@echo @echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \ @echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:" ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/objects.qhcp" @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/dependency_injector.qhcp"
@echo "To view the help file:" @echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/objects.qhc" @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/dependency_injector.qhc"
applehelp: applehelp:
$(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp $(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
@ -104,8 +104,8 @@ devhelp:
@echo @echo
@echo "Build finished." @echo "Build finished."
@echo "To view the help file:" @echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/objects" @echo "# mkdir -p $$HOME/.local/share/devhelp/dependency_injector"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/objects" @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/dependency_injector"
@echo "# devhelp" @echo "# devhelp"
epub: epub:

View File

@ -2,7 +2,8 @@
Advanced usage Advanced usage
============== ==============
Current section of documentation describes advanced usage of *Objects*. Current section of documentation describes advanced usage of
*Dependency Injector*.
@inject decorator @inject decorator
----------------- -----------------
@ -12,10 +13,10 @@ It *patches* decorated callable in such way that dependency injection will be
done during every call of decorated callable. done during every call of decorated callable.
``@inject`` decorator takes only argument that is supposed to be an ``@inject`` decorator takes only argument that is supposed to be an
``objects.injections.KwArg`` injection. ``dependency_injector.injections.KwArg`` injection.
Any Python object will be injected *as is*, except *Objects* providers, Any Python object will be injected *as is*, except *Dependency Injector*
that will be called to provide injectable value. providers, that will be called to provide injectable value.
Example: Example:

View File

@ -20,7 +20,7 @@ Writing catalogs
---------------- ----------------
Catalogs have to be created by extending base catalog class Catalogs have to be created by extending base catalog class
``objects.catalog.AbstractCatalog``. ``dependency_injector.catalog.AbstractCatalog``.
Providers have to be defined like catalog's attributes. Every provider in Providers have to be defined like catalog's attributes. Every provider in
catalog has name. This name should follow ``some_provider`` manner, that is catalog has name. This name should follow ``some_provider`` manner, that is
@ -29,10 +29,10 @@ standard naming convention for names of attributes in Python.
.. note:: .. note::
It might be useful to add such It might be useful to add such
``""":type: (objects.Provider) -> Object1"""`` documentation blocks one ``""":type: (dependency_injector.Provider) -> Object1"""`` documentation
line after provider definition for every provider. It will help code blocks one line after provider definition for every provider. It will help
analysis tools and IDE's to understand that variable above contains some code analysis tools and IDE's to understand that variable above contains
callable object, that returns particular instance as a result of call. some callable object, that returns particular instance as a result of call.
Example: Example:

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
# Objects documentation build configuration file, created by # Dependency Injector documentation build configuration file, created by
# sphinx-quickstart on Wed Apr 1 17:36:06 2015. # sphinx-quickstart on Wed Apr 1 17:36:06 2015.
# #
# This file is execfile()d with the current directory set to its # This file is execfile()d with the current directory set to its
@ -44,7 +44,7 @@ source_suffix = '.rst'
master_doc = 'index' master_doc = 'index'
# General information about the project. # General information about the project.
project = u'Objects' project = u'Dependency Injector'
copyright = u'2015, Roman Mogilatov' copyright = u'2015, Roman Mogilatov'
author = u'Roman Mogilatov' author = u'Roman Mogilatov'
@ -201,7 +201,7 @@ html_static_path = ['_static']
#html_search_scorer = 'scorer.js' #html_search_scorer = 'scorer.js'
# Output file base name for HTML help builder. # Output file base name for HTML help builder.
htmlhelp_basename = 'objectsdoc' htmlhelp_basename = 'dependency_injectordoc'
# on_rtd is whether we are on readthedocs.org, this line of code grabbed from # on_rtd is whether we are on readthedocs.org, this line of code grabbed from
# docs.readthedocs.org # docs.readthedocs.org
@ -234,7 +234,7 @@ latex_elements = {
# (source start file, target name, title, # (source start file, target name, title,
# author, documentclass [howto, manual, or own class]). # author, documentclass [howto, manual, or own class]).
latex_documents = [ latex_documents = [
(master_doc, 'Objects.tex', u'Objects Documentation', (master_doc, 'dependency_injector.tex', u'Dependency Injector Documentation',
u'Roman Mogilatov', 'manual'), u'Roman Mogilatov', 'manual'),
] ]
@ -264,7 +264,7 @@ latex_documents = [
# One entry per manual page. List of tuples # One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section). # (source start file, name, description, authors, manual section).
man_pages = [ man_pages = [
(master_doc, 'Objects', u'Objects Documentation', (master_doc, 'Dependency Injector', u'Dependency Injector Documentation',
[author], 1) [author], 1)
] ]
@ -278,8 +278,8 @@ man_pages = [
# (source start file, target name, title, author, # (source start file, target name, title, author,
# dir menu entry, description, category) # dir menu entry, description, category)
texinfo_documents = [ texinfo_documents = [
(master_doc, 'Objects', u'Objects Documentation', (master_doc, 'Dependency Injector', u'Dependency Injector Documentation',
author, 'Objects', 'Dependency management tool for Python projects.', author, 'Dependency Injector', 'Dependency management tool for Python projects.',
'Miscellaneous'), 'Miscellaneous'),
] ]

View File

@ -1,46 +1,47 @@
Objects Dependency Injector
======= ===================
Dependency injection framework for Python projects. Dependency injection framework for Python projects.
+---------------------------------------+-------------------------------------------------------------------+ +---------------------------------------+-------------------------------------------------------------------------------+
| *PyPi* | .. image:: https://img.shields.io/pypi/v/Objects.svg | | *PyPi* | .. image:: https://img.shields.io/pypi/v/dependency_injector.svg |
| | :target: https://pypi.python.org/pypi/Objects/ | | | :target: https://pypi.python.org/pypi/dependency_injector/ |
| | :alt: Latest Version | | | :alt: Latest Version |
| | .. image:: https://img.shields.io/pypi/dm/Objects.svg | | | .. image:: https://img.shields.io/pypi/dm/dependency_injector.svg |
| | :target: https://pypi.python.org/pypi/Objects/ | | | :target: https://pypi.python.org/pypi/dependency_injector/ |
| | :alt: Downloads | | | :alt: Downloads |
| | .. image:: https://img.shields.io/pypi/l/Objects.svg | | | .. image:: https://img.shields.io/pypi/l/dependency_injector.svg |
| | :target: https://pypi.python.org/pypi/Objects/ | | | :target: https://pypi.python.org/pypi/dependency_injector/ |
| | :alt: License | | | :alt: License |
+---------------------------------------+-------------------------------------------------------------------+ +---------------------------------------+-------------------------------------------------------------------------------+
| *Python versions and implementations* | .. image:: https://img.shields.io/pypi/pyversions/Objects.svg | | *Python versions and implementations* | .. image:: https://img.shields.io/pypi/pyversions/dependency_injector.svg |
| | :target: https://pypi.python.org/pypi/Objects/ | | | :target: https://pypi.python.org/pypi/dependency_injector/ |
| | :alt: Supported Python versions | | | :alt: Supported Python versions |
| | .. image:: https://img.shields.io/pypi/implementation/Objects.svg | | | .. image:: https://img.shields.io/pypi/implementation/dependency_injector.svg |
| | :target: https://pypi.python.org/pypi/Objects/ | | | :target: https://pypi.python.org/pypi/dependency_injector/ |
| | :alt: Supported Python implementations | | | :alt: Supported Python implementations |
+---------------------------------------+-------------------------------------------------------------------+ +---------------------------------------+-------------------------------------------------------------------------------+
| *Builds and tests coverage* | .. image:: https://travis-ci.org/rmk135/objects.svg?branch=master | | *Builds and tests coverage* | .. image:: https://travis-ci.org/rmk135/dependency_injector.svg?branch=master |
| | :target: https://travis-ci.org/rmk135/objects | | | :target: https://travis-ci.org/rmk135/dependency_injector |
| | :alt: Build Status | | | :alt: Build Status |
| | .. image:: https://coveralls.io/repos/rmk135/objects/badge.svg | | | .. image:: https://coveralls.io/repos/rmk135/dependency_injector/badge.svg |
| | :target: https://coveralls.io/r/rmk135/objects | | | :target: https://coveralls.io/r/rmk135/dependency_injector |
| | :alt: Coverage Status | | | :alt: Coverage Status |
+---------------------------------------+-------------------------------------------------------------------+ +---------------------------------------+-------------------------------------------------------------------------------+
*Objects* is a dependency injection framework for Python projects. *Dependency Injector* is a dependency injection framework for Python projects.
It was designed to be unified, developer's friendly tool for managing any kind It was designed to be unified, developer's friendly tool for managing any kind
of Python objects and their dependencies in formal, pretty way. of Python objects and their dependencies in formal, pretty way.
Below is a list of some key features and points of *Objects* framework: Below is a list of some key features and points of *Dependency Injector*
framework:
- Easy, smart, pythonic style. - Easy, smart, pythonic style.
- Obvious, clear structure. - Obvious, clear structure.
- Memory efficiency. - Memory efficiency.
- Semantic versioning. - Semantic versioning.
Main idea of *Objects* is to keep dependencies under control. Main idea of *Dependency Injector* is to keep dependencies under control.
Contents Contents
-------- --------

View File

@ -1,10 +1,11 @@
Changelog Changelog
========= =========
This document describes all the changes in *Objects* framework that were made This document describes all the changes in *Dependency Injector* framework
in every particular version. that were made in every particular version.
From version 0.7.6 *Objects* framework strictly follows `Semantic versioning`_ From version 0.7.6 *Dependency Injector* framework strictly
follows `Semantic versioning`_
Development version Development version
@ -12,6 +13,10 @@ Development version
- No features. - No features.
0.8.0
-----
- ``Objects`` is renamed to ``Dependency Injector``.
0.7.8 0.7.8
----- -----
- Fixing @inject import bug in examples. - Fixing @inject import bug in examples.

View File

@ -2,8 +2,8 @@ Feedback
======== ========
Feel free to post questions, bugs, feature requests, proposals etc. on Feel free to post questions, bugs, feature requests, proposals etc. on
*Objects* GitHub Issues: *Dependency Injector* GitHub Issues:
https://github.com/rmk135/objects/issues https://github.com/rmk135/dependency_injector/issues
Your feedback is quite important! Your feedback is quite important!

View File

@ -1,27 +1,28 @@
Installation Installation
============ ============
*Objects* framework is distributed by PyPi_. *Dependency Injector* framework is distributed by PyPi_.
Latest stable version (and all previous versions) of *Objects* framework can be Latest stable version (and all previous versions) of *Dependency Injector*
installed from PyPi_: framework can be installed from PyPi_:
.. code-block:: bash .. code-block:: bash
# Installing latest version: # Installing latest version:
pip install objects pip install dependency_injector
# Installing particular version: # Installing particular version:
pip install objects==0.7.5 pip install dependency_injector==0.7.5
Sources can be cloned from GitHub_: Sources can be cloned from GitHub_:
.. code-block:: bash .. code-block:: bash
git clone https://github.com/rmk135/objects.git git clone https://github.com/rmk135/dependency_injector.git
Also all *Objects* releases can be downloaded from `GitHub releases page`_. Also all *Dependency Injector* releases can be downloaded from
`GitHub releases page`_.
.. _PyPi: https://pypi.python.org/pypi/Objects .. _PyPi: https://pypi.python.org/pypi/dependency_injector
.. _GitHub: https://github.com/rmk135/objects .. _GitHub: https://github.com/rmk135/dependency_injector
.. _GitHub releases page: https://github.com/rmk135/objects/releases .. _GitHub releases page: https://github.com/rmk135/dependency_injector/releases

View File

@ -1,8 +1,8 @@
Introduction Introduction
============ ============
Before you have started with *Objects* framework and dependecy injection, there Before you have started with *Dependency Injector* framework and dependecy
are a couple of introduction notes that might be useful. injection, there are a couple of introduction notes that might be useful.
What is DI and why is it needed? What is DI and why is it needed?
-------------------------------- --------------------------------
@ -43,24 +43,25 @@ ways to do dependency injection container.
Key features Key features
------------ ------------
*Objects* is a dependency injection framework for Python projects. *Dependency Injector* is a dependency injection framework for Python projects.
It was designed to be unified, developer's friendly tool for managing any kind It was designed to be unified, developer's friendly tool for managing any kind
of Python objects and their dependencies in formal, pretty way. of Python objects and their dependencies in formal, pretty way.
Below is a list of some key features and points of *Objects* framework: Below is a list of some key features and points of *Dependency Injector*
framework:
- Easy, smart, pythonic style. - Easy, smart, pythonic style.
- Obvious, clear structure. - Obvious, clear structure.
- Memory efficiency. - Memory efficiency.
- Semantic versioning. - Semantic versioning.
Main idea of *Objects* is to keep dependencies under control. Main idea of *Dependency Injector* is to keep dependencies under control.
Main entities Main entities
------------- -------------
Current section describes *Objects* main entities and their interaction with Current section describes *Dependency Injector* main entities and their
each other. interaction with each other.
.. image:: /images/internals.png .. image:: /images/internals.png
:width: 100% :width: 100%
@ -69,18 +70,20 @@ each other.
There are 3 main entities: There are 3 main entities:
- Providers. Providers are strategies of accesing objects. For example, - Providers. Providers are strategies of accesing objects. For example,
``objects.providers.Factory`` creates new instance of provided class every ``dependency_injector.providers.Factory`` creates new instance of provided
time it is called. ``objects.providers.Singleton`` creates provided instance class every time it is called. ``dependency_injector.providers.Singleton``
once and returns it on every next call. Providers could be overridden by creates provided instance once and returns it on every next call. Providers
another providers. Base class is - ``objects.providers.Provider``. could be overridden by another providers. Base class is -
``dependency_injector.providers.Provider``.
- Injections. Injections are instructions for making dependency injections - Injections. Injections are instructions for making dependency injections
(there are several ways how they could be done). Injections are used mostly (there are several ways how they could be done). Injections are used mostly
by ``objects.providers.Factory`` and ``objects.providers.Singleton`` by ``dependency_injector.providers.Factory`` and
providers, but these are not only cases. Base class is - ``dependency_injector.providers.Singleton`` providers, but these are not only
``objects.injections.Injection``. cases. Base class is -
``dependency_injector.injections.Injection``.
- Catalogs. Catalogs are collections of providers. They are used for grouping - Catalogs. Catalogs are collections of providers. They are used for grouping
of providers by some principles. Base class is - of providers by some principles. Base class is -
``objects.catalog.AbstractCatalog``. ``dependency_injector.catalog.AbstractCatalog``.
.. _SLOC: http://en.wikipedia.org/wiki/Source_lines_of_code .. _SLOC: http://en.wikipedia.org/wiki/Source_lines_of_code

View File

@ -1,28 +1,31 @@
Writing custom providers Writing custom providers
------------------------ ------------------------
List of *Objects* providers could be widened with custom providers. List of *Dependency Injector* providers could be widened with custom providers.
Below are some tips and recommendations that have to be met: Below are some tips and recommendations that have to be met:
1. Every custom provider has to extend base provider class - 1. Every custom provider has to extend base provider class -
``objects.providers.Provider``. ``dependency_injector.providers.Provider``.
2. Cusom provider's ``__init__()`` could be overriden with only condition: 2. Cusom provider's ``__init__()`` could be overriden with only condition:
parent initializer (``objects.providers.Provider.__init__()``) has parent initializer
to be called. (``dependency_injector.providers.Provider.__init__()``) has to be called.
3. Providing strategy has to be implemented in custom provider's 3. Providing strategy has to be implemented in custom provider's
``_provide()`` method. All ``*args`` & ``**kwargs`` that will be ``_provide()`` method. All ``*args`` & ``**kwargs`` that will be
recieved by ``objects.providers.Provider.__call__()`` will be transefed recieved by ``dependency_injector.providers.Provider.__call__()`` will be
transefed
to custom provider's ``_provide()``. to custom provider's ``_provide()``.
4. If custom provider is based on some standard providers, it is better to 4. If custom provider is based on some standard providers, it is better to
use delegation of standard providers, then extending of them. use delegation of standard providers, then extending of them.
5. If custom provider defines any attributes, it is good to list them in 5. If custom provider defines any attributes, it is good to list them in
``__slots__`` attribute (as *Objects* does). It can save some memory. ``__slots__`` attribute (as *Dependency Injector* does). It can save
some memory.
6. If custom provider deals with injections (e.g. ``Factory``, 6. If custom provider deals with injections (e.g. ``Factory``,
``Singleton`` providers), it is strongly recommended to use ``Singleton`` providers), it is strongly recommended to use
``objects.injections.Injection`` and its subclasses: ``dependency_injector.injections.Injection`` and its subclasses:
``objects.injections.KwArg``, ``objects.injections.Attribute`` and ``dependency_injector.injections.KwArg``,
``objects.injections.Method``. ``dependency_injector.injections.Attribute`` and
``dependency_injector.injections.Method``.
Example: Example:

View File

@ -18,14 +18,14 @@ Factory providers and injections
Objects can take dependencies in different forms. Some objects take init Objects can take dependencies in different forms. Some objects take init
arguments, other are using attributes setting or method calls to be arguments, other are using attributes setting or method calls to be
initialized. It affects how such objects need to be created and initialized, initialized. It affects how such objects need to be created and initialized,
and that is the place where ``objects.injections`` need to be used. and that is the place where ``dependency_injector.injections`` need to be used.
``Factory`` provider takes various number of positional arguments, that define ``Factory`` provider takes various number of positional arguments, that define
what kind of dependency injections need to be done. what kind of dependency injections need to be done.
All of those instructions are defined in ``objects.injections`` module and are All of those instructions are defined in ``dependency_injector.injections``
subclasses of ``objects.injections.Injection``. There are several types of module and are subclasses of ``dependency_injector.injections.Injection``.
injections that are used by ``Factory`` provider: There are several types of injections that are used by ``Factory`` provider:
+ ``KwArg`` - injection is done by passing injectable value in object's + ``KwArg`` - injection is done by passing injectable value in object's
``__init__()`` method in time of object's creation via keyword argument. ``__init__()`` method in time of object's creation via keyword argument.

View File

@ -1,11 +0,0 @@
Objects
=======
Examples:
- [Concept example.](examples/concept.py)
- [Callable provider.](examples/callable_provider.py)
- [Config provider.](examples/config_provider.py)
- [Delegate.](examples/delegate.py)
- [External dependency.](examples/external_dependency.py)
- [Overrides.](examples/overrides.py)

View File

@ -1,9 +1,9 @@
"""Config provider examples.""" """Config provider examples."""
from objects.catalog import AbstractCatalog from dependency_injector.catalog import AbstractCatalog
from objects.providers import Config from dependency_injector.providers import Config
from objects.providers import Factory from dependency_injector.providers import Factory
from objects.injections import KwArg from dependency_injector.injections import KwArg
class ObjectA(object): class ObjectA(object):
@ -19,16 +19,16 @@ class ObjectA(object):
class Catalog(AbstractCatalog): class Catalog(AbstractCatalog):
"""Catalog of objects providers.""" """Catalog of dependency_injector providers."""
config = Config() config = Config()
""":type: (objects.Config)""" """:type: (dependency_injector.Config)"""
object_a = Factory(ObjectA, object_a = Factory(ObjectA,
KwArg('fee', config.FEE), KwArg('fee', config.FEE),
KwArg('price', config.PRICE), KwArg('price', config.PRICE),
KwArg('timezone', config.GLOBAL.TIMEZONE)) KwArg('timezone', config.GLOBAL.TIMEZONE))
""":type: (objects.Provider) -> ObjectA""" """:type: (dependency_injector.Provider) -> ObjectA"""
# Setting config value and making some tests. # Setting config value and making some tests.

View File

@ -4,10 +4,10 @@ import sqlite3
from flask import Flask from flask import Flask
from objects.providers import Singleton from dependency_injector.providers import Singleton
from objects.injections import KwArg from dependency_injector.injections import KwArg
from objects.injections import Attribute from dependency_injector.injections import Attribute
from objects.injections import inject from dependency_injector.injections import inject
# Database and `ObjectA` providers. # Database and `ObjectA` providers.

View File

@ -1,14 +1,14 @@
"""`@inject` decorator simple example.""" """`@inject` decorator simple example."""
from objects.providers import Factory from dependency_injector.providers import Factory
from objects.injections import KwArg from dependency_injector.injections import KwArg
from objects.injections import inject from dependency_injector.injections import inject
objects_factory = Factory(object) dependency_injector_factory = Factory(object)
@inject(KwArg('new_object', objects_factory)) @inject(KwArg('new_object', dependency_injector_factory))
@inject(KwArg('some_setting', 1334)) @inject(KwArg('some_setting', 1334))
def example_callback(new_object, some_setting): def example_callback(new_object, some_setting):
"""Example callback that does some asserts with input args.""" """Example callback that does some asserts with input args."""

View File

@ -1,8 +1,8 @@
"""Operating with catalog providers example.""" """Operating with catalog providers example."""
from objects.catalog import AbstractCatalog from dependency_injector.catalog import AbstractCatalog
from objects.providers import Factory from dependency_injector.providers import Factory
from objects.providers import Singleton from dependency_injector.providers import Singleton
class Catalog(AbstractCatalog): class Catalog(AbstractCatalog):
@ -10,16 +10,16 @@ class Catalog(AbstractCatalog):
"""Providers catalog.""" """Providers catalog."""
provider1 = Factory(object) provider1 = Factory(object)
""":type: (objects.Provider) -> object""" """:type: (dependency_injector.Provider) -> object"""
provider2 = Factory(object) provider2 = Factory(object)
""":type: (objects.Provider) -> object""" """:type: (dependency_injector.Provider) -> object"""
provider3 = Singleton(object) provider3 = Singleton(object)
""":type: (objects.Provider) -> object""" """:type: (dependency_injector.Provider) -> object"""
provider4 = Singleton(object) provider4 = Singleton(object)
""":type: (objects.Provider) -> object""" """:type: (dependency_injector.Provider) -> object"""
# Making some asserts: # Making some asserts:

View File

@ -2,9 +2,9 @@
from collections import namedtuple from collections import namedtuple
from objects.catalog import AbstractCatalog from dependency_injector.catalog import AbstractCatalog
from objects.providers import Factory from dependency_injector.providers import Factory
from objects.injections import KwArg from dependency_injector.injections import KwArg
# Creating some example classes: # Creating some example classes:
@ -20,11 +20,11 @@ class Catalog(AbstractCatalog):
object1_factory = Factory(Object1, object1_factory = Factory(Object1,
KwArg('arg1', 1), KwArg('arg1', 1),
KwArg('arg2', 2)) KwArg('arg2', 2))
""":type: (objects.Provider) -> Object1""" """:type: (dependency_injector.Provider) -> Object1"""
object2_factory = Factory(Object2, object2_factory = Factory(Object2,
KwArg('object1', object1_factory)) KwArg('object1', object1_factory))
""":type: (objects.Provider) -> Object2""" """:type: (dependency_injector.Provider) -> Object2"""
class AnotherCatalog(AbstractCatalog): class AnotherCatalog(AbstractCatalog):
@ -32,13 +32,13 @@ class AnotherCatalog(AbstractCatalog):
"""Another providers catalog.""" """Another providers catalog."""
object2_factory = Factory(ExtendedObject2) object2_factory = Factory(ExtendedObject2)
""":type: (objects.Provider) -> ExtendedObject2""" """:type: (dependency_injector.Provider) -> ExtendedObject2"""
# Overriding `Catalog` with `AnotherCatalog`: # Overriding `Catalog` with `AnotherCatalog`:
Catalog.override(AnotherCatalog) Catalog.override(AnotherCatalog)
# Creating some objects using overridden catalog: # Creating some dependency_injector using overridden catalog:
object2_1 = Catalog.object2_factory() object2_1 = Catalog.object2_factory()
object2_2 = Catalog.object2_factory() object2_2 = Catalog.object2_factory()

View File

@ -2,10 +2,10 @@
from collections import namedtuple from collections import namedtuple
from objects.catalog import AbstractCatalog from dependency_injector.catalog import AbstractCatalog
from objects.catalog import override from dependency_injector.catalog import override
from objects.providers import Factory from dependency_injector.providers import Factory
from objects.injections import KwArg from dependency_injector.injections import KwArg
# Creating some example classes: # Creating some example classes:
@ -21,11 +21,11 @@ class Catalog(AbstractCatalog):
object1_factory = Factory(Object1, object1_factory = Factory(Object1,
KwArg('arg1', 1), KwArg('arg1', 1),
KwArg('arg2', 2)) KwArg('arg2', 2))
""":type: (objects.Provider) -> Object1""" """:type: (dependency_injector.Provider) -> Object1"""
object2_factory = Factory(Object2, object2_factory = Factory(Object2,
KwArg('object1', object1_factory)) KwArg('object1', object1_factory))
""":type: (objects.Provider) -> Object2""" """:type: (dependency_injector.Provider) -> Object2"""
# Overriding `Catalog` with `AnotherCatalog`: # Overriding `Catalog` with `AnotherCatalog`:
@ -35,10 +35,10 @@ class AnotherCatalog(AbstractCatalog):
"""Another providers catalog.""" """Another providers catalog."""
object2_factory = Factory(ExtendedObject2) object2_factory = Factory(ExtendedObject2)
""":type: (objects.Provider) -> ExtendedObject2""" """:type: (dependency_injector.Provider) -> ExtendedObject2"""
# Creating some objects using overridden catalog: # Creating some dependency_injector using overridden catalog:
object2_1 = Catalog.object2_factory() object2_1 = Catalog.object2_factory()
object2_2 = Catalog.object2_factory() object2_2 = Catalog.object2_factory()

View File

@ -2,9 +2,9 @@
from collections import namedtuple from collections import namedtuple
from objects.catalog import AbstractCatalog from dependency_injector.catalog import AbstractCatalog
from objects.providers import Factory from dependency_injector.providers import Factory
from objects.injections import KwArg from dependency_injector.injections import KwArg
# Creating some example classes: # Creating some example classes:
@ -19,13 +19,13 @@ class Catalog(AbstractCatalog):
object1_factory = Factory(Object1, object1_factory = Factory(Object1,
KwArg('arg1', 1), KwArg('arg1', 1),
KwArg('arg2', 2)) KwArg('arg2', 2))
""":type: (objects.Provider) -> Object1""" """:type: (dependency_injector.Provider) -> Object1"""
object2_factory = Factory(Object2, object2_factory = Factory(Object2,
KwArg('object1', object1_factory)) KwArg('object1', object1_factory))
""":type: (objects.Provider) -> Object2""" """:type: (dependency_injector.Provider) -> Object2"""
# Creating some objects: # Creating some dependency_injector:
object2_1 = Catalog.object2_factory() object2_1 = Catalog.object2_factory()
object2_2 = Catalog.object2_factory() object2_2 = Catalog.object2_factory()

View File

@ -1,13 +1,13 @@
"""Concept example of `Objects`.""" """Concept example of `Dependency Injector`."""
from objects.catalog import AbstractCatalog from dependency_injector.catalog import AbstractCatalog
from objects.providers import Factory from dependency_injector.providers import Factory
from objects.providers import Singleton from dependency_injector.providers import Singleton
from objects.injections import KwArg from dependency_injector.injections import KwArg
from objects.injections import Attribute from dependency_injector.injections import Attribute
from objects.injections import inject from dependency_injector.injections import inject
import sqlite3 import sqlite3
@ -33,21 +33,21 @@ class ObjectB(object):
class Catalog(AbstractCatalog): class Catalog(AbstractCatalog):
"""Catalog of objects providers.""" """Catalog of dependency_injector providers."""
database = Singleton(sqlite3.Connection, database = Singleton(sqlite3.Connection,
KwArg('database', ':memory:'), KwArg('database', ':memory:'),
Attribute('row_factory', sqlite3.Row)) Attribute('row_factory', sqlite3.Row))
""":type: (objects.Provider) -> sqlite3.Connection""" """:type: (dependency_injector.Provider) -> sqlite3.Connection"""
object_a_factory = Factory(ObjectA, object_a_factory = Factory(ObjectA,
KwArg('db', database)) KwArg('db', database))
""":type: (objects.Provider) -> ObjectA""" """:type: (dependency_injector.Provider) -> ObjectA"""
object_b_factory = Factory(ObjectB, object_b_factory = Factory(ObjectB,
KwArg('a', object_a_factory), KwArg('a', object_a_factory),
KwArg('db', database)) KwArg('db', database))
""":type: (objects.Provider) -> ObjectB""" """:type: (dependency_injector.Provider) -> ObjectB"""
# Catalog static provides. # Catalog static provides.

View File

@ -2,11 +2,11 @@
import sys import sys
from objects.providers import Callable from dependency_injector.providers import Callable
from objects.providers import Delegate from dependency_injector.providers import Delegate
# Some callable provider and few delegates of it: # Creating some callable provider and few delegates of it:
callable_provider = Callable(sys.exit) callable_provider = Callable(sys.exit)
callable_provider_delegate1 = callable_provider.delegate() callable_provider_delegate1 = callable_provider.delegate()
callable_provider_delegate2 = Delegate(callable_provider) callable_provider_delegate2 = Delegate(callable_provider)

View File

@ -2,8 +2,8 @@
from passlib.hash import sha256_crypt from passlib.hash import sha256_crypt
from objects.providers import Callable from dependency_injector.providers import Callable
from objects.injections import KwArg from dependency_injector.injections import KwArg
# Password hasher and verifier providers (hash function could be changed # Password hasher and verifier providers (hash function could be changed

View File

@ -1,7 +1,7 @@
"""Custom `Factory` example.""" """Custom `Factory` example."""
from objects.providers import Provider from dependency_injector.providers import Provider
from objects.providers import Factory from dependency_injector.providers import Factory
class User(object): class User(object):

View File

@ -1,11 +1,11 @@
"""`ExternalDependency` providers example.""" """`ExternalDependency` providers example."""
from objects.providers import ExternalDependency from dependency_injector.providers import ExternalDependency
from objects.providers import Factory from dependency_injector.providers import Factory
from objects.providers import Singleton from dependency_injector.providers import Singleton
from objects.injections import KwArg from dependency_injector.injections import KwArg
from objects.injections import Attribute from dependency_injector.injections import Attribute
# Importing SQLITE3 and contextlib.closing for working with cursors: # Importing SQLITE3 and contextlib.closing for working with cursors:
import sqlite3 import sqlite3

View File

@ -1,6 +1,6 @@
"""`Factory` providers example.""" """`Factory` providers example."""
from objects.providers import Factory from dependency_injector.providers import Factory
class User(object): class User(object):

View File

@ -1,7 +1,7 @@
"""`Factory` providers with attribute injections example.""" """`Factory` providers with attribute injections example."""
from objects.providers import Factory from dependency_injector.providers import Factory
from objects.injections import Attribute from dependency_injector.injections import Attribute
class User(object): class User(object):

View File

@ -1,7 +1,7 @@
"""`Factory` providers delegation example.""" """`Factory` providers delegation example."""
from objects.providers import Factory from dependency_injector.providers import Factory
from objects.injections import KwArg from dependency_injector.injections import KwArg
class User(object): class User(object):
@ -11,7 +11,7 @@ class User(object):
def __init__(self, photos_factory): def __init__(self, photos_factory):
"""Initializer. """Initializer.
:param photos_factory: (objects.providers.Factory) -> Photo :param photos_factory: (dependency_injector.providers.Factory) -> Photo
""" """
self.photos_factory = photos_factory self.photos_factory = photos_factory
self._main_photo = None self._main_photo = None

View File

@ -1,7 +1,7 @@
"""`Factory` providers with init injections example.""" """`Factory` providers with init injections example."""
from objects.providers import Factory from dependency_injector.providers import Factory
from objects.injections import KwArg from dependency_injector.injections import KwArg
class User(object): class User(object):

View File

@ -1,7 +1,7 @@
"""`Factory` providers with init injections and context arguments example.""" """`Factory` providers with init injections and context arguments example."""
from objects.providers import Factory from dependency_injector.providers import Factory
from objects.injections import KwArg from dependency_injector.injections import KwArg
class User(object): class User(object):

View File

@ -1,7 +1,7 @@
"""`Factory` providers with method injections example.""" """`Factory` providers with method injections example."""
from objects.providers import Factory from dependency_injector.providers import Factory
from objects.injections import Method from dependency_injector.injections import Method
class User(object): class User(object):

View File

@ -1,6 +1,6 @@
"""Simple providers overriding example.""" """Simple providers overriding example."""
from objects.providers import Factory from dependency_injector.providers import Factory
class User(object): class User(object):

View File

@ -1,7 +1,7 @@
"""Overriding user's model example.""" """Overriding user's model example."""
from objects.providers import Factory from dependency_injector.providers import Factory
from objects.injections import KwArg from dependency_injector.injections import KwArg
class User(object): class User(object):

View File

@ -1,6 +1,6 @@
"""`Singleton` providers example.""" """`Singleton` providers example."""
from objects.providers import Singleton from dependency_injector.providers import Singleton
class UserService(object): class UserService(object):

View File

@ -1,7 +1,7 @@
"""`Singleton` providers delegation example.""" """`Singleton` providers delegation example."""
from objects.providers import Singleton from dependency_injector.providers import Singleton
from objects.providers import Delegate from dependency_injector.providers import Delegate
# Some singleton provider and few delegates of it: # Some singleton provider and few delegates of it:

View File

@ -1,6 +1,6 @@
"""`Singleton` providers resetting example.""" """`Singleton` providers resetting example."""
from objects.providers import Singleton from dependency_injector.providers import Singleton
class UserService(object): class UserService(object):

View File

@ -1,9 +1,9 @@
"""`Static` providers example.""" """`Static` providers example."""
from objects.providers import Class from dependency_injector.providers import Class
from objects.providers import Object from dependency_injector.providers import Object
from objects.providers import Function from dependency_injector.providers import Function
from objects.providers import Value from dependency_injector.providers import Value
# Provides class - `object`: # Provides class - `object`:

View File

@ -1,4 +1,4 @@
"""`Objects` setup script.""" """`Dependency injector` setup script."""
import os import os
from setuptools import setup from setuptools import setup
@ -44,7 +44,7 @@ class PublishCommand(Command):
os.system('git push --tags') os.system('git push --tags')
setup(name='Objects', setup(name='dependency_injector',
version=version, version=version,
description=SHORT_DESCRIPTION, description=SHORT_DESCRIPTION,
long_description=description, long_description=description,
@ -52,9 +52,9 @@ setup(name='Objects',
author_email='rmogilatov@gmail.com', author_email='rmogilatov@gmail.com',
maintainer='Roman Mogilatov', maintainer='Roman Mogilatov',
maintainer_email='rmogilatov@gmail.com', maintainer_email='rmogilatov@gmail.com',
url='https://github.com/rmk135/objects', url='https://github.com/rmk135/dependency_injector',
license='BSD New', license='BSD New',
packages=['objects'], packages=['dependency_injector'],
zip_safe=True, zip_safe=True,
install_requires=requirements, install_requires=requirements,
cmdclass={ cmdclass={

View File

@ -1 +1 @@
"""Objects unittests.""" """Dependency injector unittests."""

View File

@ -1,14 +1,14 @@
"""Objects catalog unittests.""" """Dependency injector catalog unittests."""
import unittest2 as unittest import unittest2 as unittest
from objects.catalog import AbstractCatalog from dependency_injector.catalog import AbstractCatalog
from objects.catalog import override from dependency_injector.catalog import override
from objects.providers import Object from dependency_injector.providers import Object
from objects.providers import Value from dependency_injector.providers import Value
from objects.errors import Error from dependency_injector.errors import Error
class CatalogTests(unittest.TestCase): class CatalogTests(unittest.TestCase):
@ -94,4 +94,3 @@ class OverrideTests(unittest.TestCase):
self.assertEqual(self.Catalog.obj(), 1) self.assertEqual(self.Catalog.obj(), 1)
self.assertEqual(self.Catalog.another_obj(), 2) self.assertEqual(self.Catalog.another_obj(), 2)

View File

@ -1,16 +1,16 @@
"""Objects injections unittests.""" """Dependency injector injections unittests."""
import unittest2 as unittest import unittest2 as unittest
from objects.injections import Injection from dependency_injector.injections import Injection
from objects.injections import KwArg from dependency_injector.injections import KwArg
from objects.injections import Attribute from dependency_injector.injections import Attribute
from objects.injections import Method from dependency_injector.injections import Method
from objects.injections import inject from dependency_injector.injections import inject
from objects.providers import Factory from dependency_injector.providers import Factory
from objects.errors import Error from dependency_injector.errors import Error
class InjectionTests(unittest.TestCase): class InjectionTests(unittest.TestCase):

View File

@ -1,26 +1,26 @@
"""Objects providers unittests.""" """Dependency injector providers unittests."""
import unittest2 as unittest import unittest2 as unittest
from objects.providers import Provider from dependency_injector.providers import Provider
from objects.providers import Delegate from dependency_injector.providers import Delegate
from objects.providers import Factory from dependency_injector.providers import Factory
from objects.providers import Singleton from dependency_injector.providers import Singleton
from objects.providers import ExternalDependency from dependency_injector.providers import ExternalDependency
from objects.providers import Class from dependency_injector.providers import Class
from objects.providers import Object from dependency_injector.providers import Object
from objects.providers import Function from dependency_injector.providers import Function
from objects.providers import Value from dependency_injector.providers import Value
from objects.providers import Callable from dependency_injector.providers import Callable
from objects.providers import Config from dependency_injector.providers import Config
from objects.injections import KwArg from dependency_injector.injections import KwArg
from objects.injections import Attribute from dependency_injector.injections import Attribute
from objects.injections import Method from dependency_injector.injections import Method
from objects.utils import is_provider from dependency_injector.utils import is_provider
from objects.errors import Error from dependency_injector.errors import Error
class ProviderTests(unittest.TestCase): class ProviderTests(unittest.TestCase):
@ -142,7 +142,7 @@ class DelegateTests(unittest.TestCase):
self.assertRaises(Error, Delegate, delegated=object()) self.assertRaises(Error, Delegate, delegated=object())
def test_call(self): def test_call(self):
""" Test returning of delegated provider.""" """Test returning of delegated provider."""
delegated1 = self.delegate() delegated1 = self.delegate()
delegated2 = self.delegate() delegated2 = self.delegate()

View File

@ -1,23 +1,23 @@
"""Objects utils unittests.""" """Dependency injector utils unittests."""
import unittest2 as unittest import unittest2 as unittest
from objects.utils import is_provider from dependency_injector.utils import is_provider
from objects.utils import ensure_is_provider from dependency_injector.utils import ensure_is_provider
from objects.utils import is_injection from dependency_injector.utils import is_injection
from objects.utils import ensure_is_injection from dependency_injector.utils import ensure_is_injection
from objects.utils import is_kwarg_injection from dependency_injector.utils import is_kwarg_injection
from objects.utils import is_attribute_injection from dependency_injector.utils import is_attribute_injection
from objects.utils import is_method_injection from dependency_injector.utils import is_method_injection
from objects.providers import Provider from dependency_injector.providers import Provider
from objects.injections import Injection from dependency_injector.injections import Injection
from objects.injections import KwArg from dependency_injector.injections import KwArg
from objects.injections import Attribute from dependency_injector.injections import Attribute
from objects.injections import Method from dependency_injector.injections import Method
from objects.errors import Error from dependency_injector.errors import Error
class IsProviderTests(unittest.TestCase): class IsProviderTests(unittest.TestCase):

View File

@ -33,21 +33,21 @@ basepython=python2.7
deps= deps=
pylint pylint
commands= commands=
- pylint -f colorized --rcfile=./.pylintrc objects - pylint -f colorized --rcfile=./.pylintrc dependency_injector
[testenv:flake8] [testenv:flake8]
basepython=python2.7 basepython=python2.7
deps= deps=
flake8 flake8
commands= commands=
flake8 --max-complexity=8 objects/ flake8 --max-complexity=8 dependency_injector/
[testenv:pep257] [testenv:pep257]
basepython=python2.7 basepython=python2.7
deps= deps=
pep257 pep257
commands= commands=
pep257 objects/ pep257 dependency_injector/
[testenv:py26] [testenv:py26]
basepython=python2.6 basepython=python2.6