chore!: drop Python 3.9 support due to EOL (#10244)

* feat!: drop Python 3.9 support due to EOL

Remove Python 3.9 support following its end-of-life in October 2025.
Minimum required version is now Python 3.10.

BREAKING CHANGE: Python 3.10 or later is now required

Changes:
- Update pyproject.toml requires-python to >=3.10
- Remove Python 3.9 from pyproject.toml classifiers
- Update CI workflows to test Python 3.10 as minimum
- Update mypy python_version to 3.10
- Migrate TypeAlias from typing_extensions to typing stdlib
- Remove blis version pin (only needed for Python 3.9)
- Update CONTRIBUTING.md Python version requirements
- Add release note documenting breaking change

Closes #9854

* small fixes

* update relnote

---------

Co-authored-by: anakin87 <stefanofiorucci@gmail.com>
This commit is contained in:
Guna Palanivel
2025-12-16 23:30:00 +05:30
committed by GitHub
parent c32f657ff0
commit 9952940ba7
11 changed files with 17 additions and 23 deletions

View File

@@ -8,7 +8,7 @@ on:
description: 'URL of the bump version PR'
value: ${{ jobs.branch-off.outputs.bump_version_pr_url }}
env:
PYTHON_VERSION: "3.9"
PYTHON_VERSION: "3.10"
jobs:
branch-off:

View File

@@ -15,7 +15,7 @@ on:
- ".github/workflows/e2e.yml"
env:
PYTHON_VERSION: "3.9"
PYTHON_VERSION: "3.10"
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
HATCH_VERSION: "1.14.2"
# we use HF_TOKEN instead of HF_API_TOKEN to work around a Hugging Face bug

View File

@@ -9,7 +9,7 @@ on:
- "!v1.[0-9]+.[0-9]+"
env:
PYTHON_VERSION: "3.9"
PYTHON_VERSION: "3.10"
jobs:
promote:

View File

@@ -13,7 +13,7 @@ name: Slow Integration Tests
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HF_API_TOKEN: ${{ secrets.HUGGINGFACE_API_KEY }}
PYTHON_VERSION: "3.9"
PYTHON_VERSION: "3.10"
HATCH_VERSION: "1.14.2"
HAYSTACK_MPS_ENABLED: false
HAYSTACK_XPU_ENABLED: false

View File

@@ -32,7 +32,7 @@ env:
AZURE_OPENAI_ENDPOINT: ${{ secrets.AZURE_OPENAI_ENDPOINT }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HF_API_TOKEN: ${{ secrets.HUGGINGFACE_API_KEY }}
PYTHON_VERSION: "3.9"
PYTHON_VERSION: "3.10"
HATCH_VERSION: "1.14.2"
jobs:

View File

@@ -153,9 +153,7 @@ next contribution!
### Setting up your development environment
*To run Haystack tests locally, ensure your development environment uses Python >=3.9 and <3.13.*
Some optional dependencies are not yet compatible with Python 3.13
(see [this PR](https://github.com/deepset-ai/haystack/pull/8965) for details).
*To run Haystack tests locally, ensure your development environment uses Python >=3.10 and <3.14.*
Haystack makes heavy use of [Hatch](https://hatch.pypa.io/latest/), a Python project manager that we use to set up the
virtual environments, build the project, and publish packages. As you can imagine, the first step towards becoming a

View File

@@ -4,13 +4,12 @@
import ast
import contextlib
from typing import Any, Callable, Optional
from typing import Any, Callable, Optional, TypeAlias
import jinja2.runtime
from jinja2 import TemplateSyntaxError
from jinja2.nativetypes import NativeEnvironment
from jinja2.sandbox import SandboxedEnvironment
from typing_extensions import TypeAlias
from haystack import component, default_from_dict, default_to_dict, logging
from haystack.utils import deserialize_callable, deserialize_type, serialize_callable, serialize_type

View File

@@ -80,9 +80,7 @@ from contextvars import ContextVar
from copy import deepcopy
from dataclasses import dataclass
from types import new_class
from typing import Any, Iterator, Mapping, Optional, Protocol, TypeVar, Union, overload, runtime_checkable
from typing_extensions import ParamSpec
from typing import Any, Iterator, Mapping, Optional, ParamSpec, Protocol, TypeVar, Union, overload, runtime_checkable
from haystack import logging
from haystack.core.errors import ComponentError

View File

@@ -3,9 +3,7 @@
# SPDX-License-Identifier: Apache-2.0
from dataclasses import dataclass, field
from typing import Annotated, Any, Iterable, TypedDict, TypeVar, get_args
from typing_extensions import TypeAlias # Python 3.9 compatibility
from typing import Annotated, Any, Iterable, TypeAlias, TypedDict, TypeVar, get_args
HAYSTACK_VARIADIC_ANNOTATION = "__haystack__variadic_t"
HAYSTACK_GREEDY_VARIADIC_ANNOTATION = "__haystack__greedy_variadic_t"

View File

@@ -8,7 +8,7 @@ dynamic = ["version"]
description = "LLM framework to build customizable, production-ready LLM applications. Connect components (models, vector DBs, file converters) to pipelines or agents that can interact with your data."
readme = "README.md"
license = "Apache-2.0"
requires-python = ">=3.9"
requires-python = ">=3.10"
authors = [{ name = "deepset.ai", email = "malte.pietsch@deepset.ai" }]
keywords = [
"BERT",
@@ -34,7 +34,6 @@ classifiers = [
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
@@ -52,7 +51,7 @@ dependencies = [
"pyyaml",
"more-itertools", # TextDocumentSplitter
"networkx", # Pipeline graphs
"typing_extensions>=4.7", # typing support for Python 3.9
"typing_extensions>=4.7", # Extended typing features (NotRequired, etc.)
"requests",
"numpy",
"python-dateutil",
@@ -169,9 +168,6 @@ extra-dependencies = [
# NamedEntityExtractor
"spacy>=3.8,<3.9",
"en-core-web-trf @ https://github.com/explosion/spacy-models/releases/download/en_core_web_trf-3.8.0/en_core_web_trf-3.8.0-py3-none-any.whl",
# spacy requires thinc, which depends on blis. We pin blis because version 1.2.1 does not have wheels for python 3.9
# and compiling it from source takes much time.
"blis<1.2.1; python_version < '3.10'",
]
[tool.hatch.envs.e2e.scripts]
@@ -268,7 +264,7 @@ asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "class"
[tool.mypy]
python_version = "3.9"
python_version = "3.10"
check_untyped_defs = true
disallow_incomplete_defs = true
ignore_missing_imports = true

View File

@@ -0,0 +1,5 @@
---
upgrade:
- |
Dropped support for Python 3.9 since it reached End of Life (EOL) in October 2025.
The minimum supported Python version is now 3.10.