From 02ccdbe9f654e7287fb3318f87e3ec513d599460 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Mon, 30 Oct 2023 09:42:33 +0400 Subject: [PATCH] [8.11] Add Python 3.12 support --- .buildkite/pipeline.yml | 1 + .github/workflows/ci.yml | 17 ++++------------- .readthedocs.yml | 6 +++++- noxfile.py | 10 ++++++---- setup.py | 3 ++- 5 files changed, 18 insertions(+), 19 deletions(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index fe1f9a1be..7d91d37de 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -15,6 +15,7 @@ steps: - "3.9" - "3.10" - "3.11" + - "3.12" connection: - "urllib3" - "requests" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c6820bd94..3ff1c43c8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,8 +14,7 @@ jobs: with: python-version: "3.11" - name: Install dependencies - run: | - python3 -m pip install nox + run: python3 -m pip install nox - name: Lint the code run: nox -s lint @@ -23,7 +22,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] nox-session: [""] runs-on: ["ubuntu-latest"] @@ -38,18 +37,10 @@ jobs: with: python-version: ${{ matrix.python-version }} - name: Install Dependencies - run: | - python -m pip install nox + run: python -m pip install nox - name: Run Tests shell: bash run: .ci/run-nox.sh env: PYTHON_VERSION: ${{ matrix.python-version }} - NOX_SESSION: ${{ matrix.nox-session }} - # TEMPORARY for 3.11 - # https://github.com/aio-libs/aiohttp/issues/6600 - AIOHTTP_NO_EXTENSIONS: 1 - # https://github.com/aio-libs/frozenlist/issues/285 - FROZENLIST_NO_EXTENSIONS: 1 - # https://github.com/aio-libs/yarl/issues/680 - YARL_NO_EXTENSIONS: 1 + NOX_SESSION: ${{ matrix.nox-session }} \ No newline at end of file diff --git a/.readthedocs.yml b/.readthedocs.yml index 3cb2282d2..b8dd3e7ca 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -3,7 +3,11 @@ version: 2 build: os: ubuntu-22.04 tools: - python: "3.11" + # To work around https://github.com/aio-libs/aiohttp/issues/7675, we need + # to set AIOHTTP_NO_EXTENSIONS to 1 but it has to be done in + # https://readthedocs.org/dashboard/elasticsearch-py/environmentvariables/ + # because of https://github.com/readthedocs/readthedocs.org/issues/6311 + python: "3.12" python: install: diff --git a/noxfile.py b/noxfile.py index fc8b847c5..b9598a2d1 100644 --- a/noxfile.py +++ b/noxfile.py @@ -28,12 +28,14 @@ "test_elasticsearch/", "utils/", ) +# Allow building aiohttp when no wheels are available (eg. for recent Python versions) +INSTALL_ENV = {"AIOHTTP_NO_EXTENSIONS": "1"} -@nox.session(python=["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]) +@nox.session(python=["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]) def test(session): - session.install(".") - session.install("-r", "dev-requirements.txt") + session.install(".[async,requests]", env=INSTALL_ENV, silent=False) + session.install("-r", "dev-requirements.txt", silent=False) python_version = tuple(int(x) for x in session.python.split(".")) junit_xml = os.path.join(SOURCE_DIR, "junit", "elasticsearch-py-junit.xml") @@ -77,7 +79,7 @@ def lint(session): session.run("python", "utils/license-headers.py", "check", *SOURCE_FILES) # Workaround to make '-r' to still work despite uninstalling aiohttp below. - session.install(".[async,requests]") + session.install(".[async,requests]", env=INSTALL_ENV) # Run mypy on the package and then the type examples separately for # the two different mypy use-cases, ourselves and our users. diff --git a/setup.py b/setup.py index 41ba872d5..a27c663aa 100644 --- a/setup.py +++ b/setup.py @@ -86,10 +86,11 @@ "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", ], - python_requires=">=3.6, <4", + python_requires=">=3.6", install_requires=install_requires, extras_require={ "requests": ["requests>=2.4.0, <3.0.0"],