Skip to content

Commit 7e09448

Browse files
radumargsplch
andauthored
Setup pypi publishing (#5)
* Update README. * Update README. * Adding PyPi build action workflow. * Fix Github CI action yaml warnings. * Fix Github CI action yaml warnings. * Add pypi upload environment. * Update package name to ionq-core. Update release Github action to verify version tag matches pyproject version and version is not already on PyPI. * Update version checking success message. * Rework after review. * simplify release workflow to match codebase conventions - Replace 50-line Python verify script with 10-line shell equivalent - Remove job-level name: fields (no other workflow uses them) - Remove unnecessary step names on self-explanatory actions - Remove unnecessary contents: read from publish job permissions - Drop setup-uv from verify-version (only needs stdlib python3) - Use ::error:: annotations consistent with generated.yml - PyPI unreachable is a no-op instead of a release blocker * remove redundant test job, bump artifact actions, add if-no-files-found - Remove test job from release workflow (CI already gates merges to main) - Bump upload-artifact v6 -> v7, download-artifact v6 -> v8 - Add if-no-files-found: error to catch silent build failures * bump all GitHub Actions to latest versions - astral-sh/setup-uv v8.0.0 -> v8.1.0 (all workflows) - actions/upload-pages-artifact v3 -> v5 (docs) - actions/deploy-pages v4 -> v5 (docs) - zizmorcore/zizmor-action v0.5.2 -> v0.5.3 (zizmor) --------- Co-authored-by: Spencer Churchill <25377399+splch@users.noreply.github.com>
1 parent d673aa3 commit 7e09448

15 files changed

Lines changed: 53 additions & 35 deletions

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
2424
with:
2525
persist-credentials: false
26-
- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
26+
- uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
2727
with:
2828
python-version: "3.12"
2929
enable-cache: ${{ github.event_name == 'push' }}
@@ -43,7 +43,7 @@ jobs:
4343
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
4444
with:
4545
persist-credentials: false
46-
- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
46+
- uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
4747
with:
4848
python-version: ${{ matrix.python-version }}
4949
enable-cache: ${{ github.event_name == 'push' }}

.github/workflows/docs.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ jobs:
1919
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
2020
with:
2121
persist-credentials: false
22-
- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
22+
- uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
2323
with:
2424
python-version: "3.12"
2525
- run: uv sync
2626
- run: uv run pdoc -o docs/ -d google ionq_core
27-
- uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3
27+
- uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5
2828
with:
2929
path: docs/
3030

@@ -40,4 +40,4 @@ jobs:
4040
url: ${{ steps.deployment.outputs.page_url }}
4141
steps:
4242
- id: deployment
43-
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4
43+
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5

.github/workflows/generated.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
1919
with:
2020
persist-credentials: false
21-
- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
21+
- uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
2222
with:
2323
python-version: "3.12"
2424
enable-cache: false

.github/workflows/integration.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
2525
with:
2626
persist-credentials: false
27-
- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
27+
- uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
2828
with:
2929
python-version: "3.12"
3030
enable-cache: true

.github/workflows/release.yml

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,49 +11,58 @@ env:
1111
UV_FROZEN: true
1212

1313
jobs:
14-
test:
14+
verify-version:
1515
runs-on: ubuntu-latest
16-
timeout-minutes: 10
16+
timeout-minutes: 5
1717
steps:
1818
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
1919
with:
2020
persist-credentials: false
21-
- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
22-
with:
23-
python-version: "3.12"
24-
enable-cache: false
25-
- run: uv sync
26-
- run: uv run pytest
21+
- name: Verify tag matches pyproject version
22+
run: |
23+
set -euo pipefail
24+
TAG_VERSION="${GITHUB_REF_NAME#v}"
25+
PYPROJECT_VERSION=$(python3 -c "import tomllib; print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")
26+
if [[ "$TAG_VERSION" != "$PYPROJECT_VERSION" ]]; then
27+
echo "::error::Tag ${GITHUB_REF_NAME} does not match pyproject.toml version ${PYPROJECT_VERSION}"
28+
exit 1
29+
fi
30+
if curl -sf "https://pypi.org/pypi/ionq-core/${PYPROJECT_VERSION}/json" > /dev/null 2>&1; then
31+
echo "::error::Version ${PYPROJECT_VERSION} already exists on PyPI"
32+
exit 1
33+
fi
34+
echo "Releasing ionq-core ${PYPROJECT_VERSION}"
2735
2836
build:
29-
needs: test
37+
needs: verify-version
3038
runs-on: ubuntu-latest
3139
timeout-minutes: 10
3240
steps:
3341
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
3442
with:
3543
persist-credentials: false
36-
- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
44+
- uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
3745
with:
3846
python-version: "3.12"
3947
enable-cache: false
4048
- run: uv build
41-
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
49+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
4250
with:
4351
name: dist
4452
path: dist/
53+
if-no-files-found: error
4554

4655
publish:
4756
needs: build
4857
runs-on: ubuntu-latest
4958
timeout-minutes: 5
5059
environment:
5160
name: pypi
52-
url: https://pypi.org/p/ionq-core-python
61+
url: https://pypi.org/p/ionq-core
5362
permissions:
5463
id-token: write
5564
steps:
56-
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
65+
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
5766
with:
5867
name: dist
5968
path: dist/

.github/workflows/zizmor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
2020
with:
2121
persist-credentials: false
22-
- uses: zizmorcore/zizmor-action@71321a20a9ded102f6e9ce5718a2fcec2c4f70d8 # v0.5.2
22+
- uses: zizmorcore/zizmor-action@b1d7e1fb5de872772f31590499237e7cce841e8e # v0.5.3
2323
with:
2424
token: ${{ secrets.GITHUB_TOKEN }}
2525
advanced-security: false

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Contributing to ionq-core-python
1+
# Contributing to ionq-core
22

33
Thank you for your interest in contributing to the IonQ Python client.
44

README.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# ionq-core-python
1+
# ionq-core
22

3-
[![PyPI version](https://img.shields.io/pypi/v/ionq-core-python.svg)](https://pypi.org/project/ionq-core-python/)
3+
[![PyPI version](https://img.shields.io/pypi/v/ionq-core.svg)](https://pypi.org/project/ionq-core/)
44
[![Python 3.12+](https://img.shields.io/badge/python-3.12+-blue.svg)](https://www.python.org/downloads/)
55

66
A Python client library for the [IonQ Cloud Platform API](https://docs.ionq.com/), providing full access to IonQ's quantum computing services. Supports both synchronous and asynchronous usage, with typed models for all request and response objects.
@@ -10,7 +10,7 @@ Auto-generated from the [IonQ OpenAPI specification](https://docs.ionq.com/api-r
1010
## Installation
1111

1212
```sh
13-
pip install ionq-core-python
13+
pip install ionq-core
1414
```
1515

1616
Requires Python 3.12+.
@@ -390,6 +390,15 @@ uv run ruff format --check # Check formatting
390390
uv run ty check ionq_core/ # Type check
391391
```
392392

393+
## Publishing
394+
395+
For a new build to be accepted at PyPI, the version number in pyproject.toml must be incremented. Publishing is handled automatically via trusted publishing on tagged releases:
396+
397+
```sh
398+
git tag v0.1.0
399+
git push origin v0.1.0
400+
```
401+
393402
## License
394403

395404
Apache-2.0. See [LICENSE](LICENSE) for details.

ionq_core/_extensions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Extension API for downstream SDKs building on ionq-core-python.
1+
"""Extension API for downstream SDKs building on ionq-core.
22
33
Provides hooks that downstream libraries (qiskit-ionq, cirq-ionq, etc.)
44
use to customize client behavior without forking or monkey-patching.

ionq_core/ionq_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from .client import AuthenticatedClient
1515

1616
try:
17-
__version__ = _pkg_version("ionq-core-python")
17+
__version__ = _pkg_version("ionq-core")
1818
except PackageNotFoundError:
1919
__version__ = "0.0.0"
2020

@@ -23,7 +23,7 @@
2323

2424
def _build_user_agent(*tokens: str | None) -> str:
2525
parts = [
26-
f"ionq-core-python/{__version__}",
26+
f"ionq-core/{__version__}",
2727
f"python/{platform.python_version()}",
2828
f"httpx/{httpx.__version__}",
2929
f"os/{platform.system().lower()}",

0 commit comments

Comments
 (0)