# How to drop support for an older Python version


To drop an older Python version, raise `requires-python` and update the tests and compatibility code that enforce that promise. Changing a development interpreter alone does not change which Python versions can install a release.

## Prerequisites

Use this checklist for an existing library managed with [uv](https://pydevtools.com/handbook/reference/uv.md), with a {{< term "build-backend" >}} and [pytest](https://pydevtools.com/handbook/reference/pytest.md) configured. The examples drop Python 3.10 and retain Python 3.11 through 3.15; substitute the versions your library supports. Run commands from the project root.

## Raise the minimum in package metadata

In the existing `[project]` table of [pyproject.toml](https://pydevtools.com/handbook/reference/pyproject.toml.md), change the floor:

```toml
requires-python = ">=3.11"
```

Remove `Programming Language :: Python :: 3.10` from `classifiers`, keeping classifiers for versions you still test. **Classifiers describe support; `requires-python` enforces it.** Compatible installers skip a release whose requirement excludes their interpreter, then look for an older compatible release that satisfies the other constraints.

## Align the interpreter and CI matrix

If `.python-version` still pins the dropped version, update it:

```bash
uv python pin 3.11
```

Expect `.python-version` to contain `3.11`. A newer supported development pin can stay unchanged; see [changing a uv project's Python version](https://pydevtools.com/handbook/how-to/how-to-change-the-python-version-of-a-uv-project.md).

Remove `"3.10"` from the existing GitHub Actions test matrix. Keep the new minimum, not just the newest interpreter:

```yaml
strategy:
  matrix:
    python-version: ["3.11", "3.12", "3.13", "3.14", "3.15"]
```

Ensure each test job actually selects `matrix.python-version`, rather than silently using `.python-version`. Update other version lists, such as [tox](https://pydevtools.com/handbook/reference/tox.md) environments or wheel-build targets, if present. Follow [testing against multiple Python versions](https://pydevtools.com/handbook/how-to/how-to-test-against-multiple-python-versions-using-uv.md) for the test commands and CI setup.

## Remove obsolete compatibility code

Update explicit Python targets in linting and type-checker configuration. [Ruff](https://pydevtools.com/handbook/reference/ruff.md) infers its target from `requires-python` when no explicit target overrides it; remove or update a stale `target-version`.

Find version guards that the new floor makes obsolete:

```bash
uvx ruff check --select UP036 --target-version py311 .
```

Expect `UP036` diagnostics for recognized outdated `sys.version_info` branches, or `All checks passed!` when none are found. Review each branch before removing it: Ruff marks automatic fixes unsafe because they discard code and comments.

Check conditional dependencies and fallback imports too. For example, after replacing a Python 3.10 [`tomli`](https://github.com/hukkin/tomli) fallback with [`tomllib`](https://docs.python.org/3/library/tomllib.html), remove a dependency used only under `python_version < '3.11'`. Do not remove every backport blindly; some expose features newer than the new minimum.

## Refresh the lockfile and test the new minimum

```bash
uv lock
uv run --locked --python 3.11 pytest
```

`uv lock` updates the project's {{< term "lockfile" >}} for the new requirements; review its `requires-python` field and package changes. It prefers existing compatible pins, so raising the floor does not automatically upgrade every dependency. Keep deliberate dependency upgrades separate from the support change.

`uv run` executes the command inside the project's virtual environment, ensuring all dependencies are installed first. Expect pytest to pass on 3.11; `--locked` rejects a stale lockfile instead of updating it.

Repeat the tests across the retained CI matrix, including relevant optional dependencies. A successful resolution does not prove runtime compatibility.

## Verify the release and tell users

```bash
uv build
```

Expect a {{< term "wheel" >}} and [source distribution](https://pydevtools.com/handbook/reference/sdist.md) in `dist/`. Open the new wheel as a ZIP archive and unpack the source distribution. Inspect `.dist-info/METADATA` in the wheel and `PKG-INFO` in the source distribution: both should contain `Requires-Python: >=3.11` and omit the dropped classifier.

Check the artifacts from this build, not an older file left in `dist/`.

Before publishing, update the changelog, installation instructions, and any Python-version badge. State the new minimum and the last release that supports the dropped version; announce the change in advance when your support policy promises notice.

Keep that older release available, and say whether it will receive fixes. Commit the metadata, compatibility edits, CI changes, and `uv.lock` together.
