From 6d0f892f8abab014603cedf62fded2bdc0aef94e Mon Sep 17 00:00:00 2001 From: Roman Mogilatov Date: Mon, 31 Aug 2015 16:31:38 +0300 Subject: [PATCH] Rename Objects to Dependency Injector --- .coveragerc | 2 +- LICENSE | 2 +- MANIFEST.in | 2 +- README.rst | 103 +++++++++--------- VERSION | 2 +- {objects => dependency_injector}/__init__.py | 5 +- {objects => dependency_injector}/catalog.py | 0 {objects => dependency_injector}/errors.py | 0 .../injections.py | 0 {objects => dependency_injector}/providers.py | 0 {objects => dependency_injector}/utils.py | 0 docs/Makefile | 8 +- docs/advanced_usage/index.rst | 9 +- docs/catalogs/index.rst | 10 +- docs/conf.py | 14 +-- docs/index.rst | 61 ++++++----- docs/main/changelog.rst | 11 +- docs/main/feedback.rst | 4 +- docs/main/installation.rst | 21 ++-- docs/main/introduction.rst | 33 +++--- docs/providers/custom.rst | 21 ++-- docs/providers/factory.rst | 8 +- examples/README.md | 11 -- examples/advanced_usage/config_provider.py | 14 +-- .../advanced_usage/inject_decorator_flask.py | 8 +- .../advanced_usage/inject_decorator_simple.py | 10 +- examples/catalogs/operating_with_providers.py | 14 +-- examples/catalogs/override.py | 14 +-- examples/catalogs/override_decorator.py | 16 +-- examples/catalogs/simple.py | 12 +- examples/concept.py | 22 ++-- examples/providers/callable_delegation.py | 6 +- examples/providers/callable_injections.py | 4 +- examples/providers/custom_factory.py | 4 +- examples/providers/external_dependency.py | 10 +- examples/providers/factory.py | 2 +- .../providers/factory_attribute_injections.py | 4 +- examples/providers/factory_delegation.py | 6 +- examples/providers/factory_init_injections.py | 4 +- .../factory_init_injections_and_contexts.py | 4 +- .../providers/factory_method_injections.py | 4 +- examples/providers/overriding_simple.py | 2 +- examples/providers/overriding_users_model.py | 4 +- examples/providers/singleton.py | 2 +- examples/providers/singleton_delegation.py | 4 +- examples/providers/singleton_reseting.py | 2 +- examples/providers/static.py | 8 +- setup.py | 8 +- tests/__init__.py | 2 +- tests/test_catalog.py | 13 +-- tests/test_injections.py | 16 +-- tests/test_providers.py | 36 +++--- tests/test_utils.py | 28 ++--- tox.ini | 6 +- 54 files changed, 308 insertions(+), 308 deletions(-) rename {objects => dependency_injector}/__init__.py (94%) rename {objects => dependency_injector}/catalog.py (100%) rename {objects => dependency_injector}/errors.py (100%) rename {objects => dependency_injector}/injections.py (100%) rename {objects => dependency_injector}/providers.py (100%) rename {objects => dependency_injector}/utils.py (100%) delete mode 100644 examples/README.md diff --git a/.coveragerc b/.coveragerc index 7c3eb86d..f7b135a6 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,3 +1,3 @@ [run] -include = objects/* +include = dependency_injector/* omit = tests/* diff --git a/LICENSE b/LICENSE index a5d52629..5e700dfa 100644 --- a/LICENSE +++ b/LICENSE @@ -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 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 this software without specific prior written permission. diff --git a/MANIFEST.in b/MANIFEST.in index 14229e80..1e8d9621 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,4 @@ -include objects/* +include dependency_injector/* include README.rst include LICENSE include VERSION diff --git a/README.rst b/README.rst index f9dd0143..88ef9c66 100644 --- a/README.rst +++ b/README.rst @@ -1,58 +1,59 @@ -Objects -======= +Dependency Injector +=================== Dependency injection framework for Python projects. -+---------------------------------------+-------------------------------------------------------------------+ -| *PyPi* | .. image:: https://img.shields.io/pypi/v/Objects.svg | -| | :target: https://pypi.python.org/pypi/Objects/ | -| | :alt: Latest Version | -| | .. image:: https://img.shields.io/pypi/dm/Objects.svg | -| | :target: https://pypi.python.org/pypi/Objects/ | -| | :alt: Downloads | -| | .. image:: https://img.shields.io/pypi/l/Objects.svg | -| | :target: https://pypi.python.org/pypi/Objects/ | -| | :alt: License | -+---------------------------------------+-------------------------------------------------------------------+ -| *Python versions and implementations* | .. image:: https://img.shields.io/pypi/pyversions/Objects.svg | -| | :target: https://pypi.python.org/pypi/Objects/ | -| | :alt: Supported Python versions | -| | .. image:: https://img.shields.io/pypi/implementation/Objects.svg | -| | :target: https://pypi.python.org/pypi/Objects/ | -| | :alt: Supported Python implementations | -+---------------------------------------+-------------------------------------------------------------------+ -| *Builds and tests coverage* | .. image:: https://travis-ci.org/rmk135/objects.svg?branch=master | -| | :target: https://travis-ci.org/rmk135/objects | -| | :alt: Build Status | -| | .. image:: https://coveralls.io/repos/rmk135/objects/badge.svg | -| | :target: https://coveralls.io/r/rmk135/objects | -| | :alt: Coverage Status | -+---------------------------------------+-------------------------------------------------------------------+ ++---------------------------------------+-------------------------------------------------------------------------------+ +| *PyPi* | .. image:: https://img.shields.io/pypi/v/dependency_injector.svg | +| | :target: https://pypi.python.org/pypi/dependency_injector/ | +| | :alt: Latest Version | +| | .. image:: https://img.shields.io/pypi/dm/dependency_injector.svg | +| | :target: https://pypi.python.org/pypi/dependency_injector/ | +| | :alt: Downloads | +| | .. image:: https://img.shields.io/pypi/l/dependency_injector.svg | +| | :target: https://pypi.python.org/pypi/dependency_injector/ | +| | :alt: License | ++---------------------------------------+-------------------------------------------------------------------------------+ +| *Python versions and implementations* | .. image:: https://img.shields.io/pypi/pyversions/dependency_injector.svg | +| | :target: https://pypi.python.org/pypi/dependency_injector/ | +| | :alt: Supported Python versions | +| | .. image:: https://img.shields.io/pypi/implementation/dependency_injector.svg | +| | :target: https://pypi.python.org/pypi/dependency_injector/ | +| | :alt: Supported Python implementations | ++---------------------------------------+-------------------------------------------------------------------------------+ +| *Builds and tests coverage* | .. image:: https://travis-ci.org/rmk135/dependency_injector.svg?branch=master | +| | :target: https://travis-ci.org/rmk135/dependency_injector | +| | :alt: Build Status | +| | .. image:: https://coveralls.io/repos/rmk135/dependency_injector/badge.svg | +| | :target: https://coveralls.io/r/rmk135/dependency_injector | +| | :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 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. - Obvious, clear structure. - Memory efficiency. - Semantic versioning. -Main idea of *Objects* is to keep dependencies under control. +Main idea of *Dependency Injector* is to keep dependencies under control. Installation ------------ -*Objects* library is available on PyPi_:: +*Dependency Injector* library is available on PyPi_:: - pip install objects + pip install dependency_injector Documentation ------------- -*Objects* documentation is hosted on ReadTheDocs: +*Dependency Injector* documentation is hosted on ReadTheDocs: - `Stable version`_ - `Latest version`_ @@ -62,16 +63,16 @@ Examples .. 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 objects.providers import Singleton + from dependency_injector.providers import Factory + from dependency_injector.providers import Singleton - from objects.injections import KwArg - from objects.injections import Attribute - from objects.injections import inject + from dependency_injector.injections import KwArg + from dependency_injector.injections import Attribute + from dependency_injector.injections import inject import sqlite3 @@ -97,21 +98,21 @@ Examples class Catalog(AbstractCatalog): - """Catalog of objects providers.""" + """Catalog of dependency_injector providers.""" database = Singleton(sqlite3.Connection, KwArg('database', ':memory:'), Attribute('row_factory', sqlite3.Row)) - """:type: (objects.Provider) -> sqlite3.Connection""" + """:type: (dependency_injector.Provider) -> sqlite3.Connection""" object_a_factory = Factory(ObjectA, KwArg('db', database)) - """:type: (objects.Provider) -> ObjectA""" + """:type: (dependency_injector.Provider) -> ObjectA""" object_b_factory = Factory(ObjectB, KwArg('a', object_a_factory), KwArg('db', database)) - """:type: (objects.Provider) -> ObjectB""" + """:type: (dependency_injector.Provider) -> ObjectB""" # Catalog static provides. @@ -134,26 +135,26 @@ Examples example() -You can get more *Objects* examples in ``/examples`` directory on +You can get more *Dependency Injector* examples in ``/examples`` directory on GitHub: - https://github.com/rmk135/objects + https://github.com/rmk135/dependency_injector Feedback -------- 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! -.. _PyPi: https://pypi.python.org/pypi/Objects -.. _Stable version: http://objects.readthedocs.org/en/stable/ -.. _Latest version: http://objects.readthedocs.org/en/latest/ +.. _PyPi: https://pypi.python.org/pypi/dependency_injector +.. _Stable version: http://dependency_injector.readthedocs.org/en/stable/ +.. _Latest version: http://dependency_injector.readthedocs.org/en/latest/ .. _SLOC: http://en.wikipedia.org/wiki/Source_lines_of_code .. _SOLID: http://en.wikipedia.org/wiki/SOLID_%28object-oriented_design%29 .. _IoC: http://en.wikipedia.org/wiki/Inversion_of_control diff --git a/VERSION b/VERSION index e7c7d3cc..a3df0a69 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.7.8 +0.8.0 diff --git a/objects/__init__.py b/dependency_injector/__init__.py similarity index 94% rename from objects/__init__.py rename to dependency_injector/__init__.py index b8b9a289..0e695761 100644 --- a/objects/__init__.py +++ b/dependency_injector/__init__.py @@ -1,7 +1,4 @@ -"""Objects. - -Dependency management tool for Python projects. -""" +"""Dependency injector.""" from .catalog import AbstractCatalog from .catalog import override diff --git a/objects/catalog.py b/dependency_injector/catalog.py similarity index 100% rename from objects/catalog.py rename to dependency_injector/catalog.py diff --git a/objects/errors.py b/dependency_injector/errors.py similarity index 100% rename from objects/errors.py rename to dependency_injector/errors.py diff --git a/objects/injections.py b/dependency_injector/injections.py similarity index 100% rename from objects/injections.py rename to dependency_injector/injections.py diff --git a/objects/providers.py b/dependency_injector/providers.py similarity index 100% rename from objects/providers.py rename to dependency_injector/providers.py diff --git a/objects/utils.py b/dependency_injector/utils.py similarity index 100% rename from objects/utils.py rename to dependency_injector/utils.py diff --git a/docs/Makefile b/docs/Makefile index 2914875a..718bbd1e 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -87,9 +87,9 @@ qthelp: @echo @echo "Build finished; now you can run "qcollectiongenerator" with the" \ ".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 "# assistant -collectionFile $(BUILDDIR)/qthelp/objects.qhc" + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/dependency_injector.qhc" applehelp: $(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp @@ -104,8 +104,8 @@ devhelp: @echo @echo "Build finished." @echo "To view the help file:" - @echo "# mkdir -p $$HOME/.local/share/devhelp/objects" - @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/objects" + @echo "# mkdir -p $$HOME/.local/share/devhelp/dependency_injector" + @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/dependency_injector" @echo "# devhelp" epub: diff --git a/docs/advanced_usage/index.rst b/docs/advanced_usage/index.rst index a8c3c7b6..eb39613a 100644 --- a/docs/advanced_usage/index.rst +++ b/docs/advanced_usage/index.rst @@ -2,7 +2,8 @@ Advanced usage ============== -Current section of documentation describes advanced usage of *Objects*. +Current section of documentation describes advanced usage of +*Dependency Injector*. @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. ``@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, -that will be called to provide injectable value. +Any Python object will be injected *as is*, except *Dependency Injector* +providers, that will be called to provide injectable value. Example: diff --git a/docs/catalogs/index.rst b/docs/catalogs/index.rst index 8ecc7a22..bf3005d0 100644 --- a/docs/catalogs/index.rst +++ b/docs/catalogs/index.rst @@ -20,7 +20,7 @@ Writing catalogs ---------------- 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 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:: It might be useful to add such - ``""":type: (objects.Provider) -> Object1"""`` documentation blocks one - line after provider definition for every provider. It will help code - analysis tools and IDE's to understand that variable above contains some - callable object, that returns particular instance as a result of call. + ``""":type: (dependency_injector.Provider) -> Object1"""`` documentation + blocks one line after provider definition for every provider. It will help + code analysis tools and IDE's to understand that variable above contains + some callable object, that returns particular instance as a result of call. Example: diff --git a/docs/conf.py b/docs/conf.py index 40823824..b6cd512c 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,6 +1,6 @@ # -*- 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. # # This file is execfile()d with the current directory set to its @@ -44,7 +44,7 @@ source_suffix = '.rst' master_doc = 'index' # General information about the project. -project = u'Objects' +project = u'Dependency Injector' copyright = u'2015, Roman Mogilatov' author = u'Roman Mogilatov' @@ -201,7 +201,7 @@ html_static_path = ['_static'] #html_search_scorer = 'scorer.js' # 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 # docs.readthedocs.org @@ -234,7 +234,7 @@ latex_elements = { # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - (master_doc, 'Objects.tex', u'Objects Documentation', + (master_doc, 'dependency_injector.tex', u'Dependency Injector Documentation', u'Roman Mogilatov', 'manual'), ] @@ -264,7 +264,7 @@ latex_documents = [ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - (master_doc, 'Objects', u'Objects Documentation', + (master_doc, 'Dependency Injector', u'Dependency Injector Documentation', [author], 1) ] @@ -278,8 +278,8 @@ man_pages = [ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - (master_doc, 'Objects', u'Objects Documentation', - author, 'Objects', 'Dependency management tool for Python projects.', + (master_doc, 'Dependency Injector', u'Dependency Injector Documentation', + author, 'Dependency Injector', 'Dependency management tool for Python projects.', 'Miscellaneous'), ] diff --git a/docs/index.rst b/docs/index.rst index e668f1b5..8ded4413 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,46 +1,47 @@ -Objects -======= +Dependency Injector +=================== Dependency injection framework for Python projects. -+---------------------------------------+-------------------------------------------------------------------+ -| *PyPi* | .. image:: https://img.shields.io/pypi/v/Objects.svg | -| | :target: https://pypi.python.org/pypi/Objects/ | -| | :alt: Latest Version | -| | .. image:: https://img.shields.io/pypi/dm/Objects.svg | -| | :target: https://pypi.python.org/pypi/Objects/ | -| | :alt: Downloads | -| | .. image:: https://img.shields.io/pypi/l/Objects.svg | -| | :target: https://pypi.python.org/pypi/Objects/ | -| | :alt: License | -+---------------------------------------+-------------------------------------------------------------------+ -| *Python versions and implementations* | .. image:: https://img.shields.io/pypi/pyversions/Objects.svg | -| | :target: https://pypi.python.org/pypi/Objects/ | -| | :alt: Supported Python versions | -| | .. image:: https://img.shields.io/pypi/implementation/Objects.svg | -| | :target: https://pypi.python.org/pypi/Objects/ | -| | :alt: Supported Python implementations | -+---------------------------------------+-------------------------------------------------------------------+ -| *Builds and tests coverage* | .. image:: https://travis-ci.org/rmk135/objects.svg?branch=master | -| | :target: https://travis-ci.org/rmk135/objects | -| | :alt: Build Status | -| | .. image:: https://coveralls.io/repos/rmk135/objects/badge.svg | -| | :target: https://coveralls.io/r/rmk135/objects | -| | :alt: Coverage Status | -+---------------------------------------+-------------------------------------------------------------------+ ++---------------------------------------+-------------------------------------------------------------------------------+ +| *PyPi* | .. image:: https://img.shields.io/pypi/v/dependency_injector.svg | +| | :target: https://pypi.python.org/pypi/dependency_injector/ | +| | :alt: Latest Version | +| | .. image:: https://img.shields.io/pypi/dm/dependency_injector.svg | +| | :target: https://pypi.python.org/pypi/dependency_injector/ | +| | :alt: Downloads | +| | .. image:: https://img.shields.io/pypi/l/dependency_injector.svg | +| | :target: https://pypi.python.org/pypi/dependency_injector/ | +| | :alt: License | ++---------------------------------------+-------------------------------------------------------------------------------+ +| *Python versions and implementations* | .. image:: https://img.shields.io/pypi/pyversions/dependency_injector.svg | +| | :target: https://pypi.python.org/pypi/dependency_injector/ | +| | :alt: Supported Python versions | +| | .. image:: https://img.shields.io/pypi/implementation/dependency_injector.svg | +| | :target: https://pypi.python.org/pypi/dependency_injector/ | +| | :alt: Supported Python implementations | ++---------------------------------------+-------------------------------------------------------------------------------+ +| *Builds and tests coverage* | .. image:: https://travis-ci.org/rmk135/dependency_injector.svg?branch=master | +| | :target: https://travis-ci.org/rmk135/dependency_injector | +| | :alt: Build Status | +| | .. image:: https://coveralls.io/repos/rmk135/dependency_injector/badge.svg | +| | :target: https://coveralls.io/r/rmk135/dependency_injector | +| | :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 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. - Obvious, clear structure. - Memory efficiency. - Semantic versioning. -Main idea of *Objects* is to keep dependencies under control. +Main idea of *Dependency Injector* is to keep dependencies under control. Contents -------- diff --git a/docs/main/changelog.rst b/docs/main/changelog.rst index a22ac8b7..12c476df 100644 --- a/docs/main/changelog.rst +++ b/docs/main/changelog.rst @@ -1,10 +1,11 @@ Changelog ========= -This document describes all the changes in *Objects* framework that were made -in every particular version. +This document describes all the changes in *Dependency Injector* framework +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 @@ -12,6 +13,10 @@ Development version - No features. +0.8.0 +----- +- ``Objects`` is renamed to ``Dependency Injector``. + 0.7.8 ----- - Fixing @inject import bug in examples. diff --git a/docs/main/feedback.rst b/docs/main/feedback.rst index b34ebda2..8a9e344c 100644 --- a/docs/main/feedback.rst +++ b/docs/main/feedback.rst @@ -2,8 +2,8 @@ Feedback ======== 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! diff --git a/docs/main/installation.rst b/docs/main/installation.rst index 9a9cd48f..06ce5e6e 100644 --- a/docs/main/installation.rst +++ b/docs/main/installation.rst @@ -1,27 +1,28 @@ 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 -installed from PyPi_: +Latest stable version (and all previous versions) of *Dependency Injector* +framework can be installed from PyPi_: .. code-block:: bash # Installing latest version: - pip install objects + pip install dependency_injector # Installing particular version: - pip install objects==0.7.5 + pip install dependency_injector==0.7.5 Sources can be cloned from GitHub_: .. 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 -.. _GitHub: https://github.com/rmk135/objects -.. _GitHub releases page: https://github.com/rmk135/objects/releases +.. _PyPi: https://pypi.python.org/pypi/dependency_injector +.. _GitHub: https://github.com/rmk135/dependency_injector +.. _GitHub releases page: https://github.com/rmk135/dependency_injector/releases diff --git a/docs/main/introduction.rst b/docs/main/introduction.rst index fa7b47b9..70ef2c5a 100644 --- a/docs/main/introduction.rst +++ b/docs/main/introduction.rst @@ -1,8 +1,8 @@ Introduction ============ -Before you have started with *Objects* framework and dependecy injection, there -are a couple of introduction notes that might be useful. +Before you have started with *Dependency Injector* framework and dependecy +injection, there are a couple of introduction notes that might be useful. What is DI and why is it needed? -------------------------------- @@ -43,24 +43,25 @@ ways to do dependency injection container. 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 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. - Obvious, clear structure. - Memory efficiency. - 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 ------------- -Current section describes *Objects* main entities and their interaction with -each other. +Current section describes *Dependency Injector* main entities and their +interaction with each other. .. image:: /images/internals.png :width: 100% @@ -69,18 +70,20 @@ each other. There are 3 main entities: - Providers. Providers are strategies of accesing objects. For example, - ``objects.providers.Factory`` creates new instance of provided class every - time it is called. ``objects.providers.Singleton`` creates provided instance - once and returns it on every next call. Providers could be overridden by - another providers. Base class is - ``objects.providers.Provider``. + ``dependency_injector.providers.Factory`` creates new instance of provided + class every time it is called. ``dependency_injector.providers.Singleton`` + creates provided instance once and returns it on every next call. Providers + could be overridden by another providers. Base class is - + ``dependency_injector.providers.Provider``. - Injections. Injections are instructions for making dependency injections (there are several ways how they could be done). Injections are used mostly - by ``objects.providers.Factory`` and ``objects.providers.Singleton`` - providers, but these are not only cases. Base class is - - ``objects.injections.Injection``. + by ``dependency_injector.providers.Factory`` and + ``dependency_injector.providers.Singleton`` providers, but these are not only + cases. Base class is - + ``dependency_injector.injections.Injection``. - Catalogs. Catalogs are collections of providers. They are used for grouping 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 diff --git a/docs/providers/custom.rst b/docs/providers/custom.rst index 9f5f4d9b..26d27153 100644 --- a/docs/providers/custom.rst +++ b/docs/providers/custom.rst @@ -1,28 +1,31 @@ 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: 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: - parent initializer (``objects.providers.Provider.__init__()``) has - to be called. + parent initializer + (``dependency_injector.providers.Provider.__init__()``) has to be called. 3. Providing strategy has to be implemented in custom provider's ``_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()``. 4. If custom provider is based on some standard providers, it is better to use delegation of standard providers, then extending of them. 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``, ``Singleton`` providers), it is strongly recommended to use - ``objects.injections.Injection`` and its subclasses: - ``objects.injections.KwArg``, ``objects.injections.Attribute`` and - ``objects.injections.Method``. + ``dependency_injector.injections.Injection`` and its subclasses: + ``dependency_injector.injections.KwArg``, + ``dependency_injector.injections.Attribute`` and + ``dependency_injector.injections.Method``. Example: diff --git a/docs/providers/factory.rst b/docs/providers/factory.rst index ceedb6ce..dce1b5a7 100644 --- a/docs/providers/factory.rst +++ b/docs/providers/factory.rst @@ -18,14 +18,14 @@ Factory providers and injections Objects can take dependencies in different forms. Some objects take init arguments, other are using attributes setting or method calls to be 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 what kind of dependency injections need to be done. -All of those instructions are defined in ``objects.injections`` module and are -subclasses of ``objects.injections.Injection``. There are several types of -injections that are used by ``Factory`` provider: +All of those instructions are defined in ``dependency_injector.injections`` +module and are subclasses of ``dependency_injector.injections.Injection``. +There are several types of injections that are used by ``Factory`` provider: + ``KwArg`` - injection is done by passing injectable value in object's ``__init__()`` method in time of object's creation via keyword argument. diff --git a/examples/README.md b/examples/README.md deleted file mode 100644 index e7c16110..00000000 --- a/examples/README.md +++ /dev/null @@ -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) diff --git a/examples/advanced_usage/config_provider.py b/examples/advanced_usage/config_provider.py index dd895003..054d7519 100644 --- a/examples/advanced_usage/config_provider.py +++ b/examples/advanced_usage/config_provider.py @@ -1,9 +1,9 @@ """Config provider examples.""" -from objects.catalog import AbstractCatalog -from objects.providers import Config -from objects.providers import Factory -from objects.injections import KwArg +from dependency_injector.catalog import AbstractCatalog +from dependency_injector.providers import Config +from dependency_injector.providers import Factory +from dependency_injector.injections import KwArg class ObjectA(object): @@ -19,16 +19,16 @@ class ObjectA(object): class Catalog(AbstractCatalog): - """Catalog of objects providers.""" + """Catalog of dependency_injector providers.""" config = Config() - """:type: (objects.Config)""" + """:type: (dependency_injector.Config)""" object_a = Factory(ObjectA, KwArg('fee', config.FEE), KwArg('price', config.PRICE), KwArg('timezone', config.GLOBAL.TIMEZONE)) - """:type: (objects.Provider) -> ObjectA""" + """:type: (dependency_injector.Provider) -> ObjectA""" # Setting config value and making some tests. diff --git a/examples/advanced_usage/inject_decorator_flask.py b/examples/advanced_usage/inject_decorator_flask.py index 8aac55bd..0122ba1e 100644 --- a/examples/advanced_usage/inject_decorator_flask.py +++ b/examples/advanced_usage/inject_decorator_flask.py @@ -4,10 +4,10 @@ import sqlite3 from flask import Flask -from objects.providers import Singleton -from objects.injections import KwArg -from objects.injections import Attribute -from objects.injections import inject +from dependency_injector.providers import Singleton +from dependency_injector.injections import KwArg +from dependency_injector.injections import Attribute +from dependency_injector.injections import inject # Database and `ObjectA` providers. diff --git a/examples/advanced_usage/inject_decorator_simple.py b/examples/advanced_usage/inject_decorator_simple.py index 504d167d..82218b29 100644 --- a/examples/advanced_usage/inject_decorator_simple.py +++ b/examples/advanced_usage/inject_decorator_simple.py @@ -1,14 +1,14 @@ """`@inject` decorator simple example.""" -from objects.providers import Factory -from objects.injections import KwArg -from objects.injections import inject +from dependency_injector.providers import Factory +from dependency_injector.injections import KwArg +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)) def example_callback(new_object, some_setting): """Example callback that does some asserts with input args.""" diff --git a/examples/catalogs/operating_with_providers.py b/examples/catalogs/operating_with_providers.py index 3f8471e6..3c82b0e7 100644 --- a/examples/catalogs/operating_with_providers.py +++ b/examples/catalogs/operating_with_providers.py @@ -1,8 +1,8 @@ """Operating with catalog providers example.""" -from objects.catalog import AbstractCatalog -from objects.providers import Factory -from objects.providers import Singleton +from dependency_injector.catalog import AbstractCatalog +from dependency_injector.providers import Factory +from dependency_injector.providers import Singleton class Catalog(AbstractCatalog): @@ -10,16 +10,16 @@ class Catalog(AbstractCatalog): """Providers catalog.""" provider1 = Factory(object) - """:type: (objects.Provider) -> object""" + """:type: (dependency_injector.Provider) -> object""" provider2 = Factory(object) - """:type: (objects.Provider) -> object""" + """:type: (dependency_injector.Provider) -> object""" provider3 = Singleton(object) - """:type: (objects.Provider) -> object""" + """:type: (dependency_injector.Provider) -> object""" provider4 = Singleton(object) - """:type: (objects.Provider) -> object""" + """:type: (dependency_injector.Provider) -> object""" # Making some asserts: diff --git a/examples/catalogs/override.py b/examples/catalogs/override.py index bb691c1b..baaf690c 100644 --- a/examples/catalogs/override.py +++ b/examples/catalogs/override.py @@ -2,9 +2,9 @@ from collections import namedtuple -from objects.catalog import AbstractCatalog -from objects.providers import Factory -from objects.injections import KwArg +from dependency_injector.catalog import AbstractCatalog +from dependency_injector.providers import Factory +from dependency_injector.injections import KwArg # Creating some example classes: @@ -20,11 +20,11 @@ class Catalog(AbstractCatalog): object1_factory = Factory(Object1, KwArg('arg1', 1), KwArg('arg2', 2)) - """:type: (objects.Provider) -> Object1""" + """:type: (dependency_injector.Provider) -> Object1""" object2_factory = Factory(Object2, KwArg('object1', object1_factory)) - """:type: (objects.Provider) -> Object2""" + """:type: (dependency_injector.Provider) -> Object2""" class AnotherCatalog(AbstractCatalog): @@ -32,13 +32,13 @@ class AnotherCatalog(AbstractCatalog): """Another providers catalog.""" object2_factory = Factory(ExtendedObject2) - """:type: (objects.Provider) -> ExtendedObject2""" + """:type: (dependency_injector.Provider) -> ExtendedObject2""" # Overriding `Catalog` with `AnotherCatalog`: Catalog.override(AnotherCatalog) -# Creating some objects using overridden catalog: +# Creating some dependency_injector using overridden catalog: object2_1 = Catalog.object2_factory() object2_2 = Catalog.object2_factory() diff --git a/examples/catalogs/override_decorator.py b/examples/catalogs/override_decorator.py index d9a33f4e..27fa9c24 100644 --- a/examples/catalogs/override_decorator.py +++ b/examples/catalogs/override_decorator.py @@ -2,10 +2,10 @@ from collections import namedtuple -from objects.catalog import AbstractCatalog -from objects.catalog import override -from objects.providers import Factory -from objects.injections import KwArg +from dependency_injector.catalog import AbstractCatalog +from dependency_injector.catalog import override +from dependency_injector.providers import Factory +from dependency_injector.injections import KwArg # Creating some example classes: @@ -21,11 +21,11 @@ class Catalog(AbstractCatalog): object1_factory = Factory(Object1, KwArg('arg1', 1), KwArg('arg2', 2)) - """:type: (objects.Provider) -> Object1""" + """:type: (dependency_injector.Provider) -> Object1""" object2_factory = Factory(Object2, KwArg('object1', object1_factory)) - """:type: (objects.Provider) -> Object2""" + """:type: (dependency_injector.Provider) -> Object2""" # Overriding `Catalog` with `AnotherCatalog`: @@ -35,10 +35,10 @@ class AnotherCatalog(AbstractCatalog): """Another providers catalog.""" 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_2 = Catalog.object2_factory() diff --git a/examples/catalogs/simple.py b/examples/catalogs/simple.py index 7a00976b..951da2e1 100644 --- a/examples/catalogs/simple.py +++ b/examples/catalogs/simple.py @@ -2,9 +2,9 @@ from collections import namedtuple -from objects.catalog import AbstractCatalog -from objects.providers import Factory -from objects.injections import KwArg +from dependency_injector.catalog import AbstractCatalog +from dependency_injector.providers import Factory +from dependency_injector.injections import KwArg # Creating some example classes: @@ -19,13 +19,13 @@ class Catalog(AbstractCatalog): object1_factory = Factory(Object1, KwArg('arg1', 1), KwArg('arg2', 2)) - """:type: (objects.Provider) -> Object1""" + """:type: (dependency_injector.Provider) -> Object1""" object2_factory = Factory(Object2, 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_2 = Catalog.object2_factory() diff --git a/examples/concept.py b/examples/concept.py index 767440b2..59f9eab6 100644 --- a/examples/concept.py +++ b/examples/concept.py @@ -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 objects.providers import Singleton +from dependency_injector.providers import Factory +from dependency_injector.providers import Singleton -from objects.injections import KwArg -from objects.injections import Attribute -from objects.injections import inject +from dependency_injector.injections import KwArg +from dependency_injector.injections import Attribute +from dependency_injector.injections import inject import sqlite3 @@ -33,21 +33,21 @@ class ObjectB(object): class Catalog(AbstractCatalog): - """Catalog of objects providers.""" + """Catalog of dependency_injector providers.""" database = Singleton(sqlite3.Connection, KwArg('database', ':memory:'), Attribute('row_factory', sqlite3.Row)) - """:type: (objects.Provider) -> sqlite3.Connection""" + """:type: (dependency_injector.Provider) -> sqlite3.Connection""" object_a_factory = Factory(ObjectA, KwArg('db', database)) - """:type: (objects.Provider) -> ObjectA""" + """:type: (dependency_injector.Provider) -> ObjectA""" object_b_factory = Factory(ObjectB, KwArg('a', object_a_factory), KwArg('db', database)) - """:type: (objects.Provider) -> ObjectB""" + """:type: (dependency_injector.Provider) -> ObjectB""" # Catalog static provides. diff --git a/examples/providers/callable_delegation.py b/examples/providers/callable_delegation.py index d8569afe..86f487a0 100644 --- a/examples/providers/callable_delegation.py +++ b/examples/providers/callable_delegation.py @@ -2,11 +2,11 @@ import sys -from objects.providers import Callable -from objects.providers import Delegate +from dependency_injector.providers import Callable +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_delegate1 = callable_provider.delegate() callable_provider_delegate2 = Delegate(callable_provider) diff --git a/examples/providers/callable_injections.py b/examples/providers/callable_injections.py index a85023dc..3fcfac9c 100644 --- a/examples/providers/callable_injections.py +++ b/examples/providers/callable_injections.py @@ -2,8 +2,8 @@ from passlib.hash import sha256_crypt -from objects.providers import Callable -from objects.injections import KwArg +from dependency_injector.providers import Callable +from dependency_injector.injections import KwArg # Password hasher and verifier providers (hash function could be changed diff --git a/examples/providers/custom_factory.py b/examples/providers/custom_factory.py index 82dae96f..b62306bd 100644 --- a/examples/providers/custom_factory.py +++ b/examples/providers/custom_factory.py @@ -1,7 +1,7 @@ """Custom `Factory` example.""" -from objects.providers import Provider -from objects.providers import Factory +from dependency_injector.providers import Provider +from dependency_injector.providers import Factory class User(object): diff --git a/examples/providers/external_dependency.py b/examples/providers/external_dependency.py index 796be0e3..a330d466 100644 --- a/examples/providers/external_dependency.py +++ b/examples/providers/external_dependency.py @@ -1,11 +1,11 @@ """`ExternalDependency` providers example.""" -from objects.providers import ExternalDependency -from objects.providers import Factory -from objects.providers import Singleton +from dependency_injector.providers import ExternalDependency +from dependency_injector.providers import Factory +from dependency_injector.providers import Singleton -from objects.injections import KwArg -from objects.injections import Attribute +from dependency_injector.injections import KwArg +from dependency_injector.injections import Attribute # Importing SQLITE3 and contextlib.closing for working with cursors: import sqlite3 diff --git a/examples/providers/factory.py b/examples/providers/factory.py index f1a48df2..c654597c 100644 --- a/examples/providers/factory.py +++ b/examples/providers/factory.py @@ -1,6 +1,6 @@ """`Factory` providers example.""" -from objects.providers import Factory +from dependency_injector.providers import Factory class User(object): diff --git a/examples/providers/factory_attribute_injections.py b/examples/providers/factory_attribute_injections.py index f28c179e..02a46d25 100644 --- a/examples/providers/factory_attribute_injections.py +++ b/examples/providers/factory_attribute_injections.py @@ -1,7 +1,7 @@ """`Factory` providers with attribute injections example.""" -from objects.providers import Factory -from objects.injections import Attribute +from dependency_injector.providers import Factory +from dependency_injector.injections import Attribute class User(object): diff --git a/examples/providers/factory_delegation.py b/examples/providers/factory_delegation.py index 3daf6f2a..4715077f 100644 --- a/examples/providers/factory_delegation.py +++ b/examples/providers/factory_delegation.py @@ -1,7 +1,7 @@ """`Factory` providers delegation example.""" -from objects.providers import Factory -from objects.injections import KwArg +from dependency_injector.providers import Factory +from dependency_injector.injections import KwArg class User(object): @@ -11,7 +11,7 @@ class User(object): def __init__(self, photos_factory): """Initializer. - :param photos_factory: (objects.providers.Factory) -> Photo + :param photos_factory: (dependency_injector.providers.Factory) -> Photo """ self.photos_factory = photos_factory self._main_photo = None diff --git a/examples/providers/factory_init_injections.py b/examples/providers/factory_init_injections.py index 4d7a87a5..adef160e 100644 --- a/examples/providers/factory_init_injections.py +++ b/examples/providers/factory_init_injections.py @@ -1,7 +1,7 @@ """`Factory` providers with init injections example.""" -from objects.providers import Factory -from objects.injections import KwArg +from dependency_injector.providers import Factory +from dependency_injector.injections import KwArg class User(object): diff --git a/examples/providers/factory_init_injections_and_contexts.py b/examples/providers/factory_init_injections_and_contexts.py index 60eed5f6..9058d5b0 100644 --- a/examples/providers/factory_init_injections_and_contexts.py +++ b/examples/providers/factory_init_injections_and_contexts.py @@ -1,7 +1,7 @@ """`Factory` providers with init injections and context arguments example.""" -from objects.providers import Factory -from objects.injections import KwArg +from dependency_injector.providers import Factory +from dependency_injector.injections import KwArg class User(object): diff --git a/examples/providers/factory_method_injections.py b/examples/providers/factory_method_injections.py index 67acc041..0a7af9c0 100644 --- a/examples/providers/factory_method_injections.py +++ b/examples/providers/factory_method_injections.py @@ -1,7 +1,7 @@ """`Factory` providers with method injections example.""" -from objects.providers import Factory -from objects.injections import Method +from dependency_injector.providers import Factory +from dependency_injector.injections import Method class User(object): diff --git a/examples/providers/overriding_simple.py b/examples/providers/overriding_simple.py index a4573715..31e659c0 100644 --- a/examples/providers/overriding_simple.py +++ b/examples/providers/overriding_simple.py @@ -1,6 +1,6 @@ """Simple providers overriding example.""" -from objects.providers import Factory +from dependency_injector.providers import Factory class User(object): diff --git a/examples/providers/overriding_users_model.py b/examples/providers/overriding_users_model.py index 862abd11..f2c6e367 100644 --- a/examples/providers/overriding_users_model.py +++ b/examples/providers/overriding_users_model.py @@ -1,7 +1,7 @@ """Overriding user's model example.""" -from objects.providers import Factory -from objects.injections import KwArg +from dependency_injector.providers import Factory +from dependency_injector.injections import KwArg class User(object): diff --git a/examples/providers/singleton.py b/examples/providers/singleton.py index 92caca00..934437b7 100644 --- a/examples/providers/singleton.py +++ b/examples/providers/singleton.py @@ -1,6 +1,6 @@ """`Singleton` providers example.""" -from objects.providers import Singleton +from dependency_injector.providers import Singleton class UserService(object): diff --git a/examples/providers/singleton_delegation.py b/examples/providers/singleton_delegation.py index 9ca2fce9..e15fe51f 100644 --- a/examples/providers/singleton_delegation.py +++ b/examples/providers/singleton_delegation.py @@ -1,7 +1,7 @@ """`Singleton` providers delegation example.""" -from objects.providers import Singleton -from objects.providers import Delegate +from dependency_injector.providers import Singleton +from dependency_injector.providers import Delegate # Some singleton provider and few delegates of it: diff --git a/examples/providers/singleton_reseting.py b/examples/providers/singleton_reseting.py index be5780ef..a6dc2012 100644 --- a/examples/providers/singleton_reseting.py +++ b/examples/providers/singleton_reseting.py @@ -1,6 +1,6 @@ """`Singleton` providers resetting example.""" -from objects.providers import Singleton +from dependency_injector.providers import Singleton class UserService(object): diff --git a/examples/providers/static.py b/examples/providers/static.py index 941756ed..69bff4b8 100644 --- a/examples/providers/static.py +++ b/examples/providers/static.py @@ -1,9 +1,9 @@ """`Static` providers example.""" -from objects.providers import Class -from objects.providers import Object -from objects.providers import Function -from objects.providers import Value +from dependency_injector.providers import Class +from dependency_injector.providers import Object +from dependency_injector.providers import Function +from dependency_injector.providers import Value # Provides class - `object`: diff --git a/setup.py b/setup.py index b1a1d80f..0862e0f1 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,4 @@ -"""`Objects` setup script.""" +"""`Dependency injector` setup script.""" import os from setuptools import setup @@ -44,7 +44,7 @@ class PublishCommand(Command): os.system('git push --tags') -setup(name='Objects', +setup(name='dependency_injector', version=version, description=SHORT_DESCRIPTION, long_description=description, @@ -52,9 +52,9 @@ setup(name='Objects', author_email='rmogilatov@gmail.com', maintainer='Roman Mogilatov', maintainer_email='rmogilatov@gmail.com', - url='https://github.com/rmk135/objects', + url='https://github.com/rmk135/dependency_injector', license='BSD New', - packages=['objects'], + packages=['dependency_injector'], zip_safe=True, install_requires=requirements, cmdclass={ diff --git a/tests/__init__.py b/tests/__init__.py index 35e432be..3a003995 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1 +1 @@ -"""Objects unittests.""" +"""Dependency injector unittests.""" diff --git a/tests/test_catalog.py b/tests/test_catalog.py index cc17a499..aa91da63 100644 --- a/tests/test_catalog.py +++ b/tests/test_catalog.py @@ -1,14 +1,14 @@ -"""Objects catalog unittests.""" +"""Dependency injector catalog unittests.""" import unittest2 as unittest -from objects.catalog import AbstractCatalog -from objects.catalog import override +from dependency_injector.catalog import AbstractCatalog +from dependency_injector.catalog import override -from objects.providers import Object -from objects.providers import Value +from dependency_injector.providers import Object +from dependency_injector.providers import Value -from objects.errors import Error +from dependency_injector.errors import Error class CatalogTests(unittest.TestCase): @@ -94,4 +94,3 @@ class OverrideTests(unittest.TestCase): self.assertEqual(self.Catalog.obj(), 1) self.assertEqual(self.Catalog.another_obj(), 2) - diff --git a/tests/test_injections.py b/tests/test_injections.py index 84d66cf3..6e344d4b 100644 --- a/tests/test_injections.py +++ b/tests/test_injections.py @@ -1,16 +1,16 @@ -"""Objects injections unittests.""" +"""Dependency injector injections unittests.""" import unittest2 as unittest -from objects.injections import Injection -from objects.injections import KwArg -from objects.injections import Attribute -from objects.injections import Method -from objects.injections import inject +from dependency_injector.injections import Injection +from dependency_injector.injections import KwArg +from dependency_injector.injections import Attribute +from dependency_injector.injections import Method +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): diff --git a/tests/test_providers.py b/tests/test_providers.py index 16c9bf16..485988cd 100644 --- a/tests/test_providers.py +++ b/tests/test_providers.py @@ -1,26 +1,26 @@ -"""Objects providers unittests.""" +"""Dependency injector providers unittests.""" import unittest2 as unittest -from objects.providers import Provider -from objects.providers import Delegate -from objects.providers import Factory -from objects.providers import Singleton -from objects.providers import ExternalDependency -from objects.providers import Class -from objects.providers import Object -from objects.providers import Function -from objects.providers import Value -from objects.providers import Callable -from objects.providers import Config +from dependency_injector.providers import Provider +from dependency_injector.providers import Delegate +from dependency_injector.providers import Factory +from dependency_injector.providers import Singleton +from dependency_injector.providers import ExternalDependency +from dependency_injector.providers import Class +from dependency_injector.providers import Object +from dependency_injector.providers import Function +from dependency_injector.providers import Value +from dependency_injector.providers import Callable +from dependency_injector.providers import Config -from objects.injections import KwArg -from objects.injections import Attribute -from objects.injections import Method +from dependency_injector.injections import KwArg +from dependency_injector.injections import Attribute +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): @@ -142,7 +142,7 @@ class DelegateTests(unittest.TestCase): self.assertRaises(Error, Delegate, delegated=object()) def test_call(self): - """ Test returning of delegated provider.""" + """Test returning of delegated provider.""" delegated1 = self.delegate() delegated2 = self.delegate() diff --git a/tests/test_utils.py b/tests/test_utils.py index 3de7e5e7..23325220 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -1,23 +1,23 @@ -"""Objects utils unittests.""" +"""Dependency injector utils unittests.""" import unittest2 as unittest -from objects.utils import is_provider -from objects.utils import ensure_is_provider -from objects.utils import is_injection -from objects.utils import ensure_is_injection -from objects.utils import is_kwarg_injection -from objects.utils import is_attribute_injection -from objects.utils import is_method_injection +from dependency_injector.utils import is_provider +from dependency_injector.utils import ensure_is_provider +from dependency_injector.utils import is_injection +from dependency_injector.utils import ensure_is_injection +from dependency_injector.utils import is_kwarg_injection +from dependency_injector.utils import is_attribute_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 objects.injections import KwArg -from objects.injections import Attribute -from objects.injections import Method +from dependency_injector.injections import Injection +from dependency_injector.injections import KwArg +from dependency_injector.injections import Attribute +from dependency_injector.injections import Method -from objects.errors import Error +from dependency_injector.errors import Error class IsProviderTests(unittest.TestCase): diff --git a/tox.ini b/tox.ini index bb950ba9..cd3004ca 100644 --- a/tox.ini +++ b/tox.ini @@ -33,21 +33,21 @@ basepython=python2.7 deps= pylint commands= - - pylint -f colorized --rcfile=./.pylintrc objects + - pylint -f colorized --rcfile=./.pylintrc dependency_injector [testenv:flake8] basepython=python2.7 deps= flake8 commands= - flake8 --max-complexity=8 objects/ + flake8 --max-complexity=8 dependency_injector/ [testenv:pep257] basepython=python2.7 deps= pep257 commands= - pep257 objects/ + pep257 dependency_injector/ [testenv:py26] basepython=python2.6