@@ -7,7 +7,60 @@ SMITHY_PYTHON ?= ../smithy-python
77# Clients per gradle build in `make clients`; lower it if the build runs out of heap.
88BATCH_SIZE ?= 25
99
10- .PHONY : docs docs-serve docs-clean docs-install docs-lock venv gen clients publish-codegen aio-check
10+ .PHONY : docs docs-serve docs-clean docs-install docs-lock venv gen clients publish-codegen aio-check static-analysis test-unit test-functional test-integration
11+
12+ # Each client and package runs in its own .venv. Dependencies outside this repo,
13+ # including smithy-python, resolve from PyPI at the versions each one declares.
14+ PROJECTS := $(patsubst % /pyproject.toml,% ,$(wildcard clients/* /pyproject.toml packages/* /pyproject.toml) )
15+ RUFF_VERSION := 0.15.22
16+ PYRIGHT_VERSION := 1.1.406
17+ UV_RUN = uv run --python $(PYTHON_VERSION ) --project
18+
19+ # Q Business is sunsetting; new application creation is unavailable.
20+ INTEGRATION_SKIP := clients/aws-sdk-qbusiness
21+
22+ static-analysis :
23+ @set -e; for p in $( PROJECTS) ; do \
24+ dirs=$$(ls -d $$p/src $$p/tests 2>/dev/null || true ) ; \
25+ group=$$(grep -q '^test = \[' $$p/pyproject.toml && echo --group test || true ) ; \
26+ echo " == $$ p" ; \
27+ uvx ruff@$(RUFF_VERSION ) check --config $$ p/pyproject.toml $$ dirs; \
28+ uvx ruff@$(RUFF_VERSION ) format --check --config $$ p/pyproject.toml $$ dirs; \
29+ $(UV_RUN ) $$ p $$ group --with pyright==$(PYRIGHT_VERSION ) pyright -p $$ p $$ dirs; \
30+ done
31+ # TODO: enable once aws-credentials-sts passes the aio naming rules.
32+ # $(MAKE) aio-check
33+
34+ test-unit :
35+ @set -e; for p in $( PROJECTS) ; do \
36+ [ -d $$ p/tests/unit ] || continue ; \
37+ echo " == $$ p" ; \
38+ $(UV_RUN ) $$ p --group test pytest $$ p/tests/unit; \
39+ done
40+
41+ test-functional :
42+ # pytest exits 5 when a generated protocol test file has no cases.
43+ @set -e; for p in $( PROJECTS) ; do \
44+ [ -n " $$ (find $$ p/tests -name 'test_*.py' -not -path '*/tests/unit/*' -not -path '*/tests/integration/*' 2>/dev/null)" ] || continue ; \
45+ echo " == $$ p" ; \
46+ $(UV_RUN ) $$ p --group test pytest $$ p/tests --ignore=$$ p/tests/unit --ignore=$$ p/tests/integration || [ $$ ? -eq 5 ]; \
47+ done
48+
49+ # Calls live services, so it needs AWS credentials.
50+ test-integration :
51+ @set -e; for p in $( filter-out $( INTEGRATION_SKIP) ,$( PROJECTS) ) ; do \
52+ [ -d $$ p/tests/integration ] || continue ; \
53+ echo " == $$ p" ; \
54+ $(UV_RUN ) $$ p --group test --all-extras pytest $$ p/tests/integration; \
55+ done
56+
57+ # Regenerate every client from codegen/aws-models with codegen built from the
58+ # smithy-python commit in codegen/smithy-python.toml. Each client is cleared first,
59+ # keeping only the paths in gen_client.py's KEEP, then scripts/client-overlays is applied.
60+ clients :
61+ SMITHY_PYTHON=$(abspath $(SMITHY_PYTHON ) ) uv run python codegen/gen_client.py --all --pinned --batch-size $(BATCH_SIZE )
62+
63+ # ######################### Granular targets below ##########################
1164
1265# Publishes the smithy-python codegen jars to the local Maven cache so `gen`
1366# can resolve them. Run once, and again whenever the generator changes.
@@ -19,12 +72,6 @@ publish-codegen:
1972gen :
2073 SMITHY_PYTHON=$(abspath $(SMITHY_PYTHON ) ) uv run python codegen/gen_client.py $(filter-out gen,$(MAKECMDGOALS ) )
2174
22- # Regenerate every client from codegen/aws-models with codegen built from the
23- # smithy-python commit in codegen/smithy-python.toml. Each client is cleared first,
24- # keeping only the paths in gen_client.py's KEEP, then scripts/client-overlays is applied.
25- clients :
26- SMITHY_PYTHON=$(abspath $(SMITHY_PYTHON ) ) uv run python codegen/gen_client.py --all --pinned --batch-size $(BATCH_SIZE )
27-
2875# Swallow the client-name argument so make does not treat it as a target.
2976# Scoped to `gen` so it does not mask typos in unrelated commands.
3077ifeq (gen,$(firstword $(MAKECMDGOALS ) ) )
0 commit comments