Skip to content

Commit 527e828

Browse files
authored
chore!: bump minimum Python version to 3.11 (#81)
* chore!: bump minimum Python version to 3.11 BREAKING CHANGE: Drop support for Python 3.9 and 3.10. This change: - Updates requires-python from >=3.9 to >=3.11 - Removes Python 3.9 and 3.10 from CI matrix and classifiers - Removes eval-type-backport dependency (only needed for Python <3.10) - Removes python_version conditions from mcp and crewai dependencies - Updates ruff target-version from py39 to py311 - Updates README requirements section Python 3.11 is now the minimum supported version, allowing the use of modern typing features and simplifying dependency management. * chore(deps): update lockfile for Python 3.11+ changes Regenerate uv.lock after removing eval-type-backport and updating python_version conditions in optional dependencies. * fix(lint): add strict=True to zip() calls for Python 3.11+ Ruff B905 rule requires explicit strict= parameter for zip() when targeting Python 3.11+. Using strict=True ensures both iterables have the same length, which is the expected behaviour in these cases. * refactor(models): use Python 3.11+ stdlib features - Import TypeAlias from typing instead of typing_extensions - Use datetime.UTC instead of datetime.timezone.utc - Remove obsolete TODO comments about Python 3.9 support
1 parent d583d37 commit 527e828

File tree

7 files changed

+263
-1487
lines changed

7 files changed

+263
-1487
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,9 @@ jobs:
3434
runs-on: ubuntu-latest
3535
strategy:
3636
matrix:
37-
python-version: ["3.9", "3.10", "3.13"]
37+
python-version: ["3.11", "3.13"]
3838
include:
39-
- python-version: "3.9"
40-
sync-extras: "--all-extras --no-extra mcp"
41-
- python-version: "3.10"
39+
- python-version: "3.11"
4240
sync-extras: "--all-extras"
4341
- python-version: "3.13"
4442
sync-extras: "--all-extras"

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ StackOne AI provides a unified interface for accessing various SaaS tools throug
2525

2626
## Requirements
2727

28-
- Python 3.10+ (MCP extra required for `fetch_tools()`)
28+
- Python 3.11+
2929

3030
## Installation
3131

@@ -265,12 +265,10 @@ _ = app.invoke({"messages": [("user", "Get employee with id emp123") ]})
265265
</details>
266266

267267
<details>
268-
<summary>CrewAI Integration (Python 3.10+)</summary>
268+
<summary>CrewAI Integration</summary>
269269

270270
CrewAI uses LangChain tools natively, making integration seamless:
271271

272-
> **Note**: CrewAI requires Python 3.10+. Install with `pip install 'stackone-ai[mcp,examples]'`
273-
274272
```python
275273
from crewai import Agent, Crew, Task
276274
from stackone_ai import StackOneToolSet

pyproject.toml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "stackone-ai"
33
version = "0.3.4"
44
description = "agents performing actions on your SaaS"
55
readme = "README.md"
6-
requires-python = ">=3.9"
6+
requires-python = ">=3.11"
77
authors = [
88
{ name = "StackOne", email = "[email protected]" }
99
]
@@ -12,8 +12,6 @@ classifiers = [
1212
"Intended Audience :: Developers",
1313
"License :: OSI Approved :: MIT License",
1414
"Programming Language :: Python :: 3",
15-
"Programming Language :: Python :: 3.9",
16-
"Programming Language :: Python :: 3.10",
1715
"Programming Language :: Python :: 3.11",
1816
"Programming Language :: Python :: 3.12",
1917
"Programming Language :: Python :: 3.13",
@@ -26,7 +24,6 @@ dependencies = [
2624
"bm25s>=0.2.2",
2725
"numpy>=1.24.0",
2826
"typing-extensions>=4.0.0",
29-
"eval-type-backport; python_version<'3.10'", # TODO: Remove when Python 3.9 support is dropped
3027
]
3128

3229
[build-system]
@@ -43,12 +40,11 @@ packages = ["stackone_ai"]
4340
"py.typed" = "py.typed"
4441

4542
[project.optional-dependencies]
46-
# TODO: Remove python_version conditions when Python 3.9 support is dropped
4743
mcp = [
48-
"mcp>=1.3.0; python_version>='3.10'",
44+
"mcp>=1.3.0",
4945
]
5046
examples = [
51-
"crewai>=0.102.0; python_version>='3.10'",
47+
"crewai>=0.102.0",
5248
"langchain-openai>=0.3.6",
5349
"langgraph>=0.2.0",
5450
"openai>=1.63.2",
@@ -82,7 +78,7 @@ markers = [
8278

8379
[tool.ruff]
8480
line-length = 110
85-
target-version = "py39"
81+
target-version = "py311"
8682

8783
[tool.ruff.lint]
8884
select = [

stackone_ai/meta_tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def search(self, query: str, limit: int = 5, min_score: float = 0.0) -> list[Met
122122
score_map: dict[str, dict[str, float]] = {}
123123

124124
# Add BM25 scores
125-
for idx, score in zip(bm25_results[0], bm25_scores[0]):
125+
for idx, score in zip(bm25_results[0], bm25_scores[0], strict=True):
126126
tool_name = self.tool_names[idx]
127127
# Normalize BM25 score to 0-1 range
128128
normalized_score = float(1 / (1 + np.exp(-score / 10)))

stackone_ai/models.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,18 @@
1-
# TODO: Remove when Python 3.9 support is dropped
21
from __future__ import annotations
32

43
import base64
54
import json
65
import logging
76
from collections.abc import Sequence
8-
from datetime import datetime, timezone
7+
from datetime import UTC, datetime
98
from enum import Enum
10-
from typing import Annotated, Any, ClassVar, cast
9+
from typing import Annotated, Any, ClassVar, TypeAlias, cast
1110
from urllib.parse import quote
1211

1312
import httpx
1413
from langchain_core.tools import BaseTool
1514
from pydantic import BaseModel, BeforeValidator, Field, PrivateAttr
1615

17-
# TODO: Remove when Python 3.9 support is dropped
18-
from typing_extensions import TypeAlias
19-
2016
# Type aliases for common types
2117
JsonDict: TypeAlias = dict[str, Any]
2218
Headers: TypeAlias = dict[str, str]
@@ -200,7 +196,7 @@ def execute(
200196
StackOneAPIError: If the API request fails
201197
ValueError: If the arguments are invalid
202198
"""
203-
datetime.now(timezone.utc)
199+
datetime.now(UTC)
204200
feedback_options: JsonDict = {}
205201
result_payload: JsonDict | None = None
206202
response_status: int | None = None
@@ -270,7 +266,7 @@ def execute(
270266
status = "error"
271267
raise StackOneError(f"Request failed: {exc}") from exc
272268
finally:
273-
datetime.now(timezone.utc)
269+
datetime.now(UTC)
274270
metadata: JsonDict = {
275271
"http_method": self._execute_config.method,
276272
"url": url_used,

stackone_ai/utils/tfidf_index.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def build(self, corpus: list[TfidfDocument]) -> None:
138138

139139
# Build document vectors
140140
self.docs = []
141-
for doc, tokens in zip(corpus, docs_tokens):
141+
for doc, tokens in zip(corpus, docs_tokens, strict=True):
142142
# Compute term frequency (TF)
143143
tf: dict[int, int] = {}
144144
for token in tokens:

0 commit comments

Comments
 (0)