-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci: Publish python package to pypi #908
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: Build and publish python wheels | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
build-publish: | ||
name: Build and publish wheels | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
package: | ||
- 'quantinuum-hugr-py' | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Run sccache-cache | ||
uses: mozilla-actions/[email protected] | ||
- name: Install poetry | ||
run: pipx install poetry | ||
- name: Set up Python '3.10' | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.10' | ||
cache: "poetry" | ||
|
||
- name: Build sdist and wheels | ||
run: | | ||
cd ${{ matrix.package }} | ||
poetry build -o ../dist | ||
|
||
- name: Upload the built packages as artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: build-${{ matrix.package }}-sdist | ||
path: | | ||
dist/*.tar.gz | ||
dist/*.whl | ||
|
||
- name: Publish to test instance of PyPI (dry-run) | ||
if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref_type == 'branch' ) }} | ||
run: | | ||
cd ${{ matrix.package }} | ||
poetry config repositories.test-pypi https://test.pypi.org/legacy/ | ||
poetry config pypi-token.test-pypi ${{ secrets.PYPI_TEST_PUBLISH }} | ||
poetry publish -r test-pypi --dist-dir ../dist --skip-existing --dry-run | ||
|
||
- name: Publish to PyPI | ||
if: ${{ github.event_name == 'push' && github.ref_type == 'tag' && startsWith(github.ref, format('refs/tags/{}-v', matrix.package)) }} | ||
run: | | ||
cd ${{ matrix.package }} | ||
poetry config repositories.test-pypi https://test.pypi.org/legacy/ | ||
poetry config pypi-token.test-pypi ${{ secrets.PYPI_PUBLISH }} | ||
poetry publish -r test-pypi --dist-dir ../dist --skip-existing |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,10 +2,9 @@ | |
description = "Namespace for the python packages in the HUGR repository. See the individual packages for more information." | ||
name = "hugr-project" | ||
version = "0.0.0" | ||
authors = [] | ||
authors = ["TKET development team <[email protected]>"] | ||
readme = "README.md" | ||
packages = [] | ||
|
||
packages = [{ include = "quantinuum_hugr", from = "quantinuum-hugr-py" }] | ||
package-mode = false | ||
|
||
[tool.poetry.group.main.dependencies] | ||
|
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,23 @@ | ||
[tool.poetry] | ||
classifiers = [ | ||
"Environment :: Console", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
"Programming Language :: Python :: 3.12", | ||
"License :: OSI Approved :: Apache Software License", | ||
"Operating System :: MacOS :: MacOS X", | ||
"Operating System :: POSIX :: Linux", | ||
"Operating System :: Microsoft :: Windows", | ||
"Intended Audience :: Developers", | ||
"Intended Audience :: Science/Research", | ||
"Topic :: Scientific/Engineering", | ||
] | ||
name = "quantinuum_hugr" | ||
version = "0.0.0" | ||
version = "0.1.0a1" | ||
description = "Quantinuum's common representation for quantum programs" | ||
classifiers = [] # TODO | ||
keywords = [] # TODO | ||
authors = [] # TODO | ||
maintainers = [] # TODO | ||
#keywords = [] | ||
authors = ["TKET development team <[email protected]>"] | ||
maintainers = ["TKET development team <[email protected]>"] | ||
license = "Apache-2.0" | ||
readme = "README.md" | ||
homepage = "https://github.com/CQCL/hugr" | ||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are only building with 3.10; should we be building with 3.11 and 3.12 as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a python
3.12
target to the CI checks in addition to the3.10
.The wheels we build are source-based, so they should be portable between versions.