From a5277b4867fd93ab4963c67a97dd33921616bf56 Mon Sep 17 00:00:00 2001 From: Roman Mogylatov Date: Sun, 30 Oct 2022 21:26:46 -0400 Subject: [PATCH 01/19] Update tests --- .../unit/providers/coroutines/test_abstract_coroutine_py35.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/unit/providers/coroutines/test_abstract_coroutine_py35.py b/tests/unit/providers/coroutines/test_abstract_coroutine_py35.py index 4f098442..85e1c218 100644 --- a/tests/unit/providers/coroutines/test_abstract_coroutine_py35.py +++ b/tests/unit/providers/coroutines/test_abstract_coroutine_py35.py @@ -1,6 +1,7 @@ """AbstractCoroutine provider tests.""" import asyncio +import sys from dependency_injector import providers, errors from pytest import mark, raises @@ -14,6 +15,7 @@ def test_inheritance(): @mark.asyncio @mark.filterwarnings("ignore") +@mark.skipif(sys.version_info >= (3, 11), reason="Cannot be executed on Python 3.11 or newer") async def test_call_overridden_by_coroutine(): @asyncio.coroutine def abstract_example(): @@ -28,6 +30,7 @@ def abstract_example(): @mark.asyncio @mark.filterwarnings("ignore") +@mark.skipif(sys.version_info >= (3, 11), reason="Cannot be executed on Python 3.11 or newer") async def test_call_overridden_by_delegated_coroutine(): @asyncio.coroutine def abstract_example(): From 2f64d2da60c0c4fa5d1ef42ed2e8546c581e3acd Mon Sep 17 00:00:00 2001 From: Roman Mogylatov Date: Sun, 30 Oct 2022 21:30:24 -0400 Subject: [PATCH 02/19] Enable tests on 3.11 --- .github/workflows/tests-and-linters.yml | 6 +++--- setup.py | 1 + tox.ini | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests-and-linters.yml b/.github/workflows/tests-and-linters.yml index 213fb543..600f550a 100644 --- a/.github/workflows/tests-and-linters.yml +++ b/.github/workflows/tests-and-linters.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9, "3.10", pypy2, pypy3] + python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9, "3.10", 3.11, pypy2, pypy3] steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 @@ -31,7 +31,7 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 with: - python-version: "3.10" + python-version: "3.11" - run: pip install tox cython - run: make cythonize - run: tox @@ -48,7 +48,7 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 with: - python-version: "3.10" + python-version: "3.11" - run: pip install tox - run: tox env: diff --git a/setup.py b/setup.py index 82c8e8ff..890268e5 100644 --- a/setup.py +++ b/setup.py @@ -106,6 +106,7 @@ "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Framework :: AsyncIO", diff --git a/tox.ini b/tox.ini index 726e77bc..52720d35 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] envlist= - coveralls, pylint, flake8, pydocstyle, 2.7, 3.5, 3.6, 3.7, 3.8, 3.9, 3.10, pypy2, pypy3 + coveralls, pylint, flake8, pydocstyle, 2.7, 3.5, 3.6, 3.7, 3.8, 3.9, 3.10, 3.11, pypy2, pypy3 [testenv] deps= From 04df609631c39b3e2abfeaabe48b7071cd9d3dbd Mon Sep 17 00:00:00 2001 From: Roman Mogylatov Date: Sun, 30 Oct 2022 21:33:10 -0400 Subject: [PATCH 03/19] Fix coverage config in tox.ini --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 52720d35..e88542de 100644 --- a/tox.ini +++ b/tox.ini @@ -24,7 +24,7 @@ python_files = test_*_py3*.py [testenv:coveralls] passenv = GITHUB_* COVERALLS_* -basepython=python3.10 +basepython=python3.11 usedevelop=True deps= {[testenv]deps} From 33acc051f276019d9b7f65a0909926947637d506 Mon Sep 17 00:00:00 2001 From: Gen Xu Date: Sun, 18 Dec 2022 11:22:53 -0800 Subject: [PATCH 04/19] feat: re cythonize to support python 3.11 (#646) * feat: re cythonize to support python 3.11 * misc: added tox env for python 3.11 * misc: add classifiers for python 3.11 * fix: skip tests for removed functions * misc: CI updates for python 3.11 Co-authored-by: Roman Mogylatov --- .github/workflows/publishing.yml | 26 ++++----- .github/workflows/tests-and-linters.yml | 2 +- requirements-dev.txt | 2 +- src/dependency_injector/_cwiring.c | 54 +++++++++++++++++-- src/dependency_injector/containers.c | 54 +++++++++++++++++-- src/dependency_injector/providers.c | 54 +++++++++++++++++-- .../test_abstract_coroutine_py35.py | 2 + 7 files changed, 170 insertions(+), 24 deletions(-) diff --git a/.github/workflows/publishing.yml b/.github/workflows/publishing.yml index 24d39b46..a710d598 100644 --- a/.github/workflows/publishing.yml +++ b/.github/workflows/publishing.yml @@ -9,20 +9,20 @@ jobs: tests: name: Run tests - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 with: - python-version: "3.10" + python-version: "3.11" - run: pip install tox - run: tox env: - TOXENV: "3.10" + TOXENV: "3.11" linters: name: Run linters - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 strategy: matrix: toxenv: [flake8, pydocstyle, mypy, pylint] @@ -30,7 +30,7 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 with: - python-version: "3.10" + python-version: "3.11" - run: pip install tox - run: tox env: @@ -39,12 +39,12 @@ jobs: build-sdist: name: Build source tarball needs: [tests, linters] - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 with: - python-version: "3.10" + python-version: "3.11" - run: python setup.py sdist - uses: actions/upload-artifact@v2 with: @@ -56,14 +56,14 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-20.04, windows-2019, macOS-10.15] + os: [ubuntu-22.04, windows-2019, macOS-10.15] env: CIBW_SKIP: cp27-win* steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 with: - python-version: "3.10" + python-version: "3.11" - run: pip install cibuildwheel==2.1.3 - run: cibuildwheel --output-dir wheelhouse - uses: actions/upload-artifact@v2 @@ -73,14 +73,14 @@ jobs: build-wheels-linux-aarch64: name: Build wheels (ubuntu-latest-aarch64) needs: [tests, linters] - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v2 - name: Set up QEMU uses: docker/setup-qemu-action@v1 - uses: actions/setup-python@v2 with: - python-version: "3.10" + python-version: "3.11" - run: pip install cibuildwheel==2.1.3 - run: cibuildwheel --archs aarch64 --output-dir wheelhouse - uses: actions/upload-artifact@v2 @@ -90,7 +90,7 @@ jobs: publish: name: Publish on PyPI needs: [build-sdist, build-wheels, build-wheels-linux-aarch64] - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - uses: actions/download-artifact@v2 with: @@ -112,7 +112,7 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 with: - python-version: "3.10" + python-version: "3.11" - run: pip install -r requirements-doc.txt - run: pip install awscli - run: pip install -e . diff --git a/.github/workflows/tests-and-linters.yml b/.github/workflows/tests-and-linters.yml index 600f550a..e0f7ebb4 100644 --- a/.github/workflows/tests-and-linters.yml +++ b/.github/workflows/tests-and-linters.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9, "3.10", 3.11, pypy2, pypy3] + python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9, 3.10, 3.11, pypy2, pypy3] steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 diff --git a/requirements-dev.txt b/requirements-dev.txt index a26319c2..2c101e8c 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,4 +1,4 @@ -cython==0.29.30 +cython==0.29.32 pytest pytest-asyncio tox diff --git a/src/dependency_injector/_cwiring.c b/src/dependency_injector/_cwiring.c index b1e425c2..b6bd2238 100644 --- a/src/dependency_injector/_cwiring.c +++ b/src/dependency_injector/_cwiring.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.29.30 */ +/* Generated by Cython 0.29.32 */ #ifndef PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN @@ -9,8 +9,8 @@ #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) #error Cython requires Python 2.6+ or Python 3.3+. #else -#define CYTHON_ABI "0_29_30" -#define CYTHON_HEX_VERSION 0x001D1EF0 +#define CYTHON_ABI "0_29_32" +#define CYTHON_HEX_VERSION 0x001D20F0 #define CYTHON_FUTURE_DIVISION 0 #include #ifndef offsetof @@ -49,6 +49,7 @@ #define CYTHON_COMPILING_IN_PYPY 1 #define CYTHON_COMPILING_IN_PYSTON 0 #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_NOGIL 0 #undef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 0 #undef CYTHON_USE_PYTYPE_LOOKUP @@ -92,6 +93,7 @@ #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_PYSTON 1 #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_NOGIL 0 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #endif @@ -132,10 +134,56 @@ #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 #endif +#elif defined(PY_NOGIL) + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_PYSTON 0 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_NOGIL 1 + #ifndef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 1 + #endif + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #ifndef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 1 + #endif + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #ifndef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 1 + #endif + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #ifndef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 0 + #endif + #ifndef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 1 + #endif + #ifndef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 1 + #endif + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 1 + #endif + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 #else #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_PYSTON 0 #define CYTHON_COMPILING_IN_CPYTHON 1 + #define CYTHON_COMPILING_IN_NOGIL 0 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #endif diff --git a/src/dependency_injector/containers.c b/src/dependency_injector/containers.c index 82286d59..6a3d9ec8 100644 --- a/src/dependency_injector/containers.c +++ b/src/dependency_injector/containers.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.29.30 */ +/* Generated by Cython 0.29.32 */ #ifndef PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN @@ -9,8 +9,8 @@ #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) #error Cython requires Python 2.6+ or Python 3.3+. #else -#define CYTHON_ABI "0_29_30" -#define CYTHON_HEX_VERSION 0x001D1EF0 +#define CYTHON_ABI "0_29_32" +#define CYTHON_HEX_VERSION 0x001D20F0 #define CYTHON_FUTURE_DIVISION 0 #include #ifndef offsetof @@ -49,6 +49,7 @@ #define CYTHON_COMPILING_IN_PYPY 1 #define CYTHON_COMPILING_IN_PYSTON 0 #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_NOGIL 0 #undef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 0 #undef CYTHON_USE_PYTYPE_LOOKUP @@ -92,6 +93,7 @@ #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_PYSTON 1 #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_NOGIL 0 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #endif @@ -132,10 +134,56 @@ #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 #endif +#elif defined(PY_NOGIL) + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_PYSTON 0 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_NOGIL 1 + #ifndef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 1 + #endif + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #ifndef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 1 + #endif + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #ifndef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 1 + #endif + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #ifndef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 0 + #endif + #ifndef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 1 + #endif + #ifndef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 1 + #endif + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 1 + #endif + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 #else #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_PYSTON 0 #define CYTHON_COMPILING_IN_CPYTHON 1 + #define CYTHON_COMPILING_IN_NOGIL 0 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #endif diff --git a/src/dependency_injector/providers.c b/src/dependency_injector/providers.c index cfb99f95..13536b62 100644 --- a/src/dependency_injector/providers.c +++ b/src/dependency_injector/providers.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.29.30 */ +/* Generated by Cython 0.29.32 */ #ifndef PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN @@ -9,8 +9,8 @@ #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) #error Cython requires Python 2.6+ or Python 3.3+. #else -#define CYTHON_ABI "0_29_30" -#define CYTHON_HEX_VERSION 0x001D1EF0 +#define CYTHON_ABI "0_29_32" +#define CYTHON_HEX_VERSION 0x001D20F0 #define CYTHON_FUTURE_DIVISION 0 #include #ifndef offsetof @@ -49,6 +49,7 @@ #define CYTHON_COMPILING_IN_PYPY 1 #define CYTHON_COMPILING_IN_PYSTON 0 #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_NOGIL 0 #undef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 0 #undef CYTHON_USE_PYTYPE_LOOKUP @@ -92,6 +93,7 @@ #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_PYSTON 1 #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_NOGIL 0 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #endif @@ -132,10 +134,56 @@ #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 #endif +#elif defined(PY_NOGIL) + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_PYSTON 0 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_NOGIL 1 + #ifndef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 1 + #endif + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #ifndef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 1 + #endif + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #ifndef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 1 + #endif + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #ifndef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 0 + #endif + #ifndef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 1 + #endif + #ifndef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 1 + #endif + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 1 + #endif + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 #else #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_PYSTON 0 #define CYTHON_COMPILING_IN_CPYTHON 1 + #define CYTHON_COMPILING_IN_NOGIL 0 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #endif diff --git a/tests/unit/providers/coroutines/test_abstract_coroutine_py35.py b/tests/unit/providers/coroutines/test_abstract_coroutine_py35.py index 85e1c218..5a078664 100644 --- a/tests/unit/providers/coroutines/test_abstract_coroutine_py35.py +++ b/tests/unit/providers/coroutines/test_abstract_coroutine_py35.py @@ -13,6 +13,7 @@ def test_inheritance(): assert isinstance(providers.AbstractCoroutine(example), providers.Coroutine) +@mark.skipif(sys.version_info > (3, 10), reason="asyncio.coroutine removed in 3.11") @mark.asyncio @mark.filterwarnings("ignore") @mark.skipif(sys.version_info >= (3, 11), reason="Cannot be executed on Python 3.11 or newer") @@ -28,6 +29,7 @@ def abstract_example(): assert result == (1, 2, 3, 4) +@mark.skipif(sys.version_info > (3, 10), reason="asyncio.coroutine removed in 3.11") @mark.asyncio @mark.filterwarnings("ignore") @mark.skipif(sys.version_info >= (3, 11), reason="Cannot be executed on Python 3.11 or newer") From 36f25dc8de36c535adf5b5776845ea65dca3b0e1 Mon Sep 17 00:00:00 2001 From: Roman Mogylatov Date: Sun, 18 Dec 2022 14:54:17 -0500 Subject: [PATCH 05/19] Update tests and linters job --- .github/workflows/tests-and-linters.yml | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests-and-linters.yml b/.github/workflows/tests-and-linters.yml index e0f7ebb4..756183c0 100644 --- a/.github/workflows/tests-and-linters.yml +++ b/.github/workflows/tests-and-linters.yml @@ -4,12 +4,28 @@ on: [push, pull_request, workflow_dispatch] jobs: + tests-on-legacy-versions: + name: Run tests on legacy versions + runs-on: ubuntu-20.04 + strategy: + matrix: + python-version: [2.7, 3.5, 3.6, 3.7, pypy2] + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - run: pip install tox + - run: tox + env: + TOXENV: ${{ matrix.python-version }} + test-on-different-versions: name: Run tests runs-on: ubuntu-latest strategy: matrix: - python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9, 3.10, 3.11, pypy2, pypy3] + python-version: [3.8, 3.9, 3.10, 3.11, pypy3] steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 @@ -31,7 +47,7 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 with: - python-version: "3.11" + python-version: 3.11 - run: pip install tox cython - run: make cythonize - run: tox @@ -48,7 +64,7 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 with: - python-version: "3.11" + python-version: 3.11 - run: pip install tox - run: tox env: From c1a9c6b9beef8fe3c57f3b98c11ae134cfe556c3 Mon Sep 17 00:00:00 2001 From: Roman Mogylatov Date: Sun, 18 Dec 2022 14:58:39 -0500 Subject: [PATCH 06/19] Update test skip decorators --- .../providers/coroutines/test_abstract_coroutine_py35.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/unit/providers/coroutines/test_abstract_coroutine_py35.py b/tests/unit/providers/coroutines/test_abstract_coroutine_py35.py index 5a078664..d1a760f8 100644 --- a/tests/unit/providers/coroutines/test_abstract_coroutine_py35.py +++ b/tests/unit/providers/coroutines/test_abstract_coroutine_py35.py @@ -13,10 +13,9 @@ def test_inheritance(): assert isinstance(providers.AbstractCoroutine(example), providers.Coroutine) -@mark.skipif(sys.version_info > (3, 10), reason="asyncio.coroutine removed in 3.11") +@mark.skipif(sys.version_info >= (3, 11), reason="asyncio.coroutine removed in Python 3.11") @mark.asyncio @mark.filterwarnings("ignore") -@mark.skipif(sys.version_info >= (3, 11), reason="Cannot be executed on Python 3.11 or newer") async def test_call_overridden_by_coroutine(): @asyncio.coroutine def abstract_example(): @@ -29,10 +28,9 @@ def abstract_example(): assert result == (1, 2, 3, 4) -@mark.skipif(sys.version_info > (3, 10), reason="asyncio.coroutine removed in 3.11") +@mark.skipif(sys.version_info >= (3, 11), reason="asyncio.coroutine removed in Python 3.11") @mark.asyncio @mark.filterwarnings("ignore") -@mark.skipif(sys.version_info >= (3, 11), reason="Cannot be executed on Python 3.11 or newer") async def test_call_overridden_by_delegated_coroutine(): @asyncio.coroutine def abstract_example(): From 2c6015057e44854450f986a04d5b8c316516ab56 Mon Sep 17 00:00:00 2001 From: Roman Mogylatov Date: Sun, 18 Dec 2022 15:00:17 -0500 Subject: [PATCH 07/19] Fix tox.ini --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index e88542de..17bdaff3 100644 --- a/tox.ini +++ b/tox.ini @@ -23,7 +23,7 @@ commands = pytest -c tests/.configs/pytest.ini python_files = test_*_py3*.py [testenv:coveralls] -passenv = GITHUB_* COVERALLS_* +passenv = GITHUB_*, COVERALLS_* basepython=python3.11 usedevelop=True deps= From cc33a14edc8e836c23873f78ad50920324eb2109 Mon Sep 17 00:00:00 2001 From: Roman Mogylatov Date: Sun, 18 Dec 2022 15:03:16 -0500 Subject: [PATCH 08/19] Update 3.10 to be explicit string literal --- .github/workflows/tests-and-linters.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests-and-linters.yml b/.github/workflows/tests-and-linters.yml index 756183c0..2a59d347 100644 --- a/.github/workflows/tests-and-linters.yml +++ b/.github/workflows/tests-and-linters.yml @@ -25,7 +25,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.8, 3.9, 3.10, 3.11, pypy3] + python-version: [3.8, 3.9, "3.10", 3.11, pypy3] steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 From 1453db4da11276482579904dc7d78c1b371f01bc Mon Sep 17 00:00:00 2001 From: Roman Mogylatov Date: Sun, 18 Dec 2022 15:07:16 -0500 Subject: [PATCH 09/19] Move pypy3 to legacy job --- .github/workflows/tests-and-linters.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests-and-linters.yml b/.github/workflows/tests-and-linters.yml index 2a59d347..f2bfc6fc 100644 --- a/.github/workflows/tests-and-linters.yml +++ b/.github/workflows/tests-and-linters.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - python-version: [2.7, 3.5, 3.6, 3.7, pypy2] + python-version: [2.7, 3.5, 3.6, 3.7, pypy2, pypy3] steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 @@ -25,7 +25,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.8, 3.9, "3.10", 3.11, pypy3] + python-version: [3.8, 3.9, "3.10", 3.11] steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 From 5f99e25a4dea57b5527a4086e43acf97d50e38b6 Mon Sep 17 00:00:00 2001 From: Roman Mogylatov Date: Sun, 18 Dec 2022 15:19:53 -0500 Subject: [PATCH 10/19] Fix error in resourse typing test --- tests/typing/resource.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/typing/resource.py b/tests/typing/resource.py index e70ae67a..113ced5a 100644 --- a/tests/typing/resource.py +++ b/tests/typing/resource.py @@ -45,7 +45,7 @@ def shutdown(self, resource: Optional[List[int]]) -> None: # Test 5: to check the return type with async function async def init5() -> List[int]: - ... + return [] provider5 = providers.Resource(init5) From 5c4a31a518e4e2d3889781a5543bfbbae988ca65 Mon Sep 17 00:00:00 2001 From: Roman Mogylatov Date: Sun, 18 Dec 2022 15:27:27 -0500 Subject: [PATCH 11/19] Update publishing job --- .github/workflows/publishing.yml | 47 ++++++++++++++++---------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/.github/workflows/publishing.yml b/.github/workflows/publishing.yml index a710d598..c9cbf175 100644 --- a/.github/workflows/publishing.yml +++ b/.github/workflows/publishing.yml @@ -1,6 +1,7 @@ name: Publishing on: + workflow_dispatch: push: tags: - '*' @@ -11,14 +12,14 @@ jobs: name: Run tests runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 with: - python-version: "3.11" + python-version: 3.11 - run: pip install tox - run: tox env: - TOXENV: "3.11" + TOXENV: 3.11 linters: name: Run linters @@ -27,10 +28,10 @@ jobs: matrix: toxenv: [flake8, pydocstyle, mypy, pylint] steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 with: - python-version: "3.11" + python-version: 3.11 - run: pip install tox - run: tox env: @@ -41,10 +42,10 @@ jobs: needs: [tests, linters] runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 with: - python-version: "3.11" + python-version: 3.11 - run: python setup.py sdist - uses: actions/upload-artifact@v2 with: @@ -60,10 +61,10 @@ jobs: env: CIBW_SKIP: cp27-win* steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 with: - python-version: "3.11" + python-version: 3.11 - run: pip install cibuildwheel==2.1.3 - run: cibuildwheel --output-dir wheelhouse - uses: actions/upload-artifact@v2 @@ -75,12 +76,12 @@ jobs: needs: [tests, linters] runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up QEMU uses: docker/setup-qemu-action@v1 - - uses: actions/setup-python@v2 + - uses: actions/setup-python@v4 with: - python-version: "3.11" + python-version: 3.11 - run: pip install cibuildwheel==2.1.3 - run: cibuildwheel --archs aarch64 --output-dir wheelhouse - uses: actions/upload-artifact@v2 @@ -98,21 +99,21 @@ jobs: path: dist - uses: pypa/gh-action-pypi-publish@master with: - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} +# user: __token__ +# password: ${{ secrets.PYPI_API_TOKEN }} # For publishing to Test PyPI, uncomment next two lines: - # password: ${{ secrets.TEST_PYPI_API_TOKEN }} - # repository_url: https://test.pypi.org/legacy/ + password: ${{ secrets.TEST_PYPI_API_TOKEN }} + repository_url: https://test.pypi.org/legacy/ publish-docs: name: Publish docs needs: [publish] runs-on: ubuntu-18.04 steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 with: - python-version: "3.11" + python-version: 3.11 - run: pip install -r requirements-doc.txt - run: pip install awscli - run: pip install -e . From d694f40de7b522d77f4d91d6fb37ecf2d1388a1a Mon Sep 17 00:00:00 2001 From: Roman Mogylatov Date: Sun, 18 Dec 2022 15:29:26 -0500 Subject: [PATCH 12/19] Update actions and setup-python versions --- .github/workflows/tests-and-linters.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/tests-and-linters.yml b/.github/workflows/tests-and-linters.yml index f2bfc6fc..c3e222f0 100644 --- a/.github/workflows/tests-and-linters.yml +++ b/.github/workflows/tests-and-linters.yml @@ -11,8 +11,8 @@ jobs: matrix: python-version: [2.7, 3.5, 3.6, 3.7, pypy2, pypy3] steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - run: pip install tox @@ -27,8 +27,8 @@ jobs: matrix: python-version: [3.8, 3.9, "3.10", 3.11] steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - run: pip install tox @@ -44,8 +44,8 @@ jobs: COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 with: python-version: 3.11 - run: pip install tox cython @@ -61,8 +61,8 @@ jobs: matrix: toxenv: [flake8, pydocstyle, mypy, pylint] steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 with: python-version: 3.11 - run: pip install tox From 0b7c72dc7033435bb90b9ca6b29670d8585c8dd1 Mon Sep 17 00:00:00 2001 From: Roman Mogylatov Date: Sun, 18 Dec 2022 15:31:37 -0500 Subject: [PATCH 13/19] Update changelog --- docs/main/changelog.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/main/changelog.rst b/docs/main/changelog.rst index c6ceb629..1547366a 100644 --- a/docs/main/changelog.rst +++ b/docs/main/changelog.rst @@ -7,6 +7,13 @@ that were made in every particular version. From version 0.7.6 *Dependency Injector* framework strictly follows `Semantic versioning`_ +Development version +------------------- +- Add support of Python 3.11. +- Update CI/CD to use Ubuntu 22.04. +- Update CI/CD to ``actions/checkout@v3`` and ``actions/setup-python@v4``. +- Regenerate C sources using Cython 0.29.32. + 4.40.0 ------ - Add ``Configuration.from_json()`` method to load configuration from a json file. From 672cd48e7b6692c6c4970906ee0cb25eb6bad901 Mon Sep 17 00:00:00 2001 From: Roman Mogylatov Date: Sun, 18 Dec 2022 15:39:52 -0500 Subject: [PATCH 14/19] Update pypy --- .github/workflows/tests-and-linters.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests-and-linters.yml b/.github/workflows/tests-and-linters.yml index c3e222f0..a983d1e6 100644 --- a/.github/workflows/tests-and-linters.yml +++ b/.github/workflows/tests-and-linters.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - python-version: [2.7, 3.5, 3.6, 3.7, pypy2, pypy3] + python-version: [2.7, 3.5, 3.6, 3.7, pypy2.7, pypy3.9] steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 From fad248b4c51c479c114c0f9dba34a47e8049fbab Mon Sep 17 00:00:00 2001 From: Roman Mogylatov Date: Sun, 18 Dec 2022 15:45:16 -0500 Subject: [PATCH 15/19] Update tox.ini with new pypy versions --- tox.ini | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tox.ini b/tox.ini index 17bdaff3..f436345c 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] envlist= - coveralls, pylint, flake8, pydocstyle, 2.7, 3.5, 3.6, 3.7, 3.8, 3.9, 3.10, 3.11, pypy2, pypy3 + coveralls, pylint, flake8, pydocstyle, 2.7, 3.5, 3.6, 3.7, 3.8, 3.9, 3.10, 3.11, pypy2.7, pypy3.9 [testenv] deps= @@ -55,7 +55,7 @@ extras= flask commands = pytest -c tests/.configs/pytest-py35.ini -[testenv:pypy2] +[testenv:pypy2.7] deps= pytest extras= @@ -63,7 +63,7 @@ extras= flask commands = pytest -c tests/.configs/pytest-py27.ini -[testenv:pypy3] +[testenv:pypy3.9] deps= pytest pytest-asyncio From 5e0fd25b5d974cdd09e235c09c099fead83b2707 Mon Sep 17 00:00:00 2001 From: Roman Mogylatov Date: Sun, 18 Dec 2022 15:58:57 -0500 Subject: [PATCH 16/19] Update publishing job --- .github/workflows/publishing.yml | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/.github/workflows/publishing.yml b/.github/workflows/publishing.yml index c9cbf175..3bf55980 100644 --- a/.github/workflows/publishing.yml +++ b/.github/workflows/publishing.yml @@ -57,34 +57,31 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-22.04, windows-2019, macOS-10.15] + os: [ubuntu-22.04, windows-2019, macos-11] env: CIBW_SKIP: cp27-win* steps: - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: 3.11 - - run: pip install cibuildwheel==2.1.3 - - run: cibuildwheel --output-dir wheelhouse - - uses: actions/upload-artifact@v2 + - name: Build wheels + uses: pypa/cibuildwheel@v2.11.3 + - uses: actions/upload-artifact@v3 with: path: ./wheelhouse/*.whl build-wheels-linux-aarch64: - name: Build wheels (ubuntu-latest-aarch64) + name: Build wheels (ubuntu-22.04-aarch64) needs: [tests, linters] runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - uses: actions/setup-python@v4 - with: - python-version: 3.11 - - run: pip install cibuildwheel==2.1.3 - - run: cibuildwheel --archs aarch64 --output-dir wheelhouse - - uses: actions/upload-artifact@v2 + if: runner.os == 'Linux' + uses: docker/setup-qemu-action@v2 + - name: Build wheels + uses: pypa/cibuildwheel@v2.11.3 + env: + CIBW_ARCHS_LINUX: aarch64 + - uses: actions/upload-artifact@v3 with: path: ./wheelhouse/*.whl From 2d1562d536011d9bb2388b80e4627e8258f103c9 Mon Sep 17 00:00:00 2001 From: Roman Mogylatov Date: Sun, 18 Dec 2022 16:35:34 -0500 Subject: [PATCH 17/19] Update actions/upload-artifact@v3 --- .github/workflows/publishing.yml | 2 +- docs/main/changelog.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publishing.yml b/.github/workflows/publishing.yml index 3bf55980..46f89092 100644 --- a/.github/workflows/publishing.yml +++ b/.github/workflows/publishing.yml @@ -47,7 +47,7 @@ jobs: with: python-version: 3.11 - run: python setup.py sdist - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: path: ./dist/* diff --git a/docs/main/changelog.rst b/docs/main/changelog.rst index 1547366a..74dd0107 100644 --- a/docs/main/changelog.rst +++ b/docs/main/changelog.rst @@ -11,7 +11,7 @@ Development version ------------------- - Add support of Python 3.11. - Update CI/CD to use Ubuntu 22.04. -- Update CI/CD to ``actions/checkout@v3`` and ``actions/setup-python@v4``. +- Update CI/CD to ``actions/checkout@v3``, ``actions/setup-python@v4``, ``actions/upload-artifact@v3``, and ``pypa/cibuildwheel@v2.11.3``. - Regenerate C sources using Cython 0.29.32. 4.40.0 From 2ca2420486634a9a5423ddd8a4058126e611be74 Mon Sep 17 00:00:00 2001 From: Roman Mogylatov Date: Sun, 18 Dec 2022 16:38:05 -0500 Subject: [PATCH 18/19] Update ubuntu to 22.04 on docs publishing job --- .github/workflows/publishing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publishing.yml b/.github/workflows/publishing.yml index 46f89092..1c1aceb0 100644 --- a/.github/workflows/publishing.yml +++ b/.github/workflows/publishing.yml @@ -105,7 +105,7 @@ jobs: publish-docs: name: Publish docs needs: [publish] - runs-on: ubuntu-18.04 + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 From d3b316d3d8bcdf33cb4371e4a03769551af09aea Mon Sep 17 00:00:00 2001 From: Roman Mogylatov Date: Sun, 18 Dec 2022 21:00:07 -0500 Subject: [PATCH 19/19] Update actions/download-artifact@v3 and pypa/gh-action-pypi-publish@release/v1 --- .github/workflows/publishing.yml | 14 +++++++------- docs/main/changelog.rst | 3 ++- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/publishing.yml b/.github/workflows/publishing.yml index 1c1aceb0..5dc5c257 100644 --- a/.github/workflows/publishing.yml +++ b/.github/workflows/publishing.yml @@ -90,17 +90,17 @@ jobs: needs: [build-sdist, build-wheels, build-wheels-linux-aarch64] runs-on: ubuntu-22.04 steps: - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: artifact path: dist - - uses: pypa/gh-action-pypi-publish@master + - uses: pypa/gh-action-pypi-publish@release/v1 with: -# user: __token__ -# password: ${{ secrets.PYPI_API_TOKEN }} - # For publishing to Test PyPI, uncomment next two lines: - password: ${{ secrets.TEST_PYPI_API_TOKEN }} - repository_url: https://test.pypi.org/legacy/ + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} +# For publishing to Test PyPI, uncomment next two lines: +# password: ${{ secrets.TEST_PYPI_API_TOKEN }} +# repository_url: https://test.pypi.org/legacy/ publish-docs: name: Publish docs diff --git a/docs/main/changelog.rst b/docs/main/changelog.rst index 74dd0107..dca57ef4 100644 --- a/docs/main/changelog.rst +++ b/docs/main/changelog.rst @@ -11,7 +11,8 @@ Development version ------------------- - Add support of Python 3.11. - Update CI/CD to use Ubuntu 22.04. -- Update CI/CD to ``actions/checkout@v3``, ``actions/setup-python@v4``, ``actions/upload-artifact@v3``, and ``pypa/cibuildwheel@v2.11.3``. +- Update CI/CD to ``actions/checkout@v3``, ``actions/setup-python@v4``, ``actions/upload-artifact@v3``, ``pypa/cibuildwheel@v2.11.3``, + and ``actions/download-artifact@v3``. - Regenerate C sources using Cython 0.29.32. 4.40.0