|
1 | | -# Releasing `cccc-sdk` (Python) |
| 1 | +# Releasing `cccc-sdk` |
2 | 2 |
|
3 | | -This repo is a monorepo. The Python package lives under `python/`. |
| 3 | +This repo is a monorepo with two deliverables: |
| 4 | +- Python package: `python/` (PyPI name: `cccc-sdk`) |
| 5 | +- TypeScript package: `ts/` (npm name: `cccc-sdk`) |
4 | 6 |
|
5 | | -## Prerequisites (one-time) |
6 | | - |
7 | | -### 1) Create accounts |
| 7 | +## Versioning policy |
8 | 8 |
|
9 | | -- Create a TestPyPI account (for RC dry-runs). |
10 | | -- Create a PyPI account (for real releases). |
11 | | -- Enable 2FA on both accounts (recommended). |
| 9 | +- SDK major/minor tracks CCCC: `0.4.0`. |
| 10 | +- RC sequence is SDK-owned (`0.4.0rcN` for Python, `0.4.0-rc.N` for npm). |
| 11 | +- Compatibility is enforced by contracts/capabilities/op-probing, not by matching RC numbers. |
12 | 12 |
|
13 | | -### 2) Create API tokens |
| 13 | +## 0) Sync specs (recommended) |
14 | 14 |
|
15 | | -You’ll need **two** tokens: |
16 | | -- one for TestPyPI |
17 | | -- one for PyPI |
| 15 | +```bash |
| 16 | +./scripts/sync_specs_from_cccc.sh ../cccc |
| 17 | +``` |
18 | 18 |
|
19 | | -For the **very first upload** (when the project does not exist yet), TestPyPI/PyPI may only allow an |
20 | | -**account-scoped** token. After the project exists, prefer a **project-scoped** token and revoke the |
21 | | -account-scoped one. |
| 19 | +## 1) Python release (PyPI/TestPyPI) |
22 | 20 |
|
23 | | -### 3) Configure GitHub Actions secrets |
| 21 | +### Prerequisites |
24 | 22 |
|
25 | | -In the GitHub repo `ChesterRa/cccc-sdk`: |
| 23 | +- TestPyPI and PyPI accounts |
| 24 | +- Repository secrets in `ChesterRa/cccc-sdk`: |
| 25 | + - `TEST_PYPI_API_TOKEN` |
| 26 | + - `PYPI_API_TOKEN` |
26 | 27 |
|
27 | | -`Settings → Secrets and variables → Actions → New repository secret` |
| 28 | +### Bump version |
28 | 29 |
|
29 | | -Add: |
30 | | -- `TEST_PYPI_API_TOKEN` (from TestPyPI) |
31 | | -- `PYPI_API_TOKEN` (from PyPI) |
| 30 | +Edit `python/pyproject.toml` (`project.version`). |
32 | 31 |
|
33 | | -## Versioning policy |
| 32 | +### Local checks |
34 | 33 |
|
35 | | -- The SDK version matches **CCCC major/minor**: `0.4.0`. |
36 | | -- Pre-releases use PEP 440: `0.4.0rc1`, `0.4.0rc2`, ... |
37 | | -- RC numbers are **SDK-owned** and do not need to match the daemon’s RC sequence. |
38 | | -- Compatibility is enforced via: |
39 | | - - `ipc_v` (ping) |
40 | | - - `capabilities` (ping) |
41 | | - - op probing (`unknown_op`) |
| 34 | +```bash |
| 35 | +./.venv/bin/python -m unittest discover -s python/tests -p "test_*.py" -v |
| 36 | +``` |
42 | 37 |
|
43 | | -## 0) Sync specs (recommended) |
| 38 | +### Publish RC to TestPyPI |
44 | 39 |
|
45 | 40 | ```bash |
46 | | -./scripts/sync_specs_from_cccc.sh ../cccc |
| 41 | +git tag v0.4.0rcN |
| 42 | +git push origin v0.4.0rcN |
47 | 43 | ``` |
48 | 44 |
|
49 | | -## 1) Bump version |
| 45 | +This triggers `.github/workflows/python-publish-testpypi.yml`. |
50 | 46 |
|
51 | | -Edit: |
52 | | -- `python/pyproject.toml` (`project.version`) |
53 | | - |
54 | | -## 2) Run local checks |
| 47 | +Install check: |
55 | 48 |
|
56 | 49 | ```bash |
57 | | -PYTHONPATH=python/src python -m unittest discover -s python/tests -p "test_*.py" -v |
| 50 | +python -m pip install --index-url https://pypi.org/simple \ |
| 51 | + --extra-index-url https://test.pypi.org/simple \ |
| 52 | + cccc-sdk==0.4.0rcN |
58 | 53 | ``` |
59 | 54 |
|
60 | | -Optional build check (requires a venv because many systems are PEP 668 locked): |
| 55 | +### Publish stable to PyPI |
61 | 56 |
|
62 | 57 | ```bash |
63 | | -python -m venv .venv |
64 | | -. .venv/bin/activate |
65 | | -python -m pip install -U pip build |
66 | | -python -m build python |
| 58 | +git tag v0.4.0 |
| 59 | +git push origin v0.4.0 |
67 | 60 | ``` |
68 | 61 |
|
69 | | -## 3) Publish to TestPyPI (recommended for RCs) |
| 62 | +This triggers `.github/workflows/python-publish.yml`. |
| 63 | + |
| 64 | +## 2) TypeScript release (npm) |
| 65 | + |
| 66 | +### Bump version |
70 | 67 |
|
71 | | -1) Confirm `python/pyproject.toml` version is the one you want to publish. |
72 | | -2) Tag and push (auto publishes to TestPyPI): |
| 68 | +Edit `ts/package.json` (`version`). |
| 69 | + |
| 70 | +Examples: |
| 71 | +- RC: `0.4.0-rc.N` |
| 72 | +- Stable: `0.4.0` |
| 73 | + |
| 74 | +### Local checks |
73 | 75 |
|
74 | 76 | ```bash |
75 | | -git tag v0.4.0rc1 |
76 | | -git push origin v0.4.0rc1 |
| 77 | +cd ts |
| 78 | +npm ci |
| 79 | +npm run typecheck |
| 80 | +npm run build |
77 | 81 | ``` |
78 | 82 |
|
79 | | -This triggers `python-publish-testpypi.yml`. |
| 83 | +### Publish RC |
80 | 84 |
|
81 | | -Install: |
| 85 | +```bash |
| 86 | +cd ts |
| 87 | +npm publish --tag rc --access public |
| 88 | +``` |
| 89 | + |
| 90 | +### Publish stable |
82 | 91 |
|
83 | 92 | ```bash |
84 | | -python -m pip install --index-url https://pypi.org/simple \ |
85 | | - --extra-index-url https://test.pypi.org/simple \ |
86 | | - cccc-sdk==0.4.0rc1 |
| 93 | +cd ts |
| 94 | +npm publish --access public |
87 | 95 | ``` |
88 | 96 |
|
89 | | -## 4) Publish to PyPI |
| 97 | +## 3) Post-release sanity |
90 | 98 |
|
91 | | -1) Confirm `python/pyproject.toml` version is the one you want to publish. |
92 | | -2) Tag and push (recommended): |
| 99 | +- Run Python compat check against a running daemon: |
93 | 100 |
|
94 | 101 | ```bash |
95 | | -git tag v0.4.0 |
96 | | -git push origin v0.4.0 |
| 102 | +python python/examples/compat_check.py |
97 | 103 | ``` |
98 | 104 |
|
99 | | -This triggers `python-publish.yml`. |
| 105 | +- Verify npm package installs and can `import { CCCCClient } from 'cccc-sdk'`. |
0 commit comments