Skip to content

Commit 1e2fba9

Browse files
committed
feat: update CONTRIBUTING.md for new dev workflow
1 parent 72af430 commit 1e2fba9

1 file changed

Lines changed: 99 additions & 31 deletions

File tree

CONTRIBUTING.md

Lines changed: 99 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -20,40 +20,87 @@ packages/
2020
│ ├── src/
2121
│ ├── tests/
2222
│ └── examples/
23-
└── aws-durable-execution-sdk-python-otel/ # OpenTelemetry instrumentation
23+
├── aws-durable-execution-sdk-python-otel/ # OpenTelemetry instrumentation
24+
│ ├── pyproject.toml
25+
│ ├── src/
26+
│ └── tests/
27+
└── examples/ # Example functions and tests
2428
├── pyproject.toml
2529
├── src/
26-
└── tests/
30+
└── test/
2731
```
2832

33+
The root `pyproject.toml` defines all shared Hatch environments for testing, type checking, and development. Each package's `pyproject.toml` contains only build metadata, publishing configuration, and package-local tool settings (ruff, coverage, pytest markers).
34+
2935
Shared files (`.github/`, `LICENSE`, `CONTRIBUTING.md`, etc.) live at the repository root.
3036

3137
## Developer workflow
3238

33-
All `hatch` commands must be run from within a specific package directory:
39+
All test, type checking, and development commands are run from the **repository root**:
3440

3541
```bash
36-
cd packages/aws-durable-execution-sdk-python
37-
# or
38-
cd packages/aws-durable-execution-sdk-python-otel
42+
# Run all tests across all packages
43+
hatch run test:all
44+
45+
# Run tests with coverage
46+
hatch run test:cov
47+
48+
# Type checking across all packages
49+
hatch run types:check
50+
51+
# Static analysis (per-package, since ruff config is package-local)
52+
for pkg in packages/*/; do (cd "$pkg" && hatch fmt --check); done
3953
```
4054

41-
These are all the checks you would typically do as you prepare a PR:
55+
### Per-package development environments
56+
57+
For focused work on a single package, use the `dev-*` environments from the repo root:
58+
59+
```bash
60+
# Core SDK
61+
hatch run dev-core:test # run core SDK tests only
62+
hatch run dev-core:cov # run core SDK tests with coverage
63+
hatch run dev-core:typecheck # type check core SDK only
64+
65+
# OpenTelemetry package
66+
hatch run dev-otel:test # run otel tests only
67+
hatch run dev-otel:cov # run otel tests with coverage
68+
hatch run dev-otel:typecheck # type check otel only
69+
70+
# Examples
71+
hatch run dev-examples:test # run examples tests only
4272
```
43-
# just test
44-
hatch test
4573

46-
# coverage
47-
hatch run test:cov
74+
### PyPI release testing
4875

49-
# type checks
50-
hatch run types:check
76+
To verify packages work against the published PyPI version of the core SDK (rather than the local workspace):
77+
78+
```bash
79+
hatch run test-pypi-otel:test # test otel against PyPI core SDK
80+
hatch run test-pypi-examples:test # test examples against PyPI core SDK
81+
```
5182

52-
# static analysis
83+
### Package-level commands
84+
85+
Some commands still run from within a package directory:
86+
87+
```bash
88+
cd packages/aws-durable-execution-sdk-python
89+
90+
# Static analysis with auto-fix
5391
hatch fmt
92+
93+
# Build distribution
94+
hatch build
95+
96+
# Examples deployment
97+
hatch run examples:build
98+
hatch run examples:deploy "Hello World"
5499
```
55100

56-
There is a convenience script that runs checks across all packages from the root of the repo:
101+
### CI checks script
102+
103+
There is a convenience script that runs all checks (tests, types, lint) from the root of the repo:
57104
```
58105
.github/scripts/ci-checks.sh
59106
```
@@ -159,12 +206,15 @@ class WaitOptions:
159206

160207
## Set up your IDE
161208
Point your IDE at the hatch virtual environment to have it recognize dependencies
162-
and imports. Run these commands from within the package directory you're working on
163-
(e.g., `packages/aws-durable-execution-sdk-python`).
209+
and imports. You can use either the root environment (for cross-package work) or a
210+
per-package dev environment (for focused work).
164211

165212
You can find the path to the hatch Python interpreter like this:
166213
```
167-
echo "$(hatch env find)/bin/python"
214+
# From the repo root — use the dev environment for the package you're working on
215+
hatch env find dev-core
216+
hatch env find dev-otel
217+
hatch env find dev-examples
168218
```
169219

170220
### VS Code
@@ -177,9 +227,8 @@ errors finding the interpreter. You can create a local .venv file symlink _witho
177227
in the path:
178228

179229
```bash
180-
# From within the package directory, e.g. packages/aws-durable-execution-sdk-python
181-
# create a symlink at: ./.venv/bin/python
182-
rm -rf .venv && ln -s "$(hatch env find)" .venv
230+
# From the repo root — symlink the dev environment you want to use
231+
rm -rf .venv && ln -s "$(hatch env find dev-core)" .venv
183232
```
184233

185234
When you "Select Interpreter", enter path `./.venv/bin/python`.
@@ -209,26 +258,33 @@ These `settings.json` settings are useful:
209258

210259
## Testing
211260
### How to run tests
212-
Run these commands from within a package directory (e.g., `packages/aws-durable-execution-sdk-python`).
261+
Run these commands from the **repository root**:
213262

214-
To run all tests:
263+
To run all tests across all packages:
215264
```
216-
hatch test
265+
hatch run test:all
266+
```
267+
268+
To run tests for a specific package:
269+
```
270+
hatch run dev-core:test
271+
hatch run dev-otel:test
272+
hatch run dev-examples:test
217273
```
218274

219275
To run a single test file:
220276
```
221-
hatch test tests/path_to_test_module.py
277+
hatch run dev-core:test packages/aws-durable-execution-sdk-python/tests/path_to_test_module.py
222278
```
223279

224280
To run a specific test in a module:
225281
```
226-
hatch test tests/path_to_test_module.py::test_mytestmethod
282+
hatch run dev-core:test packages/aws-durable-execution-sdk-python/tests/path_to_test_module.py::test_mytestmethod
227283
```
228284

229-
To run a single test, or a subset of tests:
285+
To run a subset of tests by pattern:
230286
```
231-
$ hatch test -k TEST_PATTERN
287+
hatch run test:all -k TEST_PATTERN
232288
```
233289

234290
This will run tests which contain names that match the given string expression (case-insensitive),
@@ -253,7 +309,12 @@ tests/mypackage/mymodule_test.py
253309
## Examples and Deployment
254310

255311
The project includes a unified CLI tool for managing examples, deployment, and AWS account setup.
256-
Run these commands from the core SDK package directory (`packages/aws-durable-execution-sdk-python`):
312+
Run these commands from the core SDK package directory (`packages/aws-durable-execution-sdk-python`).
313+
314+
To run examples tests from the repo root:
315+
```bash
316+
hatch run dev-examples:test
317+
```
257318

258319
### Bootstrap AWS Account
259320
```bash
@@ -293,17 +354,24 @@ hatch run examples:clean
293354
```
294355

295356
## Coverage
357+
358+
From the repository root:
296359
```
360+
# All packages combined
297361
hatch run test:cov
362+
363+
# Per-package coverage
364+
hatch run dev-core:cov
365+
hatch run dev-otel:cov
298366
```
299367

300368
## Linting and type checks
301-
Type checking:
369+
Type checking (from repo root):
302370
```
303371
hatch run types:check
304372
```
305373

306-
Static analysis (with auto-fix of known issues):
374+
Static analysis (from within a package directory, with auto-fix):
307375
```
308376
hatch fmt
309377
```

0 commit comments

Comments
 (0)