Merge branch 'release/4.43.0' into master
This commit is contained in:
commit
abf2a2577c
|
@ -15,11 +15,11 @@ jobs:
|
|||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: 3.12
|
||||
python-version: 3.13
|
||||
- run: pip install tox
|
||||
- run: tox
|
||||
env:
|
||||
TOXENV: 3.12
|
||||
TOXENV: 3.13
|
||||
|
||||
linters:
|
||||
name: Run linters
|
||||
|
@ -31,7 +31,7 @@ jobs:
|
|||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: 3.12
|
||||
python-version: 3.13
|
||||
- run: pip install tox
|
||||
- run: tox
|
||||
env:
|
||||
|
@ -45,7 +45,7 @@ jobs:
|
|||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: 3.12
|
||||
python-version: 3.13
|
||||
- run: |
|
||||
python -m pip install --upgrade pip setuptools
|
||||
python setup.py sdist
|
||||
|
@ -61,7 +61,7 @@ jobs:
|
|||
matrix:
|
||||
os: [ubuntu-22.04, windows-2019, macos-14]
|
||||
env:
|
||||
CIBW_SKIP: cp27-* cp313-*
|
||||
CIBW_SKIP: cp27-*
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Build wheels
|
||||
|
@ -75,7 +75,7 @@ jobs:
|
|||
needs: [tests, linters]
|
||||
runs-on: ubuntu-22.04
|
||||
env:
|
||||
CIBW_SKIP: cp27-* cp313-*
|
||||
CIBW_SKIP: cp27-*
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up QEMU
|
||||
|
@ -114,7 +114,7 @@ jobs:
|
|||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: 3.12
|
||||
python-version: 3.13
|
||||
- run: pip install awscli
|
||||
- run: pip install -r requirements-doc.txt
|
||||
- run: pip install -e .
|
||||
|
|
|
@ -25,7 +25,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [3.8, 3.9, "3.10", 3.11, 3.12]
|
||||
python-version: [3.8, 3.9, "3.10", 3.11, 3.12, 3.13]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-python@v4
|
||||
|
@ -40,8 +40,8 @@ jobs:
|
|||
name: Run tests with coverage
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
# Cython's version <3 issue with tracing: "error: no member named 'use_tracing' in 'struct _PyCFrame'"
|
||||
# DEPENDENCY_INJECTOR_DEBUG_MODE: 1
|
||||
DEPENDENCY_INJECTOR_DEBUG_MODE: 1
|
||||
PIP_VERBOSE: 1
|
||||
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
steps:
|
||||
|
@ -49,9 +49,9 @@ jobs:
|
|||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: 3.12
|
||||
- run: pip install tox cython==0.29.37
|
||||
- run: pip install tox 'cython>=3,<4'
|
||||
- run: make cythonize
|
||||
- run: tox
|
||||
- run: tox -vv
|
||||
env:
|
||||
TOXENV: coveralls
|
||||
|
||||
|
@ -65,7 +65,7 @@ jobs:
|
|||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: 3.12
|
||||
python-version: 3.13
|
||||
- run: pip install tox
|
||||
- run: tox
|
||||
env:
|
||||
|
|
|
@ -21,3 +21,4 @@ Dependency Injector Contributors
|
|||
+ Thiago Hiromi (thiromi)
|
||||
+ Felipe Rubio (krouw)
|
||||
+ Anton Petrov (anton-petrov)
|
||||
+ ZipFile (ZipFile)
|
||||
|
|
2
Makefile
2
Makefile
|
@ -2,7 +2,7 @@ VERSION := $(shell python setup.py --version)
|
|||
|
||||
CYTHON_SRC := $(shell find src/dependency_injector -name '*.pyx')
|
||||
|
||||
CYTHON_DIRECTIVES = -Xlanguage_level=2
|
||||
CYTHON_DIRECTIVES = -Xlanguage_level=3
|
||||
|
||||
ifdef DEPENDENCY_INJECTOR_DEBUG_MODE
|
||||
CYTHON_DIRECTIVES += -Xprofile=True
|
||||
|
|
|
@ -7,6 +7,12 @@ that were made in every particular version.
|
|||
From version 0.7.6 *Dependency Injector* framework strictly
|
||||
follows `Semantic versioning`_
|
||||
|
||||
4.43.0
|
||||
--------
|
||||
- Add support for Python 3.13.
|
||||
- Migrate to Cython 3 (version 3.0.11). Many thanks to `ZipFile <https://github.com/ZipFile>`_ for
|
||||
this contribution `#813 <https://github.com/ets-labs/python-dependency-injector/pull/813>`_.
|
||||
|
||||
4.42.0
|
||||
--------
|
||||
- Promote release ``4.42.0b1`` to a production release.
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
cython==0.29.37
|
||||
cython==3.0.11
|
||||
setuptools
|
||||
pytest
|
||||
pytest-asyncio
|
||||
tox
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
flask==2.1.3
|
||||
werkzeug==2.2.2
|
||||
aiohttp==3.9.0b1
|
||||
aiohttp
|
||||
|
|
1
setup.py
1
setup.py
|
@ -111,6 +111,7 @@ setup(name="dependency-injector",
|
|||
"Programming Language :: Python :: 3.10",
|
||||
"Programming Language :: Python :: 3.11",
|
||||
"Programming Language :: Python :: 3.12",
|
||||
"Programming Language :: Python :: 3.13",
|
||||
"Programming Language :: Python :: Implementation :: CPython",
|
||||
"Programming Language :: Python :: Implementation :: PyPy",
|
||||
"Framework :: AsyncIO",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
"""Top-level package."""
|
||||
|
||||
__version__ = "4.42.0"
|
||||
__version__ = "4.43.0"
|
||||
"""Version number.
|
||||
|
||||
:type: str
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -20,10 +20,10 @@ cdef tuple __COROUTINE_TYPES
|
|||
|
||||
# Base providers
|
||||
cdef class Provider(object):
|
||||
cdef tuple __overridden
|
||||
cdef Provider __last_overriding
|
||||
cdef tuple __overrides
|
||||
cdef int __async_mode
|
||||
cdef tuple _overridden
|
||||
cdef Provider _last_overriding
|
||||
cdef tuple _overrides
|
||||
cdef int _async_mode
|
||||
|
||||
cpdef bint is_async_mode_enabled(self)
|
||||
cpdef bint is_async_mode_disabled(self)
|
||||
|
@ -34,32 +34,32 @@ cdef class Provider(object):
|
|||
|
||||
|
||||
cdef class Object(Provider):
|
||||
cdef object __provides
|
||||
cdef object _provides
|
||||
|
||||
cpdef object _provide(self, tuple args, dict kwargs)
|
||||
|
||||
|
||||
cdef class Self(Provider):
|
||||
cdef object __container
|
||||
cdef tuple __alt_names
|
||||
cdef object _container
|
||||
cdef tuple _alt_names
|
||||
|
||||
|
||||
cdef class Delegate(Provider):
|
||||
cdef object __provides
|
||||
cdef object _provides
|
||||
|
||||
cpdef object _provide(self, tuple args, dict kwargs)
|
||||
|
||||
|
||||
cdef class Aggregate(Provider):
|
||||
cdef dict __providers
|
||||
cdef dict _providers
|
||||
|
||||
cdef Provider __get_provider(self, object provider_name)
|
||||
|
||||
|
||||
cdef class Dependency(Provider):
|
||||
cdef object __instance_of
|
||||
cdef object __default
|
||||
cdef object __parent
|
||||
cdef object _instance_of
|
||||
cdef object _default
|
||||
cdef object _parent
|
||||
|
||||
|
||||
cdef class ExternalDependency(Dependency):
|
||||
|
@ -67,21 +67,21 @@ cdef class ExternalDependency(Dependency):
|
|||
|
||||
|
||||
cdef class DependenciesContainer(Object):
|
||||
cdef dict __providers
|
||||
cdef object __parent
|
||||
cdef dict _providers
|
||||
cdef object _parent
|
||||
|
||||
cpdef object _override_providers(self, object container)
|
||||
|
||||
|
||||
# Callable providers
|
||||
cdef class Callable(Provider):
|
||||
cdef object __provides
|
||||
cdef object _provides
|
||||
|
||||
cdef tuple __args
|
||||
cdef int __args_len
|
||||
cdef tuple _args
|
||||
cdef int _args_len
|
||||
|
||||
cdef tuple __kwargs
|
||||
cdef int __kwargs_len
|
||||
cdef tuple _kwargs
|
||||
cdef int _kwargs_len
|
||||
|
||||
cpdef object _provide(self, tuple args, dict kwargs)
|
||||
|
||||
|
@ -117,11 +117,11 @@ cdef class CoroutineDelegate(Delegate):
|
|||
|
||||
# Configuration providers
|
||||
cdef class ConfigurationOption(Provider):
|
||||
cdef tuple __name
|
||||
cdef Configuration __root
|
||||
cdef dict __children
|
||||
cdef bint __required
|
||||
cdef object __cache
|
||||
cdef tuple _name
|
||||
cdef Configuration _root
|
||||
cdef dict _children
|
||||
cdef bint _required
|
||||
cdef object _cache
|
||||
|
||||
|
||||
cdef class TypedConfigurationOption(Callable):
|
||||
|
@ -129,22 +129,22 @@ cdef class TypedConfigurationOption(Callable):
|
|||
|
||||
|
||||
cdef class Configuration(Object):
|
||||
cdef str __name
|
||||
cdef str _name
|
||||
cdef bint __strict
|
||||
cdef dict __children
|
||||
cdef list __ini_files
|
||||
cdef list __yaml_files
|
||||
cdef list __json_files
|
||||
cdef list __pydantic_settings
|
||||
cdef dict _children
|
||||
cdef list _ini_files
|
||||
cdef list _yaml_files
|
||||
cdef list _json_files
|
||||
cdef list _pydantic_settings
|
||||
cdef object __weakref__
|
||||
|
||||
|
||||
# Factory providers
|
||||
cdef class Factory(Provider):
|
||||
cdef Callable __instantiator
|
||||
cdef Callable _instantiator
|
||||
|
||||
cdef tuple __attributes
|
||||
cdef int __attributes_len
|
||||
cdef tuple _attributes
|
||||
cdef int _attributes_len
|
||||
|
||||
cpdef object _provide(self, tuple args, dict kwargs)
|
||||
|
||||
|
@ -167,8 +167,8 @@ cdef class FactoryAggregate(Aggregate):
|
|||
|
||||
# Singleton providers
|
||||
cdef class BaseSingleton(Provider):
|
||||
cdef Factory __instantiator
|
||||
cdef object __storage
|
||||
cdef Factory _instantiator
|
||||
cdef object _storage
|
||||
|
||||
|
||||
cdef class Singleton(BaseSingleton):
|
||||
|
@ -181,7 +181,7 @@ cdef class DelegatedSingleton(Singleton):
|
|||
|
||||
|
||||
cdef class ThreadSafeSingleton(BaseSingleton):
|
||||
cdef object __storage_lock
|
||||
cdef object _storage_lock
|
||||
|
||||
cpdef object _provide(self, tuple args, dict kwargs)
|
||||
|
||||
|
@ -215,87 +215,87 @@ cdef class SingletonDelegate(Delegate):
|
|||
# Miscellaneous providers
|
||||
|
||||
cdef class List(Provider):
|
||||
cdef tuple __args
|
||||
cdef int __args_len
|
||||
cdef tuple _args
|
||||
cdef int _args_len
|
||||
|
||||
cpdef object _provide(self, tuple args, dict kwargs)
|
||||
|
||||
|
||||
cdef class Dict(Provider):
|
||||
cdef tuple __kwargs
|
||||
cdef int __kwargs_len
|
||||
cdef tuple _kwargs
|
||||
cdef int _kwargs_len
|
||||
|
||||
cpdef object _provide(self, tuple args, dict kwargs)
|
||||
|
||||
|
||||
cdef class Resource(Provider):
|
||||
cdef object __provides
|
||||
cdef bint __initialized
|
||||
cdef object __shutdowner
|
||||
cdef object __resource
|
||||
cdef object _provides
|
||||
cdef bint _initialized
|
||||
cdef object _shutdowner
|
||||
cdef object _resource
|
||||
|
||||
cdef tuple __args
|
||||
cdef int __args_len
|
||||
cdef tuple _args
|
||||
cdef int _args_len
|
||||
|
||||
cdef tuple __kwargs
|
||||
cdef int __kwargs_len
|
||||
cdef tuple _kwargs
|
||||
cdef int _kwargs_len
|
||||
|
||||
cpdef object _provide(self, tuple args, dict kwargs)
|
||||
|
||||
|
||||
cdef class Container(Provider):
|
||||
cdef object __container_cls
|
||||
cdef dict __overriding_providers
|
||||
cdef object __container
|
||||
cdef object __parent
|
||||
cdef object _container_cls
|
||||
cdef dict _overriding_providers
|
||||
cdef object _container
|
||||
cdef object _parent
|
||||
|
||||
cpdef object _provide(self, tuple args, dict kwargs)
|
||||
|
||||
|
||||
cdef class Selector(Provider):
|
||||
cdef object __selector
|
||||
cdef dict __providers
|
||||
cdef object _selector
|
||||
cdef dict _providers
|
||||
|
||||
cpdef object _provide(self, tuple args, dict kwargs)
|
||||
|
||||
# Provided instance
|
||||
|
||||
cdef class ProvidedInstance(Provider):
|
||||
cdef object __provides
|
||||
cdef object _provides
|
||||
|
||||
cpdef object _provide(self, tuple args, dict kwargs)
|
||||
|
||||
|
||||
cdef class AttributeGetter(Provider):
|
||||
cdef object __provides
|
||||
cdef object __name
|
||||
cdef object _provides
|
||||
cdef object _name
|
||||
|
||||
cpdef object _provide(self, tuple args, dict kwargs)
|
||||
|
||||
|
||||
cdef class ItemGetter(Provider):
|
||||
cdef object __provides
|
||||
cdef object __name
|
||||
cdef object _provides
|
||||
cdef object _name
|
||||
|
||||
cpdef object _provide(self, tuple args, dict kwargs)
|
||||
|
||||
|
||||
cdef class MethodCaller(Provider):
|
||||
cdef object __provides
|
||||
cdef tuple __args
|
||||
cdef int __args_len
|
||||
cdef tuple __kwargs
|
||||
cdef int __kwargs_len
|
||||
cdef object _provides
|
||||
cdef tuple _args
|
||||
cdef int _args_len
|
||||
cdef tuple _kwargs
|
||||
cdef int _kwargs_len
|
||||
|
||||
cpdef object _provide(self, tuple args, dict kwargs)
|
||||
|
||||
|
||||
# Injections
|
||||
cdef class Injection(object):
|
||||
cdef object __value
|
||||
cdef int __is_provider
|
||||
cdef int __is_delegated
|
||||
cdef int __call
|
||||
cdef object _value
|
||||
cdef int _is_provider
|
||||
cdef int _is_delegated
|
||||
cdef int _call
|
||||
|
||||
|
||||
cdef class PositionalInjection(Injection):
|
||||
|
@ -303,7 +303,7 @@ cdef class PositionalInjection(Injection):
|
|||
|
||||
|
||||
cdef class NamedInjection(Injection):
|
||||
cdef object __name
|
||||
cdef object _name
|
||||
|
||||
|
||||
cpdef tuple parse_positional_injections(tuple args)
|
||||
|
@ -314,12 +314,12 @@ cpdef tuple parse_named_injections(dict kwargs)
|
|||
|
||||
# Utils
|
||||
cdef class OverridingContext(object):
|
||||
cdef Provider __overridden
|
||||
cdef Provider __overriding
|
||||
cdef Provider _overridden
|
||||
cdef Provider _overriding
|
||||
|
||||
|
||||
cdef class BaseSingletonResetContext(object):
|
||||
cdef object __singleton
|
||||
cdef object _singleton
|
||||
|
||||
|
||||
cdef class SingletonResetContext(BaseSingletonResetContext):
|
||||
|
@ -356,19 +356,19 @@ cpdef object deepcopy(object instance, dict memo=*)
|
|||
|
||||
# Inline helper functions
|
||||
cdef inline object __get_name(NamedInjection self):
|
||||
return self.__name
|
||||
return self._name
|
||||
|
||||
|
||||
cdef inline object __get_value(Injection self):
|
||||
if self.__call == 0:
|
||||
return self.__value
|
||||
return self.__value()
|
||||
if self._call == 0:
|
||||
return self._value
|
||||
return self._value()
|
||||
|
||||
|
||||
cdef inline object __get_value_kwargs(Injection self, dict kwargs):
|
||||
if self.__call == 0:
|
||||
return self.__value
|
||||
return self.__value(**kwargs)
|
||||
if self._call == 0:
|
||||
return self._value
|
||||
return self._value(**kwargs)
|
||||
|
||||
|
||||
cdef inline tuple __separate_prefixed_kwargs(dict kwargs):
|
||||
|
@ -633,14 +633,14 @@ cdef inline object __async_result_callback(object future_result, object future):
|
|||
|
||||
cdef inline object __callable_call(Callable self, tuple args, dict kwargs, ):
|
||||
return __call(
|
||||
self.__provides,
|
||||
self._provides,
|
||||
args,
|
||||
self.__args,
|
||||
self.__args_len,
|
||||
self._args,
|
||||
self._args_len,
|
||||
kwargs,
|
||||
self.__kwargs,
|
||||
self.__kwargs_len,
|
||||
self.__async_mode,
|
||||
self._kwargs,
|
||||
self._kwargs_len,
|
||||
self._async_mode,
|
||||
)
|
||||
|
||||
|
||||
|
@ -648,18 +648,18 @@ cdef inline object __factory_call(Factory self, tuple args, dict kwargs):
|
|||
cdef object instance
|
||||
|
||||
instance = __call(
|
||||
self.__instantiator.__provides,
|
||||
self._instantiator._provides,
|
||||
args,
|
||||
self.__instantiator.__args,
|
||||
self.__instantiator.__args_len,
|
||||
self._instantiator._args,
|
||||
self._instantiator._args_len,
|
||||
kwargs,
|
||||
self.__instantiator.__kwargs,
|
||||
self.__instantiator.__kwargs_len,
|
||||
self.__async_mode,
|
||||
self._instantiator._kwargs,
|
||||
self._instantiator._kwargs_len,
|
||||
self._async_mode,
|
||||
)
|
||||
|
||||
if self.__attributes_len > 0:
|
||||
attributes = __provide_attributes(self.__attributes, self.__attributes_len)
|
||||
if self._attributes_len > 0:
|
||||
attributes = __provide_attributes(self._attributes, self._attributes_len)
|
||||
|
||||
is_future_instance = __is_future_or_coroutine(instance)
|
||||
is_future_attributes = __is_future_or_coroutine(attributes)
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -4,6 +4,7 @@ from aiohttp import web, test_utils
|
|||
from dependency_injector import containers, providers
|
||||
from dependency_injector.ext import aiohttp
|
||||
from pytest import fixture, mark
|
||||
from pytest_asyncio import fixture as aio_fixture
|
||||
|
||||
|
||||
async def index_view(_):
|
||||
|
@ -63,7 +64,7 @@ def app():
|
|||
return app
|
||||
|
||||
|
||||
@fixture
|
||||
@aio_fixture
|
||||
async def client(app):
|
||||
async with test_utils.TestClient(test_utils.TestServer(app)) as client:
|
||||
yield client
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
from httpx import AsyncClient
|
||||
from pytest import fixture, mark
|
||||
from pytest_asyncio import fixture as aio_fixture
|
||||
|
||||
# Runtime import to avoid syntax errors in samples on Python < 3.5 and reach top-dir
|
||||
import os
|
||||
|
@ -16,7 +17,7 @@ sys.path.append(_SAMPLES_DIR)
|
|||
from wiringfastapi import web
|
||||
|
||||
|
||||
@fixture
|
||||
@aio_fixture
|
||||
async def async_client():
|
||||
client = AsyncClient(app=web.app, base_url="http://test")
|
||||
yield client
|
||||
|
|
13
tox.ini
13
tox.ini
|
@ -1,6 +1,7 @@
|
|||
[tox]
|
||||
parallel_show_output = true
|
||||
envlist=
|
||||
coveralls, pylint, flake8, pydocstyle, 3.7, 3.8, 3.9, 3.10, 3.11, 3.12, pypy3.9, pypy3.10
|
||||
coveralls, pylint, flake8, pydocstyle, 3.7, 3.8, 3.9, 3.10, 3.11, 3.12, 3.13, pypy3.9, pypy3.10
|
||||
|
||||
[testenv]
|
||||
deps=
|
||||
|
@ -24,13 +25,13 @@ commands = pytest -c tests/.configs/pytest.ini
|
|||
python_files = test_*_py3*.py
|
||||
|
||||
[testenv:coveralls]
|
||||
passenv = GITHUB_*, COVERALLS_*
|
||||
basepython=python3.12
|
||||
passenv = GITHUB_*, COVERALLS_*, DEPENDENCY_INJECTOR_*
|
||||
basepython=python3.12 # TODO: Upgrade to version 3.13 is blocked by coveralls 4.0.1 not supporting Python 3.13
|
||||
deps=
|
||||
{[testenv]deps}
|
||||
cython<3.0
|
||||
coverage
|
||||
coveralls
|
||||
cython>=3,<4
|
||||
coverage>=7
|
||||
coveralls>=4
|
||||
commands=
|
||||
coverage erase
|
||||
coverage run --rcfile=./.coveragerc -m pytest -c tests/.configs/pytest.ini
|
||||
|
|
Loading…
Reference in New Issue