Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Python 3.12 #1839

Merged
merged 11 commits into from
Mar 26, 2024
4 changes: 2 additions & 2 deletions .buildkite/it/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ agents:
steps:
- label: "Run 3.8 integration tests :test_tube:"
command: bash .buildkite/it/run.sh 3.8
- label: "Run 3.11 integration tests :test_tube:"
command: bash .buildkite/it/run.sh 3.11
- label: "Run 3.12 integration tests :test_tube:"
command: bash .buildkite/it/run.sh 3.12
4 changes: 2 additions & 2 deletions .buildkite/it/serverless-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ steps:
- elastic/vault-secrets#v0.0.2: *vault-base_url
- elastic/vault-secrets#v0.0.2: *vault-get_credentials_endpoint
- elastic/vault-secrets#v0.0.2: *vault-api_key
command: bash .buildkite/it/run_serverless.sh 3.11 user
command: bash .buildkite/it/run_serverless.sh 3.12 user
- label: "Run IT serverless tests with operator privileges"
plugins:
- elastic/vault-secrets#v0.0.2: *vault-base_url
- elastic/vault-secrets#v0.0.2: *vault-get_credentials_endpoint
- elastic/vault-secrets#v0.0.2: *vault-api_key
command: bash .buildkite/it/run_serverless.sh 3.11 operator
command: bash .buildkite/it/run_serverless.sh 3.12 operator
3 changes: 2 additions & 1 deletion .ci/variables.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"PY38": "3.8.16",
"PY39": "3.9.16",
"PY310": "3.10.10",
"PY311": "3.11.4",
"PY311": "3.11.7",
"PY312": "3.12.2",
"MIN_PY_VER": "3.8.16"
}
}
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11"
python-version: "3.12"
cache: pip
cache-dependency-path: pyproject.toml
- name: "Install dependencies"
Expand All @@ -39,7 +39,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
os:
- macos-latest
- ubuntu-latest
Expand Down Expand Up @@ -71,7 +71,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11"
python-version: "3.12"
cache: pip
cache-dependency-path: pyproject.toml
- uses: actions/setup-java@v3
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2
build:
os: ubuntu-22.04
tools:
python: "3.11"
python: "3.12"

python:
install:
Expand Down
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export PY38 := $(shell jq -r '.python_versions.PY38' .ci/variables.json)
export PY39 := $(shell jq -r '.python_versions.PY39' .ci/variables.json)
export PY310 := $(shell jq -r '.python_versions.PY310' .ci/variables.json)
export PY311 := $(shell jq -r '.python_versions.PY311' .ci/variables.json)
export PY312 := $(shell jq -r '.python_versions.PY312' .ci/variables.json)
export HATCH_VERSION := $(shell jq -r '.prerequisite_versions.HATCH' .ci/variables.json)
export HATCHLING_VERSION := $(shell jq -r '.prerequisite_versions.HATCHLING' .ci/variables.json)
export PIP_VERSION := $(shell jq -r '.prerequisite_versions.PIP' .ci/variables.json)
Expand All @@ -42,6 +43,7 @@ prereq:
pyenv install --skip-existing $(PY39)
pyenv install --skip-existing $(PY310)
pyenv install --skip-existing $(PY311)
pyenv install --skip-existing $(PY312)
pyenv local $(PY38)
@# Ensure all Python versions are registered for this project
@ jq -r '.python_versions | [.[] | tostring] | join("\n")' .ci/variables.json > .python-version
Expand Down Expand Up @@ -98,12 +100,12 @@ serve-docs: check-venv

test: check-venv
. $(VENV_ACTIVATE_FILE); nox -s test-3.8
. $(VENV_ACTIVATE_FILE); nox -s test-3.11
. $(VENV_ACTIVATE_FILE); nox -s test-3.12

# checks min and max python versions
it: check-venv python-caches-clean
. $(VENV_ACTIVATE_FILE); nox -s it-3.8
. $(VENV_ACTIVATE_FILE); nox -s it-3.11
. $(VENV_ACTIVATE_FILE); nox -s it-3.12

check-all: lint test it

Expand Down
6 changes: 3 additions & 3 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import nox


@nox.session(python=["3.8", "3.9", "3.10", "3.11"])
@nox.session(python=["3.8", "3.9", "3.10", "3.11", "3.12"])
def test(session: nox.Session) -> None:
session.install(".[develop]")
session.run("pytest")


@nox.session(python=["3.8", "3.9", "3.10", "3.11"])
@nox.session(python=["3.8", "3.9", "3.10", "3.11", "3.12"])
def it(session: nox.Session) -> None:
session.install(".[develop]")
session.run("pytest", "-s", "it")


@nox.session(python="3.11")
@nox.session(python="3.12")
def it_serverless(session: nox.Session) -> None:
session.install(".[develop]")
session.install("pytest-rally @ git+https://github.com/elastic/pytest-rally.git")
Expand Down
9 changes: 5 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ classifiers=[
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3 :: Only",
]
################################################################################################
Expand Down Expand Up @@ -68,7 +69,7 @@ dependencies = [
# License: MPL 2.0
"certifi",
# License: MIT
"yappi==1.4.0",
"yappi==1.5.1",
# License: BSD
"ijson==2.6.1",
# License: Apache 2.0
Expand All @@ -88,20 +89,20 @@ s3 = [
# botocore: Apache 2.0
# jmespath: MIT
# s3transfer: Apache 2.0
"boto3==1.18.46",
"boto3==1.34.68",
]
# These packages are only required when developing Rally
develop = [
# s3
"boto3==1.18.46",
"boto3==1.34.68",
# tests
"ujson",
"pytest==7.1.2",
"pytest-benchmark==3.4.1",
"pytest-asyncio==0.19.0",
"pytest-httpserver==1.0.5",
"tox==3.25.0",
"nox==2022.11.21",
"nox==2024.3.2",
"sphinx==5.1.1",
"furo==2022.06.21",
"github3.py==3.2.0",
favilo marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
8 changes: 4 additions & 4 deletions tests/client/factory_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -576,16 +576,16 @@ def test_successfully_deletes_api_keys(self, es, version):
{"invalidated_api_keys": ["baz"]},
]
calls = [
mock.call({"id": "baz"}),
mock.call({"id": "bar"}),
mock.call({"id": "foo"}),
mock.call(id="baz"),
mock.call(id="bar"),
mock.call(id="foo"),
]
else:
es.security.invalidate_api_key.return_value = {"invalidated_api_keys": ["foo", "bar", "baz"], "error_count": 0}
calls = [mock.call(ids=ids)]

assert client.delete_api_keys(es, ids, max_attempts=3)
assert es.security.invalidate_api_key.has_calls(calls, any_order=True)
es.security.invalidate_api_key.assert_has_calls(calls, any_order=True)

@pytest.mark.parametrize("version", ["7.9.0", "7.10.0"])
@mock.patch("time.sleep")
Expand Down
Loading