diff --git a/dependency_injector/__init__.py b/dependency_injector/__init__.py index 6fdada55..9ccde7be 100644 --- a/dependency_injector/__init__.py +++ b/dependency_injector/__init__.py @@ -1,126 +1,7 @@ -"""Dependency injector.""" - -from dependency_injector.catalogs import ( - DeclarativeCatalog, - AbstractCatalog, - DynamicCatalog, - CatalogBundle, - override, -) - -from dependency_injector.providers import ( - Provider, - Delegate, - Callable, - DelegatedCallable, - Factory, - DelegatedFactory, - Singleton, - DelegatedSingleton, - ExternalDependency, - StaticProvider, - Class, - Object, - Function, - Value, - Config, -) - -from dependency_injector.injections import ( - Injection, - Arg, - KwArg, - Attribute, - Method, - inject, -) - -from dependency_injector.utils import ( - is_provider, - ensure_is_provider, - is_delegated_provider, - is_injection, - ensure_is_injection, - is_arg_injection, - is_kwarg_injection, - is_attribute_injection, - is_method_injection, - is_catalog, - is_dynamic_catalog, - is_declarative_catalog, - is_catalog_bundle, - ensure_is_catalog_bundle, -) - -from dependency_injector.errors import ( - Error, - UndefinedProviderError, -) - -# Backward compatibility for versions < 0.11.* -from dependency_injector import catalogs -catalog = catalogs +"""Dependency injector top-level package.""" VERSION = '2.0.0' """Version number that follows semantic versioning. :type: str """ - - -__all__ = ( - # Catalogs - 'DeclarativeCatalog', - 'AbstractCatalog', - 'DynamicCatalog', - 'CatalogBundle', - 'override', - - # Providers - 'Provider', - 'Delegate', - 'Callable', - 'DelegatedCallable', - 'Factory', - 'DelegatedFactory', - 'Singleton', - 'DelegatedSingleton', - 'ExternalDependency', - 'StaticProvider', - 'Class', - 'Object', - 'Function', - 'Value', - 'Config', - - # Injections - 'Injection', - 'Arg', - 'KwArg', - 'Attribute', - 'Method', - 'inject', - - # Utils - 'is_provider', - 'ensure_is_provider', - 'is_delegated_provider', - 'is_injection', - 'ensure_is_injection', - 'is_arg_injection', - 'is_kwarg_injection', - 'is_attribute_injection', - 'is_method_injection', - 'is_catalog', - 'is_dynamic_catalog', - 'is_declarative_catalog', - 'is_catalog_bundle', - 'ensure_is_catalog_bundle', - - # Errors - 'Error', - 'UndefinedProviderError', - - # Version - 'VERSION' -) diff --git a/dependency_injector/catalogs/__init__.py b/dependency_injector/catalogs/__init__.py index a7405e76..a6a5b9c4 100644 --- a/dependency_injector/catalogs/__init__.py +++ b/dependency_injector/catalogs/__init__.py @@ -5,7 +5,6 @@ from dependency_injector.catalogs.dynamic import DynamicCatalog from dependency_injector.catalogs.declarative import ( DeclarativeCatalogMetaClass, DeclarativeCatalog, - AbstractCatalog, ) from dependency_injector.catalogs.utils import ( copy, @@ -18,7 +17,6 @@ __all__ = ( 'DynamicCatalog', 'DeclarativeCatalogMetaClass', 'DeclarativeCatalog', - 'AbstractCatalog', 'copy', 'override', ) diff --git a/dependency_injector/catalogs/declarative.py b/dependency_injector/catalogs/declarative.py index 5ba031cf..777ad9e8 100644 --- a/dependency_injector/catalogs/declarative.py +++ b/dependency_injector/catalogs/declarative.py @@ -368,8 +368,6 @@ class DeclarativeCatalog(object): """ return cls._catalog.get_provider(name) - get = get_provider # Backward compatibility for versions < 0.11.* - @classmethod def bind_provider(cls, name, provider, force=False, _set_as_attribute=True): @@ -429,8 +427,6 @@ class DeclarativeCatalog(object): """ return hasattr(cls, name) - has = has_provider # Backward compatibility for versions < 0.11.* - @classmethod def unbind_provider(cls, name): """Remove provider binding. @@ -485,7 +481,3 @@ class DeclarativeCatalog(object): :rtype: None """ raise NotImplementedError('Implementated in metaclass') - - -# Backward compatibility for versions < 0.11.* -AbstractCatalog = DeclarativeCatalog diff --git a/dependency_injector/providers/__init__.py b/dependency_injector/providers/__init__.py index 99324b3c..cddc53aa 100644 --- a/dependency_injector/providers/__init__.py +++ b/dependency_injector/providers/__init__.py @@ -4,7 +4,6 @@ from dependency_injector.providers.base import ( Provider, Delegate, Static, - StaticProvider, ExternalDependency, ) from dependency_injector.providers.callable import ( diff --git a/dependency_injector/providers/base.py b/dependency_injector/providers/base.py index ba21300d..12525588 100644 --- a/dependency_injector/providers/base.py +++ b/dependency_injector/providers/base.py @@ -276,10 +276,6 @@ class Static(Provider): __repr__ = __str__ -StaticProvider = Static -# Backward compatibility for versions < 1.11.1 - - @six.python_2_unicode_compatible class ExternalDependency(Provider): """:py:class:`ExternalDependency` provider describes dependency interface. diff --git a/docs/main/changelog.rst b/docs/main/changelog.rst index aa8cbfa4..f0f496ae 100644 --- a/docs/main/changelog.rst +++ b/docs/main/changelog.rst @@ -13,7 +13,7 @@ Development version 2.0.0 ------ -- TBD +- Drop backward compatibilities of 1.x. 1.17.0 ------ diff --git a/tests/catalogs/test_common.py b/tests/catalogs/test_common.py deleted file mode 100644 index c4eac40c..00000000 --- a/tests/catalogs/test_common.py +++ /dev/null @@ -1,14 +0,0 @@ -"""Dependency injector common catalogs unittests.""" - -import unittest2 as unittest - - -class CatalogModuleBackwardCompatibility(unittest.TestCase): - """Backward compatibility test of catalog module.""" - - def test_import_catalog(self): - """Test that module `catalog` is the same as `catalogs`.""" - from dependency_injector import catalog - from dependency_injector import catalogs - - self.assertIs(catalog, catalogs) diff --git a/tests/catalogs/test_declarative.py b/tests/catalogs/test_declarative.py index 6a35b0e4..302e82e2 100644 --- a/tests/catalogs/test_declarative.py +++ b/tests/catalogs/test_declarative.py @@ -241,11 +241,6 @@ class DeclarativeCatalogTests(unittest.TestCase): def test_get(self): """Test getting of providers using get() method.""" - self.assertIs(CatalogB.get('p11'), CatalogB.p11) - self.assertIs(CatalogB.get('p12'), CatalogB.p12) - self.assertIs(CatalogB.get('p22'), CatalogB.p22) - self.assertIs(CatalogB.get('p22'), CatalogB.p22) - self.assertIs(CatalogB.get_provider('p11'), CatalogB.p11) self.assertIs(CatalogB.get_provider('p12'), CatalogB.p12) self.assertIs(CatalogB.get_provider('p22'), CatalogB.p22) @@ -264,12 +259,6 @@ class DeclarativeCatalogTests(unittest.TestCase): def test_has(self): """Test checks of providers availability in catalog.""" - self.assertTrue(CatalogB.has('p11')) - self.assertTrue(CatalogB.has('p12')) - self.assertTrue(CatalogB.has('p21')) - self.assertTrue(CatalogB.has('p22')) - self.assertFalse(CatalogB.has('undefined')) - self.assertTrue(CatalogB.has_provider('p11')) self.assertTrue(CatalogB.has_provider('p12')) self.assertTrue(CatalogB.has_provider('p21')) @@ -293,10 +282,6 @@ class DeclarativeCatalogTests(unittest.TestCase): self.assertIn('p21', repr(CatalogB)) self.assertIn('p22', repr(CatalogB)) - def test_abstract_catalog_backward_compatibility(self): - """Test that di.AbstractCatalog is available.""" - self.assertIs(catalogs.DeclarativeCatalog, catalogs.AbstractCatalog) - class TestCatalogWithProvidingCallbacks(unittest.TestCase): """Catalog with providing callback tests."""