Skip to content

Commit 05d2ffb

Browse files
committed
Replace pants with uv, reorganize python setup
1 parent 141e475 commit 05d2ffb

File tree

358 files changed

+945
-2569
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

358 files changed

+945
-2569
lines changed

.gitignore

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,4 @@ coverage.xml
3333
htmlcov
3434
*.egg-info
3535
dist
36-
37-
# Pants workspace files
38-
/.pants.d/
39-
/dist/
40-
/.pids
41-
/.pants.workdir.file_lock*
42-
pants
36+
.venv

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.12

BUILD

Lines changed: 0 additions & 2 deletions
This file was deleted.

Makefile

Lines changed: 21 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -3,73 +3,42 @@
33
help: ## Show this help.
44
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n\nTargets:\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-25s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST)
55

6-
pants: ## Installs pants launcher binary using the get-pants script. If $CI is true, assume it's installed already (through GHA), so just copy the wrapper script.
7-
ifeq ($(CI),true)
8-
cp scripts/pantsw pants
9-
else
10-
./get-pants --bin-dir .
11-
endif
126

7+
install: ## Sets up workspace (* you should run this first! *)
8+
uv sync --all-packages --all-extras
9+
cd codegen && ./gradlew
1310

14-
install-python-components: pants ## Packages and installs the python packages.
15-
./pants package ::
16-
python3 -m pip install dist/*.whl --force-reinstall
1711

18-
19-
install-java-components: ## Publishes java packages to maven local.
20-
cd codegen && ./gradlew publishToMavenLocal
21-
22-
23-
install-components: install-python-components install-java-components ## Installs java and python components locally.
24-
25-
26-
smithy-build: ## Builds the Java code generation packages.
12+
build-java: ## Builds the Java code generation packages.
2713
cd codegen && ./gradlew clean build
2814

2915

30-
generate-protocol-tests: ## Generates the protocol tests, rebuilding necessary Java packages.
16+
test-protocols: ## Generates and runs the restJson1 protocol tests.
3117
cd codegen && ./gradlew :protocol-test:build
18+
uv run pytest codegen/protocol-test/build/smithyprojections/protocol-test/rest-json-1/python-client-codegen
3219

3320

34-
run-protocol-tests: ## Runs already-generated protocol tests.
35-
cd codegen/protocol-test/build/smithyprojections/protocol-test/rest-json-1/python-client-codegen && \
36-
python3 -m pip install '.[tests]' && \
37-
python3 -m pytest tests
38-
39-
40-
test-protocols: install-python-components generate-protocol-tests run-protocol-tests ## Generates and runs protocol tests.
41-
42-
43-
lint-py: pants ## Runs formatters/fixers/linters for the python packages.
44-
./pants fix lint python-packages/smithy-core::
45-
./pants fix lint python-packages/smithy-http::
46-
./pants fix lint python-packages/smithy-aws-core::
47-
./pants fix lint python-packages/smithy-json::
48-
./pants fix lint python-packages/smithy-event-stream::
49-
./pants fix lint python-packages/aws-event-stream::
21+
lint-py: ## Runs formatters/fixers/linters for the python packages.
22+
uv run docformatter --wrap-summaries 88 --wrap-description 88 packages -r -i || true
23+
uv run ruff check packages --fix
24+
uv run ruff format packages
5025

5126

52-
check-py: pants ## Runs checkers for the python packages.
53-
./pants check python-packages/smithy-core::
54-
./pants check python-packages/smithy-http::
55-
./pants check python-packages/smithy-aws-core::
56-
./pants check python-packages/smithy-json::
57-
./pants check python-packages/smithy-event-stream::
58-
./pants check python-packages/aws-event-stream::
27+
check-py: ## Runs checkers for the python packages.
28+
uv run ruff check packages
29+
uv run pyright packages
30+
uv run bandit packages -r -x tests
5931

6032

61-
test-py: pants ## Runs tests for the python packages.
62-
./pants test python-packages/smithy-core::
63-
./pants test python-packages/smithy-http::
64-
./pants test python-packages/smithy-aws-core::
65-
./pants test python-packages/smithy-json::
66-
./pants test python-packages/smithy-event-stream::
67-
./pants test python-packages/aws-event-stream::
33+
test-py: ## Runs tests for the python packages.
34+
uv run pytest packages
6835

6936

70-
build-py: lint-py check-py test-py ## Runs formatters/fixers/linters/checkers/tests for the python packages.
37+
build-py: lint-py check-py test-py ## Builds (and lints, checks, and tests) the python packages.
38+
uv build --all-packages
7139

7240

73-
clean: ## Clean up generated code and artifacts.
74-
rm -rf dist/
41+
clean: ## Clean up workspace, generated code, and other artifacts.
42+
uv run virtualenv --clear .venv
43+
rm -r dist .pytest_cache .ruff_cache || true
7544
cd codegen && ./gradlew clean

get-pants

Lines changed: 0 additions & 221 deletions
This file was deleted.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[project]
2+
name = "aws-event-stream"
3+
version = "0.1.0"
4+
description = "Add your description here"
5+
readme = "README.md"
6+
authors = [
7+
{ name = "Hayden Baker", email = "[email protected]" }
8+
]
9+
requires-python = ">=3.12"
10+
dependencies = [
11+
"smithy-core",
12+
"smithy-event-stream",
13+
]
14+
15+
[build-system]
16+
requires = ["hatchling"]
17+
build-backend = "hatchling.build"

0 commit comments

Comments
 (0)