Repository navigation
ci: publish a pyqasm Lab environment on qBraid from a manual workflow - #455
Conversation
The workflow runs by hand for a released pyqasm version. It builds the environment on an Ubuntu 22.04 runner with Python 3.12, which matches Lab, so no qBraid compute instance or SSH is needed. Lab relinks the venv to its own Python of the same minor version when it installs the environment. It then uploads the environment, requests publishing, reviews and approves it, and sets it as the latest in the pyqasm group. Each target reads its API key and URL from the env-publish-staging or env-publish-prod environment. stop_after can end the run after upload, request or approve. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Argus reviewAuto-review is off for this repo. Tick the box below to run a review on this PR.
Estimated cost
Tip: you can also comment |
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Every workflow step is now one call into bin/publish_lab_env.py, and the smoke test lives in bin/lab_env_smoke_test.py. Preflight also checks the inputs, the PyPI release and the logo. The environment no longer uses a requirements file. The script creates it with the qBraid CLI, then installs pyqasm==<version> and ipykernel with qbraid-core's pip_install, which fails loudly when pip fails. Lab needs ipykernel in the venv to start the kernel. The extras input is gone. The production target and environment are now named production, not prod. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Approve directly instead of requesting publication first. That skips the per-plan publish quota and the email a request sends every admin. - Make publish skip steps already done, and add a slug input that resumes an uploaded environment without building another copy. - Set the group's latest only when no newer pyqasm holds it, with a set_latest input to turn it off. - Install pyqasm with every extra its release declares on PyPI, plus ipykernel and matplotlib. Only pyqasm is pinned. - Pin qbraid-core, pass the API key only to steps that call qBraid, install wheels only, and pin the actions by commit SHA. - Preflight gives clear errors for an unreadable group and an unreachable PyPI, and checks versions with a strict pattern. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Prod Lab runs Ubuntu 24.04 x86_64 (glibc 2.39) with the system Python 3.12.3 at /usr/bin/python3.12, not Ubuntu 22.04. The ubuntu-24.04 runner ships the same Python at the same path. The job now builds with it through a tool venv instead of setup-python, so the environment's bin/python links to /usr/bin/python3.12 and works in Lab without a relink. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Merging so that tests can be performed in |
* feat: publish a qBraid Lab environment from GitHub Actions Add the publish-lab-env workflow, run by hand for a released version. It builds the environment on an Ubuntu 24.04 runner with the system Python 3.12, which matches Lab, and smoke tests it. Then it uploads and approves it on qBraid staging or production, and adds it to the group. The steps live in bin/publish_lab_env.py and bin/lab_env_smoke_test.py. Ported from qBraid/pyqasm#455 and #456. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: add the Lab environment workflow to the changelog Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: let a same-version rebuild become the group's latest A rebuild run with allow_existing now replaces an equal-version latest. Only a newer release stays the latest. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> ---------
* feat: publish a qBraid Lab environment from GitHub Actions Add the publish-lab-env workflow, run by hand for a released version. It builds the environment on an Ubuntu 24.04 runner with the system Python 3.12, which matches Lab, and smoke tests it. Then it uploads and approves it on qBraid staging or production, and adds it to the group. The steps live in bin/publish_lab_env.py and bin/lab_env_smoke_test.py. Ported from qBraid/pyqasm#455 and #456. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: add the Lab environment workflow to the changelog Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: let a same-version rebuild become the group's latest A rebuild run with allow_existing now replaces an equal-version latest. Only a newer release stays the latest. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Summary of changes
Adds
Publish qBraid Lab environment(.github/workflows/publish-lab-env.yml), aworkflow_dispatchworkflow for a released pyqasm version. It replaces the manual Lab-terminal flow for publishing an environment.Each workflow step is one call into
bin/publish_lab_env.py. The smoke test isbin/lab_env_smoke_test.py.Steps
preflight: checks the inputs and that the version is on PyPI. Then it checks the key, the logo, the group, and that no environment of the same name is visible.create:qbraid envs createmakespyqasm <version>with kernelPython 3 [pyqasm <version>]. Then qbraid-core'spip_installadds:pyqasm[<every extra the release declares on PyPI>]==<version>ipykernel, which Lab needs to start the kernelmatplotlibOnly pyqasm is pinned. Every package in the live 1.2.1 environment resolves from this set.
Smoke test with the environment's Python: check the version and import each extra. Then unroll, validate and draw a small program.
uploadby env_id.publish: approve, then add to the group as its latest. It approves directly, without a publish request. That skips the per-plan publish quota and the email a request sends every platform admin. Approving makes the environment public in the catalog.summarywrites the results to the job summary. On failure it prints the slug to resume from.Inputs
targetstagingorproductionversionx.y.zstop_afterupload,approveorpublishset_latestslugpublishskips steps already done.allow_existingWhy the runner, not a qBraid compute instance
A venv links to the Python that created it. Prod Lab runs Ubuntu 24.04 x86_64 (glibc 2.39) with the system Python 3.12.3 at
/usr/bin/python3.12. Theubuntu-24.04runner ships the same Python at the same path. The job builds with it through a tool venv, so the environment'sbin/pythonlinks to/usr/bin/python3.12and works in Lab unchanged.The upload also rewrites the venv paths for
/home/jovyan. On install, Lab runsrepair_venvas a fallback. In prod Lab,find_python('3.12')returns/usr/bin/python3.12, so the relink also works.The first staging run still installs the environment in staging Lab and starts its kernel before any production run.
Configuration
env-publish-stagingQBRAID_API_URL(staging API),QBRAID_ENV_GROUPQBRAID_API_KEYmainonlyenv-publish-productionQBRAID_API_URL(prod API),QBRAID_ENV_GROUPQBRAID_API_KEYmainonlyQBRAID_ENV_LOGOis optional and defaults toqbraid. The keys belong to Pro accounts with admin roles. Approving needs admin orglobal|labs|environments|review, and group edits need a platform admin.Hardening
qbraid-cliandqbraid-coreare pinned. pip installs wheels only.run:script.Known limits
workflow_dispatchworkflow must exist onmainbefore it can run. So the first staging run happens after merge.Testing
actionlintpasses on the workflow.black,isortandpylint(10.00) pass on both scripts.createand the smoke test ran for real with the pinned CLI and core, wheels only, in a throwaway HOME. All six extras installed. (That local run used macOS; the workflow now uses the runner's system Python.) The smoke test passed, and a wrong version fails it.manylinuxwheel for Python 3.12.set_latestrules, the missing-group failure, pagination