Skip to content

Commit f7114df

Browse files
committed
feat(sdk): monorepo repository to add new otel plugin package
1 parent 168cee9 commit f7114df

197 files changed

Lines changed: 478 additions & 37 deletions

File tree

Some content is hidden

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

.github/scripts/ci-checks.sh

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,37 @@
1-
21
#!/bin/sh
32

43
set -e
54

6-
hatch run test:cov
7-
echo SUCCESS: tests + coverage
5+
REPO_ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
6+
7+
PACKAGES=(
8+
"packages/aws-durable-execution-sdk-python"
9+
"packages/aws-durable-execution-sdk-python-otel"
10+
)
11+
12+
for package_dir in "${PACKAGES[@]}"; do
13+
full_path="$REPO_ROOT/$package_dir"
14+
if [ -d "$full_path" ]; then
15+
echo "=========================================="
16+
echo "Running checks for $package_dir"
17+
echo "=========================================="
18+
cd "$full_path"
19+
20+
hatch run test:cov
21+
echo "SUCCESS: tests + coverage ($package_dir)"
822

9-
# type checks
10-
hatch run types:check
11-
echo SUCCESS: typings
23+
# type checks
24+
hatch run types:check
25+
echo "SUCCESS: typings ($package_dir)"
1226

13-
# static analysis
14-
hatch fmt
15-
echo SUCCESS: linting/fmt
27+
# static analysis
28+
hatch fmt
29+
echo "SUCCESS: linting/fmt ($package_dir)"
30+
else
31+
echo "WARNING: $package_dir does not exist, skipping"
32+
fi
33+
done
1634

17-
# commit message validation
35+
# commit message validation (run once from repo root)
36+
cd "$REPO_ROOT"
1837
hatch run python .github/scripts/lintcommit.py

.github/workflows/ci.yml

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,42 @@ jobs:
4343
run: |
4444
python -m pip install hatch==1.16.5
4545
- name: static analysis
46-
run: hatch fmt --check
46+
run: |
47+
for pkg in packages/*/; do
48+
if [ -f "$pkg/pyproject.toml" ]; then
49+
echo "=== Checking format: $pkg ==="
50+
cd "$pkg"
51+
hatch fmt --check
52+
cd "$GITHUB_WORKSPACE"
53+
fi
54+
done
4755
- name: type checking
48-
run: hatch run types:check
56+
run: |
57+
for pkg in packages/*/; do
58+
if [ -f "$pkg/pyproject.toml" ]; then
59+
echo "=== Type checking: $pkg ==="
60+
cd "$pkg"
61+
hatch run types:check
62+
cd "$GITHUB_WORKSPACE"
63+
fi
64+
done
4965
- name: Run tests + coverage
50-
run: hatch run test:cov
66+
run: |
67+
for pkg in packages/*/; do
68+
if [ -f "$pkg/pyproject.toml" ]; then
69+
echo "=== Testing: $pkg ==="
70+
cd "$pkg"
71+
hatch run test:cov
72+
cd "$GITHUB_WORKSPACE"
73+
fi
74+
done
5175
- name: Build distribution
52-
run: hatch build
76+
run: |
77+
for pkg in packages/*/; do
78+
if [ -f "$pkg/pyproject.toml" ]; then
79+
echo "=== Building: $pkg ==="
80+
cd "$pkg"
81+
hatch build
82+
cd "$GITHUB_WORKSPACE"
83+
fi
84+
done

.github/workflows/pypi-publish.yml

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This workflow will upload a Python Package to PyPI when a release is created
1+
# This workflow will upload Python Packages to PyPI when a release is created
22
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
33

44
# This workflow uses actions that are not certified by GitHub.
@@ -18,59 +18,66 @@ permissions:
1818
jobs:
1919
release-build:
2020
runs-on: ubuntu-latest
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
package:
25+
- name: aws-durable-execution-sdk-python
26+
path: packages/aws-durable-execution-sdk-python
27+
- name: aws-durable-execution-sdk-python-otel
28+
path: packages/aws-durable-execution-sdk-python-otel
2129

2230
steps:
2331
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2432

2533
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
2634
with:
2735
python-version: "3.11"
28-
- name: Install Hatch
29-
run: |
30-
python -m pip install --upgrade hatch==1.16.5
36+
37+
- name: Install Hatch
38+
run: python -m pip install --upgrade hatch==1.16.5
39+
3140
- name: Build release distributions
32-
run: |
33-
# NOTE: put your own distribution build steps here.
34-
hatch build
41+
working-directory: ${{ matrix.package.path }}
42+
run: hatch build
3543

3644
- name: Upload distributions
3745
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
3846
with:
39-
name: release-dists
40-
path: dist/
47+
name: release-dists-${{ matrix.package.name }}
48+
path: ${{ matrix.package.path }}/dist/
4149

4250
pypi-publish:
4351
runs-on: ubuntu-latest
4452
needs:
4553
- release-build
54+
strategy:
55+
fail-fast: false
56+
matrix:
57+
package:
58+
- name: aws-durable-execution-sdk-python
59+
- name: aws-durable-execution-sdk-python-otel
4660
permissions:
47-
# IMPORTANT: this permission is mandatory for trusted publishing
4861
id-token: write
4962

50-
# Dedicated environments with protections for publishing are strongly recommended.
51-
# For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules
5263
environment:
5364
name: pypi
54-
# OPTIONAL: uncomment and update to include your PyPI project URL in the deployment status:
55-
# url: https://pypi.org/p/aws-durable-execution-sdk-python
56-
#
57-
# ALTERNATIVE: if your GitHub Release name is the PyPI project version string
58-
# ALTERNATIVE: exactly, uncomment the following line instead:
59-
url: https://pypi.org/project/aws-durable-execution-sdk-python/${{ github.event.release.name }}
65+
url: https://pypi.org/project/${{ matrix.package.name }}/${{ github.event.release.name }}
6066

6167
steps:
6268
- name: Retrieve release distributions
6369
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
6470
with:
65-
name: release-dists
71+
name: release-dists-${{ matrix.package.name }}
6672
path: dist/
6773

68-
- name: Publish release distributions to PyPI
74+
- name: Publish to PyPI
6975
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0
7076
with:
7177
packages-dir: dist/
7278

7379
notify-release:
80+
if: always() && contains(needs.pypi-publish.result, 'success')
7481
needs: [pypi-publish]
7582
uses: ./.github/workflows/notify-release.yml
7683
with:

CONTRIBUTING.md

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,35 @@ information to effectively respond to your bug report or contribution.
99
## Dependencies
1010
Install [hatch](https://hatch.pypa.io/dev/install/).
1111

12+
## Repository Structure
13+
14+
This is a monorepo containing multiple packages under the `packages/` directory:
15+
16+
```
17+
packages/
18+
├── aws-durable-execution-sdk-python/ # Core SDK
19+
│ ├── pyproject.toml
20+
│ ├── src/
21+
│ ├── tests/
22+
│ └── examples/
23+
└── aws-durable-execution-sdk-python-otel/ # OpenTelemetry instrumentation
24+
├── pyproject.toml
25+
├── src/
26+
└── tests/
27+
```
28+
29+
Shared files (`.github/`, `LICENSE`, `CONTRIBUTING.md`, etc.) live at the repository root.
30+
1231
## Developer workflow
32+
33+
All `hatch` commands must be run from within a specific package directory:
34+
35+
```bash
36+
cd packages/aws-durable-execution-sdk-python
37+
# or
38+
cd packages/aws-durable-execution-sdk-python-otel
39+
```
40+
1341
These are all the checks you would typically do as you prepare a PR:
1442
```
1543
# just test
@@ -25,7 +53,7 @@ hatch run types:check
2553
hatch fmt
2654
```
2755

28-
There is a convenience script for the above that you can run from the root of the repo as you prepare your PR:
56+
There is a convenience script that runs checks across all packages from the root of the repo:
2957
```
3058
.github/scripts/ci-checks.sh
3159
```
@@ -131,7 +159,8 @@ class WaitOptions:
131159

132160
## Set up your IDE
133161
Point your IDE at the hatch virtual environment to have it recognize dependencies
134-
and imports.
162+
and imports. Run these commands from within the package directory you're working on
163+
(e.g., `packages/aws-durable-execution-sdk-python`).
135164

136165
You can find the path to the hatch Python interpreter like this:
137166
```
@@ -148,6 +177,7 @@ errors finding the interpreter. You can create a local .venv file symlink _witho
148177
in the path:
149178

150179
```bash
180+
# From within the package directory, e.g. packages/aws-durable-execution-sdk-python
151181
# create a symlink at: ./.venv/bin/python
152182
rm -rf .venv && ln -s "$(hatch env find)" .venv
153183
```
@@ -179,6 +209,8 @@ These `settings.json` settings are useful:
179209

180210
## Testing
181211
### How to run tests
212+
Run these commands from within a package directory (e.g., `packages/aws-durable-execution-sdk-python`).
213+
182214
To run all tests:
183215
```
184216
hatch test
@@ -220,7 +252,8 @@ tests/mypackage/mymodule_test.py
220252

221253
## Examples and Deployment
222254

223-
The project includes a unified CLI tool for managing examples, deployment, and AWS account setup:
255+
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`):
224257

225258
### Bootstrap AWS Account
226259
```bash

RELEASING.md

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# Releasing
2+
3+
This document describes how to cut a release for packages in this monorepo and how the automated PyPI publishing workflow is triggered.
4+
5+
## Packages
6+
7+
This monorepo contains the following packages:
8+
9+
| Package | Path | Tag Prefix |
10+
|---------|------|------------|
11+
| `aws-durable-execution-sdk-python` | `packages/aws-durable-execution-sdk-python` | `sdk` |
12+
| `aws-durable-execution-sdk-python-otel` | `packages/aws-durable-execution-sdk-python-otel` | `otel` |
13+
14+
## Versioning
15+
16+
Each package maintains its own version in its respective `__about__.py` file:
17+
18+
- SDK: `packages/aws-durable-execution-sdk-python/src/aws_durable_execution_sdk_python/__about__.py`
19+
- OTel: `packages/aws-durable-execution-sdk-python-otel/src/aws_durable_execution_sdk_python_otel/__about__.py`
20+
21+
Bump the version in the appropriate `__about__.py` file(s) and merge to `main` before creating a release.
22+
23+
## Cutting a Release
24+
25+
### 1. Bump the version
26+
27+
Update the `__version__` string in the relevant `__about__.py` file(s). Commit and merge to `main`.
28+
29+
### 2. Create a GitHub Release
30+
31+
1. Go to the [Releases page](https://github.com/aws/aws-durable-execution-sdk-python/releases) on GitHub.
32+
2. Click **Draft a new release**.
33+
3. Create a new tag following the tagging convention below.
34+
4. Set the release title (typically the same as the tag).
35+
5. Write release notes following the format described in [Release Notes Format](#release-notes-format).
36+
6. Click **Publish release**.
37+
38+
### Tagging Convention
39+
40+
The tag should be the version of the package being bumped, prepended with a descriptive prefix:
41+
42+
- **SDK only:** `sdk-v<version>` (e.g., `sdk-v1.6.0`)
43+
- **OTel only:** `otel-v<version>` (e.g., `otel-v0.3.0`)
44+
- **Both packages in a single release:** comma-separate the sub-tags (e.g., `sdk-1.6.0,otel-0.3.0`)
45+
46+
Examples:
47+
48+
```
49+
sdk-1.6.0
50+
otel-0.3.0
51+
sdk-1.6.0,otel-0.3.0
52+
```
53+
54+
If additional packages are added to the monorepo in the future, follow the same pattern: choose a short descriptive prefix for the package and use `<prefix>-<version>`.
55+
56+
## How Publishing Works
57+
58+
Creating a GitHub Release triggers the [`pypi-publish.yml`](.github/workflows/pypi-publish.yml) workflow automatically. The workflow:
59+
60+
1. **Builds** both packages using [Hatch](https://hatch.pypa.io/) (`hatch build`).
61+
2. **Uploads** the built distributions as artifacts.
62+
3. **Publishes** each package to [PyPI](https://pypi.org/) using trusted publishing (OIDC-based, no API tokens required).
63+
64+
The workflow runs on the `release: [published]` event, so it fires whenever a release is published on GitHub — no manual intervention is needed beyond creating the release.
65+
66+
> **Note:** The workflow builds and publishes all packages in the matrix. Ensure the version in each package's `__about__.py` is correct before publishing. If only one package has a version bump, PyPI will reject the re-upload of the unchanged package (which is expected and harmless since `fail-fast: false` is set).
67+
68+
## Release Notes Format
69+
70+
Release notes should maintain separate timelines for each package. Use the following structure:
71+
72+
```markdown
73+
## aws-durable-execution-sdk-python v1.6.0
74+
75+
### Features
76+
- Added support for X
77+
- New `context.foo()` API
78+
79+
### Bug Fixes
80+
- Fixed issue with Y under Z conditions
81+
82+
### Breaking Changes
83+
- Removed deprecated `bar()` method
84+
85+
---
86+
87+
## aws-durable-execution-sdk-python-otel v0.3.0
88+
89+
### Features
90+
- Added tracing for `map` operations
91+
92+
### Bug Fixes
93+
- Fixed span context propagation in child contexts
94+
```
95+
96+
If only one package is being released, include only that package's section. Each package's changelog should be self-contained so users can follow the history of the package they depend on independently.
97+
98+
## Checklist
99+
100+
Before publishing a release:
101+
102+
- [ ] Version bumped in the relevant `__about__.py` file(s)
103+
- [ ] Changes merged to `main`
104+
- [ ] CI checks pass on `main`
105+
- [ ] Release notes written with separate sections per package
106+
- [ ] Tag follows the naming convention (`sdk-X.Y.Z`, `otel-X.Y.Z`, or comma-separated)

0 commit comments

Comments
 (0)