diff --git a/.github/actions/cache-uv/action.yml b/.github/actions/cache-uv/action.yml new file mode 100644 index 000000000..f645e6f8c --- /dev/null +++ b/.github/actions/cache-uv/action.yml @@ -0,0 +1,15 @@ +name: Cache uv dependencies +description: Share package downloads and built wheels between uv jobs. +inputs: + suffix: + description: Cache namespace and Python version. + required: true +runs: + using: composite + steps: + - uses: actions/cache@v5 + with: + path: .uv-cache + key: uv-0.13.9-${{ runner.os }}-${{ runner.arch }}-${{ inputs.suffix }}-${{ hashFiles('uv.lock') }} + - shell: bash + run: echo "UV_CACHE_DIR=.uv-cache" >> "$GITHUB_ENV" diff --git a/.github/actions/run-uv/action.yml b/.github/actions/run-uv/action.yml new file mode 100644 index 000000000..f663a8836 --- /dev/null +++ b/.github/actions/run-uv/action.yml @@ -0,0 +1,41 @@ +name: Run in the Astral uv image +description: Run a project command with the runner workspace and temporary directory mounted. +inputs: + command: + description: Bash commands to run in the image. + required: true + testcontainers: + description: Give the test process access to the runner's Docker daemon. + default: "false" +runs: + using: composite + steps: + - shell: bash + env: + UV_COMMAND: ${{ inputs.command }} + USE_TESTCONTAINERS: ${{ inputs.testcontainers }} + run: | + args=( + --rm --init + --user "$(id -u):$(id -g)" + --mount "type=bind,src=$GITHUB_WORKSPACE,dst=$GITHUB_WORKSPACE" + --mount "type=bind,src=$RUNNER_TEMP,dst=$RUNNER_TEMP" + --workdir "$GITHUB_WORKSPACE" + # Temporal's Go CLI needs a username when the runner UID has no container passwd entry. + --env USER="$(id -un)" + --env TMPDIR="$RUNNER_TEMP" + --env UV_PYTHON_INSTALL_DIR="$RUNNER_TEMP/uv-python" + --env UV_PYTHON --env UV_CACHE_DIR --env EXPECTED_PYTHON + --env GITHUB_STEP_SUMMARY + ) + if [[ "$USE_TESTCONTAINERS" == "true" ]]; then + # Redis and Kafka advertise localhost. The Docker daemon also needs to see temporary fixture files. + args+=( + --network host + --group-add "$(stat -c %g /var/run/docker.sock)" + --mount type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock + --env TESTCONTAINERS_CONNECTION_MODE=docker_host --env TESTCONTAINERS_HOST_OVERRIDE=127.0.0.1 + --env BEHAVE_JOBS --env BEHAVE_HEAVY_JOBS --env FEATURES --env EXCLUDED_FEATURES + ) + fi + docker run "${args[@]}" ghcr.io/astral-sh/uv:0.13.9-trixie bash -ec "$UV_COMMAND" diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index e79e9b28c..f8c3f5031 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -8,6 +8,10 @@ on: paths: - 'docs/**' - 'archipy/**' + - 'packages/**' + - 'pyproject.toml' + - 'uv.lock' + - '.python-version' - '.github/workflows/deploy-docs.yml' permissions: @@ -16,29 +20,21 @@ permissions: jobs: deploy: runs-on: ubuntu-latest + container: ghcr.io/astral-sh/uv:0.13.9-trixie steps: - name: Checkout repository uses: actions/checkout@v6 with: fetch-depth: 0 # Fetch all history for proper versioning - - name: Set up Python - uses: actions/setup-python@v6 - with: - python-version: '3.14' - - - name: Install UV - uses: astral-sh/setup-uv@v7 - - - name: Cache UV + - name: Cache uv dependencies uses: actions/cache@v5 with: path: ~/.cache/uv - key: uv-${{ runner.os }}-docs-${{ hashFiles('uv.lock') }} + key: uv-docs-deploy-${{ runner.arch }}-${{ hashFiles('.python-version', 'uv.lock') }} - name: Install dependencies - run: | - uv sync --group docs + run: uv sync --locked --group docs - name: Configure Git user run: | @@ -46,5 +42,4 @@ jobs: git config --local user.name "github-actions[bot]" - name: Deploy documentation - run: | - uv run --group docs mkdocs gh-deploy --force -f docs/mkdocs-full.yml + run: uv run --no-sync mkdocs gh-deploy --force -f docs/mkdocs-full.yml diff --git a/.github/workflows/docs-check.yml b/.github/workflows/docs-check.yml index 35e7c9758..bb25bb2b1 100644 --- a/.github/workflows/docs-check.yml +++ b/.github/workflows/docs-check.yml @@ -7,30 +7,46 @@ on: - 'docs/**' - 'archipy/**' - 'packages/**' + - 'pyproject.toml' + - 'uv.lock' + - 'Makefile' + - '.readthedocs.yaml' - '.github/workflows/docs-check.yml' permissions: contents: read jobs: - docs-check: + build: + name: docs (Python ${{ matrix.python-version }}) runs-on: ubuntu-latest + container: ghcr.io/astral-sh/uv:0.13.9-trixie + env: + UV_PYTHON: ${{ matrix.python-version }} + strategy: + fail-fast: false + matrix: + python-version: ["3.14", "3.15"] steps: - uses: actions/checkout@v6 - - name: Set up Python 3.14 - uses: actions/setup-python@v6 - with: - python-version: "3.14" - - - name: Install UV - uses: astral-sh/setup-uv@v7 - - - name: Cache UV + - name: Cache uv dependencies uses: actions/cache@v5 with: path: ~/.cache/uv - key: uv-${{ runner.os }}-3.14-${{ hashFiles('uv.lock') }} + key: uv-docs-${{ runner.arch }}-${{ matrix.python-version }}-${{ hashFiles('uv.lock') }} + + - name: Install dependencies + run: uv sync --locked --group docs - name: Build the docs in strict mode + env: + UV_NO_SYNC: "true" run: make docs-check + + docs-check: + needs: build + if: always() + runs-on: ubuntu-latest + steps: + - run: test "${{ needs.build.result }}" = success diff --git a/.github/workflows/instrumentor-compat.yml b/.github/workflows/instrumentor-compat.yml index d7480045e..ae0c4393f 100644 --- a/.github/workflows/instrumentor-compat.yml +++ b/.github/workflows/instrumentor-compat.yml @@ -10,12 +10,23 @@ on: jobs: instrumentor-compat: + name: instrumentor compatibility (Python ${{ matrix.python-version }}) runs-on: ubuntu-latest + container: ghcr.io/astral-sh/uv:0.13.9-trixie + env: + UV_PYTHON: ${{ matrix.python-version }} + strategy: + fail-fast: false + matrix: + python-version: ["3.14", "3.15"] permissions: contents: read steps: - uses: actions/checkout@v6 - - name: Install uv - uses: astral-sh/setup-uv@v7 + - uses: ./.github/actions/cache-uv + with: + suffix: instrumentor-${{ matrix.python-version }} + - name: Install Python + run: uv python install "$UV_PYTHON" - name: Check instrumentor version ranges run: ./scripts/check_instrumentor_compat.sh diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index aa7403a61..73c43f9de 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -8,20 +8,20 @@ on: - '[0-9]+.[0-9]+.[0-9]+' jobs: - publish: + build: + name: build packages (Python ${{ matrix.python-version }}) runs-on: ubuntu-latest + container: ghcr.io/astral-sh/uv:0.13.9-trixie + env: + UV_PYTHON: ${{ matrix.python-version }} + strategy: + fail-fast: false + matrix: + python-version: ["3.14", "3.15"] steps: - name: Checkout code uses: actions/checkout@v6 - - name: Set up Python - uses: actions/setup-python@v6 - with: - python-version: 3.14 - - - name: Install UV - uses: astral-sh/setup-uv@v7 - - name: Update version in pyproject.toml run: | # Extract version from tag @@ -31,9 +31,31 @@ jobs: sed -i -E "s/^version = \"[^\"]*\"/version = \"$VERSION\"/; s/\"archipy(-[a-z-]+)?(\[[a-z]+\])?==[^\"]*\"/\"archipy\1\2==$VERSION\"/" "$f" done - - name: Build and Publish to PyPI + - name: Build distributions + run: uv build --all-packages --python "$UV_PYTHON" + + - name: Upload distributions for publishing + if: matrix.python-version == '3.14' + uses: actions/upload-artifact@v4 + with: + name: distributions + path: | + dist/*.whl + dist/*.tar.gz + if-no-files-found: error + + publish: + needs: build + runs-on: ubuntu-latest + container: ghcr.io/astral-sh/uv:0.13.9-trixie + steps: + - name: Download distributions + uses: actions/download-artifact@v5 + with: + name: distributions + path: dist + + - name: Publish to PyPI env: UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }} - run: | - uv build --all-packages - uv publish + run: uv publish diff --git a/.github/workflows/ruff-lint.yml b/.github/workflows/ruff-lint.yml index 770528236..7231b1fef 100644 --- a/.github/workflows/ruff-lint.yml +++ b/.github/workflows/ruff-lint.yml @@ -10,41 +10,54 @@ permissions: contents: read jobs: - lint: + ruff: + name: Ruff (${{ matrix.target-version }}) runs-on: ubuntu-latest + container: ghcr.io/astral-sh/uv:0.13.9-trixie + strategy: + fail-fast: false + matrix: + target-version: ["py314", "py315"] steps: - uses: actions/checkout@v6 with: fetch-depth: 0 + - name: Install lint tools + run: uv sync --locked --only-group dev + - name: Run Ruff check - uses: astral-sh/ruff-action@v3 - with: - args: check --output-format=github - src: "archipy packages features/steps scripts" + run: uv run --no-sync ruff check --no-fix --output-format=github --target-version ${{ matrix.target-version }} archipy packages features/steps scripts - name: Run Ruff format check - uses: astral-sh/ruff-action@v3 - with: - args: format --check - src: "archipy packages features/steps scripts" + run: uv run --no-sync ruff format --check --target-version ${{ matrix.target-version }} archipy packages features/steps scripts - - name: Set up Python 3.14 - uses: actions/setup-python@v6 - with: - python-version: "3.14" - - - name: Install UV - uses: astral-sh/setup-uv@v7 + gherkin: + name: gherkin (Python ${{ matrix.python-version }}) + runs-on: ubuntu-latest + container: ghcr.io/astral-sh/uv:0.13.9-trixie + env: + UV_PYTHON: ${{ matrix.python-version }} + strategy: + fail-fast: false + matrix: + python-version: ["3.14", "3.15"] + steps: + - uses: actions/checkout@v6 - - name: Cache UV - uses: actions/cache@v5 + - uses: ./.github/actions/cache-uv with: - path: ~/.cache/uv - key: uv-${{ runner.os }}-3.14-${{ hashFiles('uv.lock') }} + suffix: gherkin-${{ matrix.python-version }} - name: Install dependencies - run: uv sync --group dev --frozen + run: uv sync --locked --group dev - name: Run Gherkin format check - run: uv run gherkin-formatter --check features/ + run: uv run --no-sync gherkin-formatter --check features/ + + lint: + needs: [ruff, gherkin] + if: always() + runs-on: ubuntu-latest + steps: + - run: test "${{ needs.ruff.result }}" = success && test "${{ needs.gherkin.result }}" = success diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 38d8ffb83..5a3b26ed1 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -6,15 +6,11 @@ on: pull_request: branches: [ '*' ] -# A new push to a pull request or to master replaces the run of the same ref that is still going: every run starts -# about 30 jobs and the runner limit queues the rest, so stale runs only delay the current one. +# A new push to a pull request or to master cancels the previous run for that ref so stale jobs free runner slots. concurrency: group: behave-${{ github.ref }} cancel-in-progress: true -env: - PYTHON_VERSION: "3.14" - jobs: # Finds which feature groups a pull request can affect. A push to master runs every group. changes: @@ -269,9 +265,52 @@ jobs: - '!features/string_utils.feature' - '!features/totp_utils.feature' - behave: - name: behave (${{ matrix.group.name }}) + dependencies: + name: prepare dependencies (Python ${{ matrix.python-version }}) needs: changes + if: github.event_name == 'push' || needs.changes.outputs.shared == 'true' || needs.changes.outputs.groups != '[]' + permissions: + contents: read + runs-on: ubuntu-latest + timeout-minutes: 30 + env: + UV_PYTHON: ${{ matrix.python-version }} + strategy: + fail-fast: false + matrix: + python-version: ["3.14", "3.15"] + steps: + - uses: actions/checkout@v6 + - uses: ./.github/actions/cache-uv + with: + suffix: adapters-${{ matrix.python-version }} + + # Build native dependencies once per interpreter before the feature groups fan out. + - name: Prepare locked dependencies and verify Python + uses: ./.github/actions/run-uv + env: + EXPECTED_PYTHON: ${{ matrix.python-version }} + with: + command: | + make ci-install + uv run --no-sync python - <<'PY' + import os + import sys + import sysconfig + + from archipy.configs.base_config import BaseConfig + + version = f"{sys.version_info.major}.{sys.version_info.minor}" + assert version == os.environ["EXPECTED_PYTHON"], version + assert not sysconfig.get_config_var("Py_GIL_DISABLED"), "Expected a GIL-enabled CPython build" + PY + uv run --no-sync python -m compileall -q archipy packages + uv cache prune --ci + + behave: + name: behave (Python ${{ matrix.python-version }}, ${{ matrix.group.name }}) + needs: [changes, dependencies] + if: ${{ !cancelled() && needs.changes.result == 'success' && (needs.dependencies.result == 'success' || needs.dependencies.result == 'skipped') }} permissions: contents: read runs-on: ubuntu-latest @@ -432,42 +471,36 @@ jobs: features/atomic_transactions_postgres.feature features/atomic_transactions_mysql.feature features/atomic_transactions_sqlite.feature + python-version: ["3.14", "3.15"] steps: - uses: actions/checkout@v6 if: env.RUN == 'true' - - name: Set up Python ${{ env.PYTHON_VERSION }} + - name: Restore uv dependency cache if: env.RUN == 'true' - uses: actions/setup-python@v6 + uses: ./.github/actions/cache-uv with: - python-version: ${{ env.PYTHON_VERSION }} - - # The wheels are downloaded once and shared by every group: restoring the uv cache leaves `uv sync` only the - # linking of the packages. Only the first job to finish saves it; the others find the key taken. - - name: Install UV - if: env.RUN == 'true' - uses: astral-sh/setup-uv@v7 - with: - enable-cache: true - cache-dependency-glob: uv.lock - cache-suffix: ${{ env.PYTHON_VERSION }} - - # The locked versions of the extras (they pull in the workspace packages), without the dev tools, the pre-commit - # hooks and the dependency upgrade that `make install-dev` adds. - - name: Install dependencies - if: env.RUN == 'true' - run: uv sync --locked --all-extras + suffix: adapters-${{ matrix.python-version }} - name: Run Behave features in parallel if: env.RUN == 'true' - run: make behave FEATURE="${{ matrix.group.features }}" EXCLUDE="${{ matrix.group.exclude }}" + uses: ./.github/actions/run-uv + env: + UV_PYTHON: ${{ matrix.python-version }} + FEATURES: ${{ matrix.group.features }} + EXCLUDED_FEATURES: ${{ matrix.group.exclude }} + with: + testcontainers: "true" + command: | + make ci-install + UV_NO_SYNC=true make behave FEATURE="$FEATURES" EXCLUDE="$EXCLUDED_FEATURES" - name: Upload feature logs if: failure() && env.RUN == 'true' uses: actions/upload-artifact@v4 with: - name: behave-logs-${{ matrix.group.name }} + name: behave-logs-${{ matrix.python-version }}-${{ matrix.group.name }} path: .behave-logs/ include-hidden-files: true retention-days: 7 @@ -476,13 +509,13 @@ jobs: behave-tests: name: behave-tests if: always() - needs: [changes, behave] + needs: [changes, dependencies, behave] runs-on: ubuntu-latest permissions: {} steps: - name: Fail when a group failed run: | if [ "${{ needs.changes.result }}" != "success" ] || [ "${{ needs.behave.result }}" != "success" ]; then - echo "Group selection: ${{ needs.changes.result }}, behave groups: ${{ needs.behave.result }}" + echo "Group selection: ${{ needs.changes.result }}, dependencies: ${{ needs.dependencies.result }}, behave groups: ${{ needs.behave.result }}" exit 1 fi diff --git a/.github/workflows/ty-lint.yml b/.github/workflows/ty-lint.yml index e154e7f9f..da7827c55 100644 --- a/.github/workflows/ty-lint.yml +++ b/.github/workflows/ty-lint.yml @@ -10,29 +10,34 @@ permissions: contents: read jobs: - lint: + check: + name: ty (Python ${{ matrix.python-version }}) runs-on: ubuntu-latest + env: + UV_PYTHON: ${{ matrix.python-version }} + strategy: + fail-fast: false + matrix: + python-version: ["3.14", "3.15"] steps: - uses: actions/checkout@v6 with: fetch-depth: 0 - - name: Set up Python 3.14 - uses: actions/setup-python@v6 + - uses: ./.github/actions/cache-uv with: - python-version: "3.14" # From pyproject.toml + suffix: adapters-${{ matrix.python-version }} - - name: Cache UV - uses: actions/cache@v5 + - name: Run Ty type checking + uses: ./.github/actions/run-uv with: - path: ~/.cache/uv - key: ${{ runner.os }}-uv-${{ hashFiles('**/pyproject.toml', '**/uv.lock') }} - - - name: Install UV - uses: astral-sh/setup-uv@v7 - - - name: Install dependencies - run: uv sync --all-extras --all-groups # Follows pyproject.toml exactly + command: | + make ci-install + uv run --no-sync ty check --python-version "${{ matrix.python-version }}" archipy packages - - name: Run Ty type checking - run: uv run ty check --fix archipy packages # Config from pyproject.toml + lint: + needs: check + if: always() + runs-on: ubuntu-latest + steps: + - run: test "${{ needs.check.result }}" = success diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 7f4dffe9a..8ff240c14 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -7,15 +7,15 @@ version: 2 build: os: ubuntu-22.04 tools: - python: "3.13" + python: "3.14" # Read the Docs bootstrap. uv supplies Python 3.15 for MkDocs. commands: - - pip install uv - - uv sync --group docs - - uv run mkdocs build -f docs/mkdocs.yml --site-dir $READTHEDOCS_OUTPUT/html - -mkdocs: - configuration: docs/mkdocs.yml - fail_on_warning: false + - >- + curl -fsSL https://astral.sh/uv/0.13.9/install.sh -o /tmp/archipy-uv-install.sh && + UV_UNMANAGED_INSTALL="$HOME/.local/bin" sh /tmp/archipy-uv-install.sh + - '"$HOME/.local/bin/uv" sync --python 3.15 --locked --group docs' + - >- + "$HOME/.local/bin/uv" run --python 3.15 --no-sync mkdocs build + -f docs/mkdocs.yml --site-dir "$READTHEDOCS_OUTPUT/html" search: ranking: diff --git a/Makefile b/Makefile index 89d889728..c651019a7 100644 --- a/Makefile +++ b/Makefile @@ -162,15 +162,19 @@ pre-commit: ## Run pre-commit hooks .PHONY: check check: format lint security behave ## Run all checks (format, linting, security, and tests) +.PHONY: ci-install +ci-install: ## Install locked CI dependencies for the selected Python interpreter + $(UV) sync --locked --all-extras + .PHONY: ci ci: ## Run CI pipeline locally @echo "${BLUE}Running CI pipeline...${NC}" $(MAKE) clean - $(MAKE) install-dev - $(MAKE) lint - $(MAKE) security - $(MAKE) behave - $(MAKE) build + $(MAKE) ci-install + UV_NO_SYNC=true $(MAKE) lint + UV_NO_SYNC=true $(MAKE) security + UV_NO_SYNC=true $(MAKE) behave + $(UV) build --all-packages .PHONY: format-changes format-changes: ## Format only git-changed Python and Gherkin files diff --git a/docs/community/contributing.md b/docs/community/contributing.md index fb17eb72f..f1d52baf2 100644 --- a/docs/community/contributing.md +++ b/docs/community/contributing.md @@ -90,6 +90,8 @@ Run the tests to ensure your changes don't break existing functionality: make behave ``` +Run the local CI pipeline with a specific interpreter, for example `UV_PYTHON=3.15 make ci`. + ### Documentation All new features or changes should be documented: diff --git a/docs/community/faq.md b/docs/community/faq.md index 60525effe..1a6418ea3 100644 --- a/docs/community/faq.md +++ b/docs/community/faq.md @@ -64,13 +64,10 @@ There is no requirement to adopt the full four-layer structure immediately. ### Why does ArchiPy require Python 3.14+? -ArchiPy targets the latest stable Python release to stay lean and forward-looking. Requiring 3.14+ -ensures access to the full set of current runtime improvements, performance gains, and security patches, -while dropping legacy compatibility shims like `typing.Optional`, `typing.Union`, and +ArchiPy uses Python 3.14 as its minimum and tests on CPython 3.14 and 3.15. Python 3.14 provides +deferred evaluation of annotations by default, so ArchiPy can use modern type hints without `from __future__ import annotations`. -Using the latest stable Python keeps dependencies minimal and the code idiomatic. - --- ## Adapters diff --git a/docs/getting-started/installation.md b/docs/getting-started/installation.md index 7d8df0aa9..3780df066 100644 --- a/docs/getting-started/installation.md +++ b/docs/getting-started/installation.md @@ -9,7 +9,7 @@ description: Prerequisites, installation methods, and optional extras for ArchiP Before starting, ensure you have: -- **Python 3.14 or higher** +- **Python 3.14 or higher**. CI covers CPython 3.14 and 3.15. Check your version with: diff --git a/features/optional_dependencies.feature b/features/optional_dependencies.feature index a7a1d8b65..520b65a19 100644 --- a/features/optional_dependencies.feature +++ b/features/optional_dependencies.feature @@ -7,6 +7,10 @@ Feature: Optional dependencies Then the plain message should be built And the template message should fail with a message mentioning "jinja2" + Scenario: The PostgreSQL adapter requires the Psycopg binary distribution + When I read the "base" extra of the "postgres" package + Then it should require "psycopg[binary]>=3.3.9" + Scenario Outline: The async extra installs greenlet through sqlalchemy[asyncio] When I read the "" extra of the "" package Then it should require "sqlalchemy[asyncio]" diff --git a/features/test_containers.py b/features/test_containers.py index 1a3ccacba..ed179c5d6 100644 --- a/features/test_containers.py +++ b/features/test_containers.py @@ -1526,6 +1526,8 @@ def _build(self) -> DockerContainer: .with_env("MP_SMTP_AUTH", f"{self.USERNAME}:{self.PASSWORD}") # Mailpit resolves the name of every SMTP client; with no DNS in the container each connection waits 20 s. .with_env("MP_SMTP_DISABLE_RDNS", "true") + # Keep the /api/v1/info trace probe independent of GitHub's release API. + .with_env("MP_DISABLE_VERSION_CHECK", "true") .with_kwargs(mem_limit=CONTAINER_MEM_LIMITS["mailpit"]) ) if self.WITH_TLS: diff --git a/packages/redis/archipy/adapters/redis/adapter_mixins/connection.py b/packages/redis/archipy/adapters/redis/adapter_mixins/connection.py index 6df9c225a..63dda0459 100644 --- a/packages/redis/archipy/adapters/redis/adapter_mixins/connection.py +++ b/packages/redis/archipy/adapters/redis/adapter_mixins/connection.py @@ -142,19 +142,19 @@ def _set_sentinel_clients(self, configs: RedisConfig) -> None: raise InvalidArgumentError(argument_name="SENTINEL_SERVICE_NAME") sentinel_nodes = [(node.split(":")[0], int(node.split(":")[1])) for node in configs.SENTINEL_NODES] - sentinel = Sentinel( + sentinel_connection = Sentinel( sentinel_nodes, socket_timeout=configs.SENTINEL_SOCKET_TIMEOUT, password=configs.PASSWORD.get_secret_value() if configs.PASSWORD else None, sentinel_kwargs=_sentinel_kwargs(configs), ) - self.client = sentinel.master_for( + self.client = sentinel_connection.master_for( sentinel_service_name, **_sentinel_redis_kwargs(configs, is_async=False), ) - self.read_only_client = sentinel.slave_for( + self.read_only_client = sentinel_connection.slave_for( sentinel_service_name, **_sentinel_redis_kwargs(configs, is_async=False), ) @@ -420,19 +420,19 @@ def _set_sentinel_clients(self, configs: RedisConfig) -> None: raise InvalidArgumentError(argument_name="SENTINEL_SERVICE_NAME") sentinel_nodes = [(node.split(":")[0], int(node.split(":")[1])) for node in configs.SENTINEL_NODES] - sentinel = AsyncSentinel( + sentinel_connection = AsyncSentinel( sentinel_nodes, socket_timeout=configs.SENTINEL_SOCKET_TIMEOUT, password=configs.PASSWORD.get_secret_value() if configs.PASSWORD else None, sentinel_kwargs=_sentinel_kwargs(configs), ) - self.client = sentinel.master_for( + self.client = sentinel_connection.master_for( sentinel_service_name, **_sentinel_redis_kwargs(configs, is_async=True), ) - self.read_only_client = sentinel.slave_for( + self.read_only_client = sentinel_connection.slave_for( sentinel_service_name, **_sentinel_redis_kwargs(configs, is_async=True), ) diff --git a/pyproject.toml b/pyproject.toml index dd4c675f4..409baf2bd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,6 +7,10 @@ authors = [ readme = "README.md" version = "0.1.0" # This version set on publish flow! requires-python = ">=3.14,<4" +classifiers = [ + "Programming Language :: Python :: 3.14", + "Programming Language :: Python :: 3.15", +] dependencies = [ "pydantic>=2.14.3", "pydantic-settings>=2.16.3", @@ -221,7 +225,7 @@ exclude = [ line-length = 120 # Target Python version -target-version = "py314" +target-version = "py315" # Ruff format configuration [tool.ruff.format] @@ -344,7 +348,7 @@ ignore-variadic-names = true # Allow unused *args, **kwargs [tool.ty.environment] # Target Python version -python-version = "3.14" +python-version = "3.15" [tool.ty.src] # Include source directories