Commit 3ff7ac6
Enable setuptools-scm and nightly PyPI publishing (#95)
Summary:
fix #94
- Adopt setuptools-scm dynamic versioning (remove hardcoded version).
- Add a nightly PyPI publish workflow that generates PEP 440–compliant dev versions from the latest tag with per-second UTC timestamps: `X.Y.Z.devYYYYMMDDHHMMSS`.
- Publish to PyPI only on scheduled runs; manual runs build and validate but do not publish.
### Changes vs main
- Added: `.github/workflows/nightly-pypi.yml`
- Checkout with full history/tags.
- Install build tooling (`build`, `setuptools-scm`).
- Compute version from the latest tag via shell and per-second UTC time.
- Force version using `SETUPTOOLS_SCM_PRETEND_VERSION` and build sdist/wheel.
- Validate metadata with `twine check`.
- Publish only when triggered by `schedule`.
- Modified: `pyproject.toml`
- Remove `version = "..."`; add `dynamic = ["version"]`.
- Bump `setuptools` minimum to `>=64` to support PEP 621 dynamic versioning.
- Keep `setuptools_scm` config: `version_scheme = "guess-next-dev"`, `local_scheme = "no-local-version"`.
### Rationale
- Ensure PyPI-acceptable versions (no local part like `+g<sha>`; strict PEP 440).
- Avoid manual base-version maintenance; derive from Git tags.
- Guarantee unique nightly builds even with multiple runs on the same day.
### How to verify
- Local (no publish):
1) `git fetch --tags`
2) `python -m venv .venv && source .venv/bin/activate`
3) `pip install -U pip && pip install build setuptools-scm twine`
4) `TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo 0.1.0); BASE=${TAG#v}; DATE=$(date -u +%Y%m%d%H%M%S); export SETUPTOOLS_SCM_PRETEND_VERSION=${BASE}.dev${DATE}`
5) `python -m build && twine check dist/*`
- GitHub Actions:
- After this workflow exists on the default branch, use “Run workflow” (manual run does not publish) or wait for the next cron to publish (requires `PYPI_API_TOKEN`).
### Impact
- No breaking changes to consumers. Release tags (e.g., `v0.1.1`) continue to produce stable versions.
### Secrets / Configuration
- Repository secret `PYPI_API_TOKEN` is required for scheduled publishes.
Pull Request resolved: #95
Reviewed By: sfzhu93
Differential Revision: D82144776
Pulled By: FindHao
fbshipit-source-id: bcd1164ef4077f160a5fcba0b51990587c3ab8bf1 parent 6ce725f commit 3ff7ac6
2 files changed
+65
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
12 | 19 | | |
13 | 20 | | |
14 | 21 | | |
15 | 22 | | |
16 | 23 | | |
17 | 24 | | |
18 | | - | |
19 | 25 | | |
20 | 26 | | |
21 | 27 | | |
| |||
30 | 36 | | |
31 | 37 | | |
32 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
33 | 43 | | |
34 | 44 | | |
0 commit comments