mirror of
https://github.com/deepset-ai/haystack.git
synced 2025-12-03 18:36:04 +00:00
build: drop Python 3.8 support (#8978)
* draft * readd typing_extensions * small fix + release note * remove ruff target-version * Update releasenotes/notes/drop-python-3.8-868710963e794c83.yaml Co-authored-by: David S. Batista <dsbatista@gmail.com> --------- Co-authored-by: David S. Batista <dsbatista@gmail.com>
This commit is contained in:
parent
4a87ceb0ed
commit
c04c900f26
@ -70,7 +70,6 @@ method decorated with `@component.input`. This dataclass contains:
|
||||
"""
|
||||
|
||||
import inspect
|
||||
import sys
|
||||
from collections.abc import Callable
|
||||
from contextlib import contextmanager
|
||||
from contextvars import ContextVar
|
||||
@ -157,11 +156,7 @@ class Component(Protocol):
|
||||
# arguments. Even defining here a method with `**kwargs` doesn't work as the
|
||||
# expected signature must be identical.
|
||||
# This makes most Language Servers and type checkers happy and shows less errors.
|
||||
# NOTE: This check can be removed when we drop Python 3.8 support.
|
||||
if sys.version_info >= (3, 9):
|
||||
run: Callable[..., Dict[str, Any]]
|
||||
else:
|
||||
run: Callable
|
||||
run: Callable[..., Dict[str, Any]]
|
||||
|
||||
|
||||
class ComponentMeta(type):
|
||||
|
||||
@ -3,9 +3,9 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Any, Iterable, List, Type, TypeVar, get_args
|
||||
from typing import Annotated, Any, Iterable, List, Type, TypeVar, get_args
|
||||
|
||||
from typing_extensions import Annotated, TypeAlias # Python 3.8 compatibility
|
||||
from typing_extensions import TypeAlias # Python 3.9 compatibility
|
||||
|
||||
HAYSTACK_VARIADIC_ANNOTATION = "__haystack__variadic_t"
|
||||
HAYSTACK_GREEDY_VARIADIC_ANNOTATION = "__haystack__greedy_variadic_t"
|
||||
|
||||
@ -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.8"
|
||||
requires-python = ">=3.9"
|
||||
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.8",
|
||||
"Programming Language :: Python :: 3.9",
|
||||
"Programming Language :: Python :: 3.10",
|
||||
"Programming Language :: Python :: 3.11",
|
||||
@ -53,7 +52,7 @@ dependencies = [
|
||||
"pyyaml",
|
||||
"more-itertools", # TextDocumentSplitter
|
||||
"networkx", # Pipeline graphs
|
||||
"typing_extensions>=4.7", # typing support for Python 3.8
|
||||
"typing_extensions>=4.7", # typing support for Python 3.9
|
||||
"requests",
|
||||
"numpy",
|
||||
"python-dateutil",
|
||||
@ -289,7 +288,6 @@ ignore_missing_imports = true
|
||||
|
||||
[tool.ruff]
|
||||
line-length = 120
|
||||
target-version = "py38"
|
||||
exclude = [".github", "proposals"]
|
||||
|
||||
[tool.ruff.format]
|
||||
|
||||
5
releasenotes/notes/drop-python-3.8-868710963e794c83.yaml
Normal file
5
releasenotes/notes/drop-python-3.8-868710963e794c83.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
upgrade:
|
||||
- |
|
||||
Starting from Haystack 2.11.0 Python 3.8 is no longer supported.
|
||||
Python 3.8 reached its end of life on October 2024.
|
||||
@ -54,8 +54,9 @@ class TestMarkdownToDocument:
|
||||
|
||||
converter = MarkdownToDocument()
|
||||
|
||||
with patch("haystack.components.converters.markdown.normalize_metadata") as normalize_metadata, patch(
|
||||
"haystack.components.converters.markdown.MarkdownIt"
|
||||
with (
|
||||
patch("haystack.components.converters.markdown.normalize_metadata") as normalize_metadata,
|
||||
patch("haystack.components.converters.markdown.MarkdownIt"),
|
||||
):
|
||||
converter.run(sources=[bytestream, test_files_path / "markdown" / "sample.md"], meta={"language": "it"})
|
||||
|
||||
|
||||
@ -496,8 +496,9 @@ def test_pre_init_hooking_variadic_positional_args():
|
||||
assert c.kwarg1 is None
|
||||
assert c.kwarg2 == "string"
|
||||
|
||||
with pytest.raises(ComponentError), _hook_component_init(
|
||||
partial(pre_init_hook, expected_params={"args": (1, 2), "kwarg1": None})
|
||||
with (
|
||||
pytest.raises(ComponentError),
|
||||
_hook_component_init(partial(pre_init_hook, expected_params={"args": (1, 2), "kwarg1": None})),
|
||||
):
|
||||
_ = MockComponent(1, 2, kwarg1=None)
|
||||
|
||||
|
||||
@ -2,12 +2,7 @@ import pytest
|
||||
|
||||
from haystack.tools.from_function import create_tool_from_function, _remove_title_from_schema, tool
|
||||
from haystack.tools.errors import SchemaGenerationError
|
||||
from typing import Literal, Optional
|
||||
|
||||
try:
|
||||
from typing import Annotated
|
||||
except ImportError:
|
||||
from typing_extensions import Annotated
|
||||
from typing import Annotated, Literal, Optional
|
||||
|
||||
|
||||
def function_with_docstring(city: str) -> str:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user