Skip to content

Commit 07f92d4

Browse files
committed
fix: Clean up pyproject.toml
1 parent bf4e3e4 commit 07f92d4

File tree

3 files changed

+80
-131
lines changed

3 files changed

+80
-131
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: 74 additions & 117 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,66 +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.13.0",
44+
anthropic = ["anthropic>=0.21.0,<1.0.0"]
45+
litellm = ["litellm>=1.75.9,<2.0.0", "openai>=1.68.0,<1.102.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.102.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-
]
100-
10161
a2a = [
10262
"a2a-sdk>=0.3.0,<0.4.0",
10363
"a2a-sdk[sql]>=0.3.0,<0.4.0",
@@ -106,22 +66,34 @@ a2a = [
10666
"fastapi>=0.115.12,<1.0.0",
10767
"starlette>=0.46.2,<1.0.0",
10868
]
109-
all = [
110-
"strands-agents[a2a,anthropic,dev,docs,litellm,llamaapi,mistral,ollama,openai,otel]",
111-
]
69+
all = ["strands-agents[a2a,anthropic,docs,litellm,llamaapi,mistral,ollama,openai,writer,sagemaker,otel]"]
70+
71+
72+
[project.urls]
73+
Homepage = "https://github.com/strands-agents/sdk-python"
74+
"Bug Tracker" = "https://github.com/strands-agents/sdk-python/issues"
75+
Documentation = "https://strandsagents.com"
76+
77+
78+
[tool.hatch.build.targets.wheel]
79+
packages = ["src/strands"]
80+
11281

11382
[tool.hatch.version]
114-
# Tells Hatch to use your version control system (git) to determine the version.
115-
source = "vcs"
83+
source = "vcs" # Use git tags for versioning
84+
11685

11786
[tool.hatch.envs.hatch-static-analysis]
118-
features = ["anthropic", "litellm", "llamaapi", "ollama", "openai", "otel", "mistral", "writer", "a2a", "sagemaker"]
87+
installer = "uv"
88+
features = ["all"]
11989
dependencies = [
12090
"mypy>=1.15.0,<2.0.0",
12191
"ruff>=0.11.6,<0.12.0",
92+
# Include required pacakge dependencies for mypy
12293
"strands-agents @ {root:uri}",
12394
]
12495

96+
# Define static-analysis scripts so we can include mypy as part of the linting check
12597
[tool.hatch.envs.hatch-static-analysis.scripts]
12698
format-check = [
12799
"ruff format --check"
@@ -137,65 +109,54 @@ lint-fix = [
137109
"ruff check --fix"
138110
]
139111

112+
140113
[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",
114+
installer = "uv"
115+
features = ["all"]
116+
extra-args = ["-n", "auto", "-vv"]
117+
dependencies = [
144118
"pytest>=8.0.0,<9.0.0",
145-
"pytest-cov>=6.0.0,<7.0.0",
119+
"pytest-cov>=7.0.0,<8.0.0",
146120
"pytest-asyncio>=1.0.0,<1.2.0",
147121
"pytest-xdist>=3.0.0,<4.0.0",
148-
]
149-
extra-args = [
150-
"-n",
151-
"auto",
152-
"-vv",
122+
"moto>=5.1.0,<6.0.0",
153123
]
154124

155-
[tool.hatch.envs.dev]
156-
dev-mode = true
157-
features = ["dev", "docs", "anthropic", "litellm", "llamaapi", "ollama", "otel", "mistral", "writer", "a2a", "sagemaker"]
158-
159125
[[tool.hatch.envs.hatch-test.matrix]]
160126
python = ["3.13", "3.12", "3.11", "3.10"]
161127

162128
[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-
129+
run = "pytest{env:HATCH_TEST_ARGS:} {args}" # Run with: hatch test
130+
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
170131
cov-combine = []
171132
cov-report = []
172133

173134

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}"
135+
[tool.hatch.envs.default]
136+
installer = "uv"
137+
dev-mode = true
138+
features = ["all"]
139+
dependencies = [
140+
"commitizen>=4.4.0,<5.0.0",
141+
"hatch>=1.0.0,<2.0.0",
142+
"pre-commit>=3.2.0,<4.4.0",
195143
]
144+
145+
146+
[tool.hatch.envs.default.scripts]
147+
list = "echo 'Scripts commands available for default env:'; hatch env show --json | jq --raw-output '.default.scripts | keys[]'"
148+
149+
format = "hatch fmt --formatter"
150+
test-format = "hatch fmt --formatter --check"
151+
152+
lint = "hatch fmt --linter"
153+
test-lint = "hatch fmt --linter --check"
154+
155+
test = "hatch test {args}"
156+
test-integ = "hatch test tests_integ {args}"
157+
196158
prepare = [
197-
"hatch fmt --formatter",
198-
"hatch fmt --linter",
159+
"hatch run test-format",
199160
"hatch run test-lint",
200161
"hatch test --all"
201162
]
@@ -216,22 +177,19 @@ warn_unreachable = true
216177
follow_untyped_imports = true
217178
ignore_missing_imports = false
218179

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

223181
[tool.ruff]
224182
line-length = 120
225183
include = ["examples/**/*.py", "src/**/*.py", "tests/**/*.py", "tests_integ/**/*.py"]
226184

227185
[tool.ruff.lint]
228186
select = [
229-
"B", # flake8-bugbear
230-
"D", # pydocstyle
231-
"E", # pycodestyle
232-
"F", # pyflakes
233-
"G", # logging format
234-
"I", # isort
187+
"B", # flake8-bugbear
188+
"D", # pydocstyle
189+
"E", # pycodestyle
190+
"F", # pyflakes
191+
"G", # logging format
192+
"I", # isort
235193
"LOG", # logging
236194
]
237195

@@ -241,12 +199,12 @@ select = [
241199
[tool.ruff.lint.pydocstyle]
242200
convention = "google"
243201

202+
244203
[tool.pytest.ini_options]
245-
testpaths = [
246-
"tests"
247-
]
204+
testpaths = ["tests"]
248205
asyncio_default_fixture_loop_scope = "function"
249206

207+
250208
[tool.coverage.run]
251209
branch = true
252210
source = ["src"]
@@ -263,13 +221,12 @@ directory = "build/coverage/html"
263221
[tool.coverage.xml]
264222
output = "build/coverage/coverage.xml"
265223

224+
266225
[tool.commitizen]
267226
name = "cz_conventional_commits"
268227
tag_format = "v$version"
269228
bump_message = "chore(release): bump version $current_version -> $new_version"
270-
version_files = [
271-
"pyproject.toml:version",
272-
]
229+
version_files = ["pyproject.toml:version"]
273230
update_changelog_on_bump = true
274231
style = [
275232
["qmark", "fg:#ff9d00 bold"],

0 commit comments

Comments
 (0)