Skip to content

Commit eb60f11

Browse files
committed
refactor: use uv and poe for everything
1 parent 8b1de4d commit eb60f11

File tree

7 files changed

+3777
-223
lines changed

7 files changed

+3777
-223
lines changed

.github/workflows/integration-test.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,17 @@ jobs:
6060
uses: actions/setup-python@v5
6161
with:
6262
python-version: '3.10'
63-
- name: Install dependencies
64-
run: |
65-
pip install --no-cache-dir hatch
63+
- name: Install uv
64+
uses: astral-sh/setup-uv@v4
65+
with:
66+
enable-cache: true
67+
- name: Sync dependencies from lock file
68+
run: uv sync --dev
6669
- name: Run integration tests
6770
env:
6871
AWS_REGION: us-east-1
6972
AWS_REGION_NAME: us-east-1 # Needed for LiteLLM
7073
STRANDS_TEST_API_KEYS_SECRET_NAME: ${{ secrets.STRANDS_TEST_API_KEYS_SECRET_NAME }}
7174
id: tests
7275
run: |
73-
hatch test tests_integ
76+
uv run poe test-integ

.github/workflows/pypi-publish-on-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
- name: Install dependencies
3535
run: |
3636
python -m pip install --upgrade pip
37-
pip install hatch twine
37+
pip install hatch twine # Keep hatch for versioning and building
3838
3939
- name: Validate version
4040
run: |

.github/workflows/test-lint.yml

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,15 @@ jobs:
5959
uses: actions/setup-python@v5
6060
with:
6161
python-version: ${{ matrix.python-version }}
62-
- name: Install dependencies
63-
run: |
64-
pip install --no-cache-dir hatch
62+
- name: Install uv
63+
uses: astral-sh/setup-uv@v4
64+
with:
65+
enable-cache: true
66+
- name: Sync dependencies from lock file
67+
run: uv sync --dev
6568
- name: Run Unit tests
6669
id: tests
67-
run: hatch test tests --cover
70+
run: uv run poe test-cov
6871
continue-on-error: false
6972
lint:
7073
name: Lint
@@ -82,13 +85,16 @@ jobs:
8285
uses: actions/setup-python@v5
8386
with:
8487
python-version: '3.10'
85-
cache: 'pip'
8688

87-
- name: Install dependencies
88-
run: |
89-
pip install --no-cache-dir hatch
89+
- name: Install uv
90+
uses: astral-sh/setup-uv@v4
91+
with:
92+
enable-cache: true
93+
94+
- name: Sync dependencies from lock file
95+
run: uv sync --dev
9096

9197
- name: Run lint
9298
id: lint
93-
run: hatch run test-lint
99+
run: uv run poe lint-check
94100
continue-on-error: false

.pre-commit-config.yaml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
11
repos:
22
- repo: local
33
hooks:
4-
- id: hatch-format
5-
name: Format code
6-
entry: hatch fmt --formatter
4+
- id: format-check
5+
name: Check code formatting
6+
entry: uv run poe format-check
77
language: system
88
pass_filenames: false
99
types: [python]
1010
stages: [pre-commit]
11-
- id: hatch-lint
12-
name: Lint code
13-
entry: hatch run test-lint
11+
- id: lint-check
12+
name: Check code linting
13+
entry: uv run poe lint-check
1414
language: system
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
18+
- id: typecheck
19+
name: Type checking
20+
entry: uv run poe typecheck
2121
language: system
2222
pass_filenames: false
23-
types: [ python ]
24-
stages: [ pre-commit ]
25-
- id: hatch-test
23+
types: [python]
24+
stages: [pre-commit]
25+
- id: test
2626
name: Unit tests
27-
entry: hatch test
27+
entry: uv run poe test
2828
language: system
2929
pass_filenames: false
3030
types: [python]
3131
stages: [pre-commit]
3232
- id: commitizen-check
3333
name: Check commit message
34-
entry: hatch run cz check --commit-msg-file
34+
entry: uv run cz check --commit-msg-file
3535
language: system
36-
stages: [commit-msg]
36+
stages: [commit-msg]

CONTRIBUTING.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,67 @@ You can check:
130130
- Feature requests in [Feature Requests](../../issues?q=is%3Aissue%20state%3Aopen%20label%3Aenhancement) for new functionality to implement
131131

132132

133+
## Dependency Management with uv lock
134+
135+
This project uses `uv lock` to ensure reproducible dependency resolution across all environments. The `uv.lock` file contains exact versions of all dependencies and **must be committed to git**.
136+
137+
### For Developers
138+
139+
**Initial Setup:**
140+
```bash
141+
# Install exact dependencies from lock file
142+
uv sync --dev
143+
```
144+
145+
**Daily Development:**
146+
```bash
147+
# Use locked dependencies for all commands
148+
uv run poe test
149+
uv run poe lint
150+
uv run poe format
151+
```
152+
153+
**Adding New Dependencies:**
154+
```bash
155+
# Add new dependency and update lock file
156+
uv add "new-package>=1.0.0"
157+
# The lock file is automatically updated
158+
git add pyproject.toml uv.lock
159+
git commit -m "feat: add new-package dependency"
160+
```
161+
162+
**Updating Dependencies:**
163+
```bash
164+
# Update to latest compatible versions
165+
uv lock
166+
167+
# Or upgrade to latest versions (major updates)
168+
uv lock --upgrade
169+
170+
# Always commit lock file changes
171+
git add uv.lock
172+
git commit -m "chore: update dependencies"
173+
```
174+
175+
### Why Lock Files Matter
176+
177+
- **Reproducible Builds**: Same exact dependencies across dev, CI, and production
178+
- **Faster CI**: Pre-resolved dependencies eliminate resolution time
179+
- **Security**: Pinned versions prevent supply chain attacks
180+
- **Team Consistency**: Everyone gets identical dependency trees
181+
182+
### Lock File Commands
183+
184+
| Command | Purpose |
185+
|---------|---------|
186+
| `uv sync --dev` | Install exact dependencies from lock file |
187+
| `uv sync` | Install production dependencies only |
188+
| `uv lock` | Update lock file with latest compatible versions |
189+
| `uv lock --upgrade` | Upgrade all dependencies to latest versions |
190+
191+
**Important**: Always commit `uv.lock` changes alongside `pyproject.toml` changes!
192+
193+
133194
## Code of Conduct
134195
This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
135196
For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact

0 commit comments

Comments
 (0)