feat(python-sdk): pure-Python bootstrap on PyPI fetches native wheels from GH Releases#45
Merged
Merged
Conversation
… from GH Releases After v3.2.0 stopped publishing native wheels to PyPI (PR #44, GH Releases is the canonical host), `pip install a3s-code` was broken on every platform except cp310 macOS arm64 (the one wheel that snuck into PyPI before the 10 GB project cap kicked in). This commit restores `pip install a3s-code` by adding a tiny pure-Python bootstrap package — also named `a3s-code` — that on first `import a3s_code` downloads the matching native wheel for the current interpreter and platform, verifies its sha256 against the release manifest, extracts the compiled `_native` extension into a per-user cache, and registers it as `sys.modules["a3s_code._native"]`. Subsequent imports use the cache; cold start is one download per (version, platform, interpreter) triple. New package - sdk/python-bootstrap/ — setuptools-built pure-Python wheel (a3s_code-X.Y.Z-py3-none-any.whl) and matching sdist. - src/a3s_code/__init__.py — calls ensure_native_loaded() then `from ._native import *`. - src/a3s_code/_bootstrap.py — wheel-name resolver, downloader, sha256 verifier, extension loader. Knobs: A3S_CODE_CACHE_DIR, A3S_CODE_RELEASES_BASE_URL, A3S_CODE_SKIP_HASH_CHECK. - tests/test_bootstrap.py — 15 unit tests (filename resolution, cache dir, sha256 mismatch, idempotency, manifest fallback) plus one live download test gated on A3S_CODE_BOOTSTRAP_LIVE=1. - README documenting install model and overrides. Workflow - publish-python-bootstrap.yml — runs bootstrap unit tests, builds wheel + sdist, twine check, twine upload on tag push. - release.yml — adds the bootstrap publish job; runs after publish-python (which produces the GH Release the bootstrap points at) and gates github-release on both. Release plumbing - scripts/check_release_versions.sh now validates the bootstrap pyproject.toml and the runtime __version__ in _bootstrap.py — they must equal the core version so the bootstrap finds the matching GH Release tag. - release.sh bumps both in lockstep with the other version files. - README + sdk/python README rewritten to advertise pip install a3s-code again and explain the cache. Bumps core / Node SDK / Python SDK from 3.2.0 to 3.2.1 since the bootstrap is a user-facing addition. CHANGELOG [3.2.1] entry documents the new package + rationale. End-to-end verified locally: built the wheel, installed into a fresh venv, ran `import a3s_code` with __version__ patched to 3.2.0 so the bootstrap points at the real GH Release; Agent.create succeeded.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does
Adds a tiny pure-Python package (also named `a3s-code`) that goes to PyPI. On first `import a3s_code` it:
Subsequent imports skip the download.
```bash
pip install a3s-code # downloads the bootstrap (tiny)
python -c 'import a3s_code' # first call: fetches native wheel from GH Release (~17 MB)
python -c 'import a3s_code' # second call: uses cache, instant
```
Layout
```
sdk/python-bootstrap/
├── pyproject.toml # setuptools, pure-Python, no deps
├── README.md
├── src/a3s_code/
│ ├── init.py # bootstrap() then from ._native import *
│ ├── _bootstrap.py # loader logic
│ └── py.typed
└── tests/test_bootstrap.py # 15 unit tests + 1 live test
```
Env knobs
Workflow integration
Test plan
Bumps
Core / Node SDK / Python SDK 3.2.0 → 3.2.1.
Release sequence after this PR merges
Optional follow-ups