Skip to content

Commit

Permalink
Add Python 3.12 Support (#752)
Browse files Browse the repository at this point in the history
* Ignore .vscode

* Python 3.12 Support

* Change base python to 3.12 and pin pydantic to V1

* all tests passed

* ci: change default python to 3.12

* remove legacy python versions

* annotate pydantic models for tests
  • Loading branch information
anton-petrov authored Nov 15, 2023
1 parent cc2304e commit 437300e
Show file tree
Hide file tree
Showing 11 changed files with 1,012 additions and 996 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/tests-and-linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, "3.10", 3.11]
python-version: [3.8, 3.9, "3.10", 3.11, 3.12]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
Expand All @@ -47,8 +47,8 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.11
- run: pip install tox cython
python-version: 3.12
- run: pip install tox cython==0.29.36
- run: make cythonize
- run: tox
env:
Expand All @@ -64,7 +64,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.11
python-version: 3.12
- run: pip install tox
- run: tox
env:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,5 @@ src/dependency_injector/providers/*.so

# Workspace for samples
.workspace/

.vscode/
4 changes: 2 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cython==0.29.32
cython==0.29.36
pytest
pytest-asyncio
tox
Expand All @@ -11,7 +11,7 @@ mypy
pyyaml
httpx
fastapi
pydantic
pydantic==1.10.13
numpy
scipy
boto3
Expand Down
4 changes: 2 additions & 2 deletions requirements-doc.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# TODO: unpin 3.5.0 when this bug is fixed: https://github.com/sphinx-doc/sphinx/issues/8885
sphinx<3.5.0
sphinx

# TODO: unpin jinja2 after sphinx update to 4+
jinja2<3.1
jinja2

-e git+https://github.com/rmk135/sphinxcontrib-disqus.git#egg=sphinxcontrib-disqus

Expand Down
5 changes: 3 additions & 2 deletions requirements-ext.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
flask
aiohttp
flask==2.1.3
werkzeug==2.2.2
aiohttp==3.9.0b1
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ def _open(filename):
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Framework :: AsyncIO",
Expand Down
427 changes: 213 additions & 214 deletions src/dependency_injector/_cwiring.c

Large diffs are not rendered by default.

483 changes: 241 additions & 242 deletions src/dependency_injector/containers.c

Large diffs are not rendered by default.

1,009 changes: 522 additions & 487 deletions src/dependency_injector/providers.c

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,30 @@


class Section11(pydantic.BaseModel):
value1 = 1
value1: int = 1


class Section12(pydantic.BaseModel):
value2 = 2
value2: int = 2


class Settings1(pydantic.BaseSettings):
section1 = Section11()
section2 = Section12()
section1: Section11 = Section11()
section2: Section12 = Section12()


class Section21(pydantic.BaseModel):
value1 = 11
value11 = 11
value1: int = 11
value11: int = 11


class Section3(pydantic.BaseModel):
value3 = 3
value3: int = 3


class Settings2(pydantic.BaseSettings):
section1 = Section21()
section3 = Section3()
section1: Section21 = Section21()
section3: Section3= Section3()


@fixture
Expand Down
47 changes: 13 additions & 34 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -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.7, pypy3.9
coveralls, pylint, flake8, pydocstyle, 3.8, 3.9, 3.10, 3.11, 3.12, pypy3.9, pypy3.10

[testenv]
deps=
Expand All @@ -10,25 +10,26 @@ deps=
typing_extensions
httpx
fastapi
flask<2.2
aiohttp<=3.9.0b1
numpy
scipy
boto3
mypy_boto3_s3
pydantic<2
werkzeug<=2.2.2
extras=
yaml
pydantic
flask
aiohttp
commands = pytest -c tests/.configs/pytest.ini
python_files = test_*_py3*.py

[testenv:coveralls]
passenv = GITHUB_*, COVERALLS_*
basepython=python3.11
basepython=python3.12
usedevelop=True
deps=
{[testenv]deps}
cython
cython<0.30
coverage
coveralls
commands=
Expand All @@ -37,49 +38,27 @@ commands=
coverage report --rcfile=./.coveragerc
coveralls

[testenv:2.7]
deps=
pytest
extras=
yaml
flask
commands = pytest -c tests/.configs/pytest-py27.ini

[testenv:3.5]
deps=
pytest
pytest-asyncio
contextvars
extras=
yaml
flask
commands = pytest -c tests/.configs/pytest-py35.ini

[testenv:pypy2.7]
deps=
pytest
extras=
yaml
flask
commands = pytest -c tests/.configs/pytest-py27.ini

[testenv:pypy3.9]
deps=
pytest
pytest-asyncio
httpx
flask<2.2
pydantic<2
werkzeug<=2.2.2
fastapi
boto3
mypy_boto3_s3
extras=
yaml
flask
commands = pytest -c tests/.configs/pytest-py27.ini
commands = pytest -c tests/.configs/pytest-py35.ini


[testenv:pylint]
deps=
pylint
flask<2.2
werkzeug<=2.2.2
commands=
- pylint -f colorized --rcfile=./.pylintrc src/dependency_injector

Expand Down

0 comments on commit 437300e

Please sign in to comment.