Skip to content

Commit 500d01a

Browse files
authored
fix: Clean up pyproject.toml (#844)
1 parent 066a427 commit 500d01a

File tree

3 files changed

+92
-130
lines changed

3 files changed

+92
-130
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ repos:
33
hooks:
44
- id: hatch-format
55
name: Format code
6-
entry: hatch fmt --formatter
6+
entry: hatch run test-format
77
language: system
88
pass_filenames: false
99
types: [python]
@@ -15,13 +15,6 @@ repos:
1515
pass_filenames: false
1616
types: [python]
1717
stages: [pre-commit]
18-
- id: hatch-test-lint
19-
name: Type linting
20-
entry: hatch run test-lint
21-
language: system
22-
pass_filenames: false
23-
types: [ python ]
24-
stages: [ pre-commit ]
2518
- id: hatch-test
2619
name: Unit tests
2720
entry: hatch test

CONTRIBUTING.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,7 @@ This project uses [hatchling](https://hatch.pypa.io/latest/build/#hatchling) as
4444

4545
1. Entering virtual environment using `hatch` (recommended), then launch your IDE in the new shell.
4646
```bash
47-
hatch shell dev
48-
```
49-
50-
Alternatively, install development dependencies in a manually created virtual environment:
51-
```bash
52-
pip install -e ".[all]"
47+
hatch shell
5348
```
5449

5550

@@ -73,6 +68,10 @@ This project uses [hatchling](https://hatch.pypa.io/latest/build/#hatchling) as
7368
```bash
7469
hatch test
7570
```
71+
Or run them with coverage:
72+
```bash
73+
hatch test -c
74+
```
7675

7776
6. Run integration tests:
7877
```bash

pyproject.toml

Lines changed: 86 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
requires = ["hatchling", "hatch-vcs"]
33
build-backend = "hatchling.build"
44

5+
56
[project]
67
name = "strands-agents"
7-
dynamic = ["version"]
8+
dynamic = ["version"] # Version determined by git tags
89
description = "A model-driven approach to building AI agents in just a few lines of code"
910
readme = "README.md"
1011
requires-python = ">=3.10"
@@ -38,65 +39,25 @@ dependencies = [
3839
"opentelemetry-instrumentation-threading>=0.51b0,<1.00b0",
3940
]
4041

41-
[project.urls]
42-
Homepage = "https://github.com/strands-agents/sdk-python"
43-
"Bug Tracker" = "https://github.com/strands-agents/sdk-python/issues"
44-
Documentation = "https://strandsagents.com"
45-
46-
[tool.hatch.build.targets.wheel]
47-
packages = ["src/strands"]
4842

4943
[project.optional-dependencies]
50-
anthropic = [
51-
"anthropic>=0.21.0,<1.0.0",
52-
]
53-
dev = [
54-
"commitizen>=4.4.0,<5.0.0",
55-
"hatch>=1.0.0,<2.0.0",
56-
"moto>=5.1.0,<6.0.0",
57-
"mypy>=1.15.0,<2.0.0",
58-
"pre-commit>=3.2.0,<4.4.0",
59-
"pytest>=8.0.0,<9.0.0",
60-
"pytest-cov>=6.0.0,<7.0.0",
61-
"pytest-asyncio>=1.0.0,<1.2.0",
62-
"pytest-xdist>=3.0.0,<4.0.0",
63-
"ruff>=0.12.0,<0.14.0",
44+
anthropic = ["anthropic>=0.21.0,<1.0.0"]
45+
litellm = ["litellm>=1.75.9,<2.0.0", "openai>=1.68.0,<1.108.0"]
46+
llamaapi = ["llama-api-client>=0.1.0,<1.0.0"]
47+
mistral = ["mistralai>=1.8.2"]
48+
ollama = ["ollama>=0.4.8,<1.0.0"]
49+
openai = ["openai>=1.68.0,<2.0.0"]
50+
writer = ["writer-sdk>=2.2.0,<3.0.0"]
51+
sagemaker = [
52+
"boto3-stubs[sagemaker-runtime]>=1.26.0,<2.0.0",
53+
"openai>=1.68.0,<2.0.0", # SageMaker uses OpenAI-compatible interface
6454
]
55+
otel = ["opentelemetry-exporter-otlp-proto-http>=1.30.0,<2.0.0"]
6556
docs = [
6657
"sphinx>=5.0.0,<6.0.0",
6758
"sphinx-rtd-theme>=1.0.0,<2.0.0",
6859
"sphinx-autodoc-typehints>=1.12.0,<2.0.0",
6960
]
70-
litellm = [
71-
"litellm>=1.75.9,<2.0.0",
72-
"openai>=1.68.0,<1.108.0",
73-
]
74-
llamaapi = [
75-
"llama-api-client>=0.1.0,<1.0.0",
76-
]
77-
mistral = [
78-
"mistralai>=1.8.2",
79-
]
80-
ollama = [
81-
"ollama>=0.4.8,<1.0.0",
82-
]
83-
openai = [
84-
"openai>=1.68.0,<2.0.0",
85-
]
86-
otel = [
87-
"opentelemetry-exporter-otlp-proto-http>=1.30.0,<2.0.0",
88-
]
89-
writer = [
90-
"writer-sdk>=2.2.0,<3.0.0"
91-
]
92-
93-
sagemaker = [
94-
"boto3>=1.26.0,<2.0.0",
95-
"botocore>=1.29.0,<2.0.0",
96-
"boto3-stubs[sagemaker-runtime]>=1.26.0,<2.0.0",
97-
# uses OpenAI as part of the implementation
98-
"openai>=1.68.0,<2.0.0",
99-
]
10061

10162
a2a = [
10263
"a2a-sdk>=0.3.0,<0.4.0",
@@ -106,22 +67,46 @@ a2a = [
10667
"fastapi>=0.115.12,<1.0.0",
10768
"starlette>=0.46.2,<1.0.0",
10869
]
109-
all = [
110-
"strands-agents[a2a,anthropic,dev,docs,litellm,llamaapi,mistral,ollama,openai,otel]",
70+
all = ["strands-agents[a2a,anthropic,docs,litellm,llamaapi,mistral,ollama,openai,writer,sagemaker,otel]"]
71+
72+
dev = [
73+
"commitizen>=4.4.0,<5.0.0",
74+
"hatch>=1.0.0,<2.0.0",
75+
"moto>=5.1.0,<6.0.0",
76+
"mypy>=1.15.0,<2.0.0",
77+
"pre-commit>=3.2.0,<4.4.0",
78+
"pytest>=8.0.0,<9.0.0",
79+
"pytest-cov>=7.0.0,<8.0.0",
80+
"pytest-asyncio>=1.0.0,<1.2.0",
81+
"pytest-xdist>=3.0.0,<4.0.0",
82+
"ruff>=0.13.0,<0.14.0",
11183
]
11284

85+
[project.urls]
86+
Homepage = "https://github.com/strands-agents/sdk-python"
87+
"Bug Tracker" = "https://github.com/strands-agents/sdk-python/issues"
88+
Documentation = "https://strandsagents.com"
89+
90+
91+
[tool.hatch.build.targets.wheel]
92+
packages = ["src/strands"]
93+
94+
11395
[tool.hatch.version]
114-
# Tells Hatch to use your version control system (git) to determine the version.
115-
source = "vcs"
96+
source = "vcs" # Use git tags for versioning
97+
11698

11799
[tool.hatch.envs.hatch-static-analysis]
118-
features = ["anthropic", "litellm", "llamaapi", "ollama", "openai", "otel", "mistral", "writer", "a2a", "sagemaker"]
100+
installer = "uv"
101+
features = ["all"]
119102
dependencies = [
120103
"mypy>=1.15.0,<2.0.0",
121-
"ruff>=0.11.6,<0.12.0",
104+
"ruff>=0.13.0,<0.14.0",
105+
# Include required pacakge dependencies for mypy
122106
"strands-agents @ {root:uri}",
123107
]
124108

109+
# Define static-analysis scripts so we can include mypy as part of the linting check
125110
[tool.hatch.envs.hatch-static-analysis.scripts]
126111
format-check = [
127112
"ruff format --check"
@@ -137,65 +122,54 @@ lint-fix = [
137122
"ruff check --fix"
138123
]
139124

125+
140126
[tool.hatch.envs.hatch-test]
141-
features = ["anthropic", "litellm", "llamaapi", "ollama", "openai", "otel", "mistral", "writer", "a2a", "sagemaker"]
142-
extra-dependencies = [
143-
"moto>=5.1.0,<6.0.0",
127+
installer = "uv"
128+
features = ["all"]
129+
extra-args = ["-n", "auto", "-vv"]
130+
dependencies = [
144131
"pytest>=8.0.0,<9.0.0",
145-
"pytest-cov>=6.0.0,<7.0.0",
132+
"pytest-cov>=7.0.0,<8.0.0",
146133
"pytest-asyncio>=1.0.0,<1.2.0",
147134
"pytest-xdist>=3.0.0,<4.0.0",
135+
"moto>=5.1.0,<6.0.0",
148136
]
149-
extra-args = [
150-
"-n",
151-
"auto",
152-
"-vv",
153-
]
154-
155-
[tool.hatch.envs.dev]
156-
dev-mode = true
157-
features = ["dev", "docs", "anthropic", "litellm", "llamaapi", "ollama", "otel", "mistral", "writer", "a2a", "sagemaker"]
158137

159138
[[tool.hatch.envs.hatch-test.matrix]]
160139
python = ["3.13", "3.12", "3.11", "3.10"]
161140

162141
[tool.hatch.envs.hatch-test.scripts]
163-
run = [
164-
"pytest{env:HATCH_TEST_ARGS:} {args}"
165-
]
166-
run-cov = [
167-
"pytest{env:HATCH_TEST_ARGS:} --cov --cov-config=pyproject.toml {args}"
168-
]
169-
142+
run = "pytest{env:HATCH_TEST_ARGS:} {args}" # Run with: hatch test
143+
run-cov = "pytest{env:HATCH_TEST_ARGS:} {args} --cov --cov-config=pyproject.toml --cov-report html --cov-report xml {args}" # Run with: hatch test -c
170144
cov-combine = []
171145
cov-report = []
172146

173147

174-
[tool.hatch.envs.default.scripts]
175-
list = [
176-
"echo 'Scripts commands available for default env:'; hatch env show --json | jq --raw-output '.default.scripts | keys[]'"
177-
]
178-
format = [
179-
"hatch fmt --formatter",
180-
]
181-
test-format = [
182-
"hatch fmt --formatter --check",
183-
]
184-
lint = [
185-
"hatch fmt --linter"
186-
]
187-
test-lint = [
188-
"hatch fmt --linter --check"
189-
]
190-
test = [
191-
"hatch test --cover --cov-report html --cov-report xml {args}"
192-
]
193-
test-integ = [
194-
"hatch test tests_integ {args}"
148+
[tool.hatch.envs.default]
149+
installer = "uv"
150+
dev-mode = true
151+
features = ["all"]
152+
dependencies = [
153+
"commitizen>=4.4.0,<5.0.0",
154+
"hatch>=1.0.0,<2.0.0",
155+
"pre-commit>=3.2.0,<4.4.0",
195156
]
157+
158+
159+
[tool.hatch.envs.default.scripts]
160+
list = "echo 'Scripts commands available for default env:'; hatch env show --json | jq --raw-output '.default.scripts | keys[]'"
161+
162+
format = "hatch fmt --formatter"
163+
test-format = "hatch fmt --formatter --check"
164+
165+
lint = "hatch fmt --linter"
166+
test-lint = "hatch fmt --linter --check"
167+
168+
test = "hatch test {args}"
169+
test-integ = "hatch test tests_integ {args}"
170+
196171
prepare = [
197-
"hatch fmt --formatter",
198-
"hatch fmt --linter",
172+
"hatch run test-format",
199173
"hatch run test-lint",
200174
"hatch test --all"
201175
]
@@ -216,22 +190,19 @@ warn_unreachable = true
216190
follow_untyped_imports = true
217191
ignore_missing_imports = false
218192

219-
[[tool.mypy.overrides]]
220-
module = "litellm"
221-
ignore_missing_imports = true
222193

223194
[tool.ruff]
224195
line-length = 120
225196
include = ["examples/**/*.py", "src/**/*.py", "tests/**/*.py", "tests_integ/**/*.py"]
226197

227198
[tool.ruff.lint]
228199
select = [
229-
"B", # flake8-bugbear
230-
"D", # pydocstyle
231-
"E", # pycodestyle
232-
"F", # pyflakes
233-
"G", # logging format
234-
"I", # isort
200+
"B", # flake8-bugbear
201+
"D", # pydocstyle
202+
"E", # pycodestyle
203+
"F", # pyflakes
204+
"G", # logging format
205+
"I", # isort
235206
"LOG", # logging
236207
]
237208

@@ -241,12 +212,12 @@ select = [
241212
[tool.ruff.lint.pydocstyle]
242213
convention = "google"
243214

215+
244216
[tool.pytest.ini_options]
245-
testpaths = [
246-
"tests"
247-
]
217+
testpaths = ["tests"]
248218
asyncio_default_fixture_loop_scope = "function"
249219

220+
250221
[tool.coverage.run]
251222
branch = true
252223
source = ["src"]
@@ -263,13 +234,12 @@ directory = "build/coverage/html"
263234
[tool.coverage.xml]
264235
output = "build/coverage/coverage.xml"
265236

237+
266238
[tool.commitizen]
267239
name = "cz_conventional_commits"
268240
tag_format = "v$version"
269241
bump_message = "chore(release): bump version $current_version -> $new_version"
270-
version_files = [
271-
"pyproject.toml:version",
272-
]
242+
version_files = ["pyproject.toml:version"]
273243
update_changelog_on_bump = true
274244
style = [
275245
["qmark", "fg:#ff9d00 bold"],

0 commit comments

Comments
 (0)