-
Notifications
You must be signed in to change notification settings - Fork 6
Modernize packaging, tooling, and CI #60
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
base: main
Are you sure you want to change the base?
Changes from 4 commits
5a730ff
ddda2ff
2c19b76
ae6f2eb
d0a2f79
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| name: Bug report | ||
| description: Report a problem with blqs or blqs-cirq | ||
| labels: ["bug"] | ||
| body: | ||
| - type: dropdown | ||
| id: package | ||
| attributes: | ||
| label: Package | ||
| options: | ||
| - blqs | ||
| - blqs-cirq | ||
| - not sure | ||
| validations: | ||
| required: true | ||
| - type: textarea | ||
| id: what-happened | ||
| attributes: | ||
| label: What happened? | ||
| description: What did you expect, and what happened instead? | ||
| validations: | ||
| required: true | ||
| - type: textarea | ||
| id: repro | ||
| attributes: | ||
| label: Minimal reproduction | ||
| description: The smallest code snippet that reproduces the issue. | ||
| render: python | ||
| validations: | ||
| required: true | ||
| - type: input | ||
| id: versions | ||
| attributes: | ||
| label: Versions | ||
| description: Output of `python -c "import blqs; print(blqs.__version__)"` (and cirq if relevant) plus your Python version. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (minor:) |
||
| validations: | ||
| required: true | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| blank_issues_enabled: false | ||
| contact_links: | ||
| - name: Security vulnerability | ||
| url: https://github.com/ionq/blqs/security/advisories/new | ||
| about: Please report security issues privately, not as a public issue. | ||
| - name: Question or discussion | ||
| url: https://github.com/ionq/blqs/discussions | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. afaik this has to be turned on in the Settings of the repo - it doesn't exist atm. |
||
| about: Ask usage questions and discuss ideas here. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| name: Feature request | ||
| description: Suggest an idea for blqs or blqs-cirq | ||
| labels: ["enhancement"] | ||
| body: | ||
| - type: textarea | ||
| id: problem | ||
| attributes: | ||
| label: Problem | ||
| description: What are you trying to do that blqs makes hard or impossible today? | ||
|
splch marked this conversation as resolved.
Outdated
|
||
| validations: | ||
| required: true | ||
| - type: textarea | ||
| id: proposal | ||
| attributes: | ||
| label: Proposed solution | ||
| description: What would you like to see? Include a sketch of the API if you have one. | ||
|
splch marked this conversation as resolved.
Outdated
|
||
| validations: | ||
| required: true | ||
| - type: textarea | ||
| id: alternatives | ||
| attributes: | ||
| label: Alternatives considered | ||
| validations: | ||
| required: false | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| version: 2 | ||
| updates: | ||
| - package-ecosystem: "github-actions" | ||
| directory: "/" | ||
| schedule: | ||
| interval: "weekly" | ||
| groups: | ||
| actions: | ||
| patterns: ["*"] | ||
|
|
||
| - package-ecosystem: "uv" | ||
| directory: "/" | ||
| schedule: | ||
| interval: "weekly" | ||
| groups: | ||
| python: | ||
| patterns: ["*"] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| ## Summary | ||
|
|
||
| <!-- What does this change and why? Link any related issue. --> | ||
|
|
||
| ## Test plan | ||
|
|
||
| <!-- How did you verify this? The local checks are: | ||
| uv run pytest && uv run ruff check && uv run ruff format --check && uv run ty check --> | ||
|
|
||
| ## Checklist | ||
|
|
||
| - [ ] Tests added or updated for any code change | ||
| - [ ] `CHANGELOG.md` updated under `[Unreleased]` for user-visible changes | ||
| - [ ] Local checks pass (`pytest`, `ruff check`, `ruff format --check`, `ty check`) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,78 +1,77 @@ | ||
| name: Continuous Integration | ||
| name: CI | ||
|
|
||
| on: [pull_request] | ||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| env: | ||
| UV_FROZEN: "true" | ||
|
|
||
| jobs: | ||
| pytest: | ||
| lint: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| python-version: ['3.9', '3.10', '3.11'] | ||
| timeout-minutes: 10 | ||
| steps: | ||
| - uses: actions/checkout@v2 | ||
| - name: Set up Python ${{ matrix.python-version }} | ||
| uses: actions/setup-python@v2 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install -r blqs/requirements.txt | ||
| cat blqs_cirq/requirements.txt | grep -v blqs | xargs pip install | ||
| cat ci/requirements-dev.txt | grep pytest | xargs pip install | ||
| - name: Test with pytest | ||
| run: | | ||
| pytest blqs blqs_cirq | ||
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | ||
| with: | ||
| persist-credentials: false | ||
| - uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 | ||
| with: | ||
| enable-cache: true | ||
| - run: uv sync | ||
| - run: uv run ruff check | ||
| - run: uv run ruff format --check | ||
|
|
||
| format: | ||
| type-check: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 10 | ||
| steps: | ||
| - uses: actions/checkout@v2 | ||
| - name: Set up Python ${{ matrix.python-version }} | ||
| uses: actions/setup-python@v2 | ||
| with: | ||
| python-version: '3.11' | ||
| architecture: 'x64' | ||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| cat ci/requirements-dev.txt | grep black | xargs pip install | ||
| - name: Check format | ||
| run: | | ||
| black --check --line-length=100 blqs blqs_cirq | ||
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | ||
| with: | ||
| persist-credentials: false | ||
| - uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 | ||
| with: | ||
| enable-cache: true | ||
| - run: uv sync | ||
| - run: uv run ty check | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (minor:) why is this a separate step from |
||
|
|
||
| type-check: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 10 | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| python-version: ["3.11", "3.12", "3.13"] | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why no 3.14? |
||
| steps: | ||
| - uses: actions/checkout@v2 | ||
| - name: Set up Python ${{ matrix.python-version }} | ||
| uses: actions/setup-python@v2 | ||
| with: | ||
| python-version: '3.11' | ||
| architecture: 'x64' | ||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install -r ci/requirements-dev.txt | ||
| pip install -r blqs/requirements.txt | ||
| cat blqs_cirq/requirements.txt | grep -v blqs | xargs pip install | ||
| - name: Run type checking | ||
| run: | | ||
| mypy --config-file=ci/mypy.ini blqs/blqs blqs_cirq/blqs_cirq | ||
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | ||
| with: | ||
| persist-credentials: false | ||
| - uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
| enable-cache: true | ||
| - run: uv sync | ||
| - run: uv run pytest | ||
|
|
||
| lint: | ||
| audit: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 10 | ||
| steps: | ||
| - uses: actions/checkout@v2 | ||
| - name: Set up Python ${{ matrix.python-version }} | ||
| uses: actions/setup-python@v2 | ||
| with: | ||
| python-version: '3.11' | ||
| architecture: 'x64' | ||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| cat ci/requirements-dev.txt | grep pylint | xargs pip install | ||
| - name: Run linting | ||
| run: | | ||
| pylint --rcfile=ci/.pylintrc blqs_cirq/blqs_cirq/ blqs/blqs | ||
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | ||
| with: | ||
| persist-credentials: false | ||
| - uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 | ||
| with: | ||
| enable-cache: true | ||
| - run: uv sync | ||
| # Audit the resolved dependency set; the two editable workspace packages | ||
| # aren't on PyPI, so skip them. | ||
| - run: uv run --with pip-audit pip-audit --skip-editable | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| name: Release | ||
|
|
||
| # Publishes one distribution per tag via PyPI Trusted Publishing (OIDC, no | ||
| # tokens). Tag scheme (the two dists version independently): | ||
| # blqs-vX.Y.Z -> publishes the `blqs` package | ||
| # blqs-cirq-vX.Y.Z -> publishes the `blqs-cirq` package | ||
| # The tag version must match that package's blqs*/_version.py or the run fails. | ||
| # | ||
| # One-time setup on PyPI: configure a Trusted Publisher for each project | ||
| # (owner ionq, repo blqs, workflow release.yml, environment pypi). | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - "blqs-v*" | ||
| - "blqs-cirq-v*" | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| release: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 10 | ||
| environment: pypi | ||
| permissions: | ||
| id-token: write # required for Trusted Publishing | ||
| steps: | ||
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Resolve package from tag and verify version | ||
| id: resolve | ||
| run: | | ||
| tag="${GITHUB_REF_NAME}" | ||
| if [[ "$tag" == blqs-cirq-v* ]]; then | ||
| pkg="blqs-cirq"; dir="blqs_cirq"; ver="${tag#blqs-cirq-v}" | ||
| elif [[ "$tag" == blqs-v* ]]; then | ||
| pkg="blqs"; dir="blqs"; ver="${tag#blqs-v}" | ||
| else | ||
| echo "::error::Unrecognized tag '$tag'"; exit 1 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does this error now abort the entire workflow? i.e., will no tags be published to PyPi? |
||
| fi | ||
| actual="$(grep -oE '__version__ = "[^"]+"' "$dir/$dir/_version.py" | cut -d'"' -f2)" | ||
| if [[ "$ver" != "$actual" ]]; then | ||
| echo "::error::Tag version '$ver' != $dir/_version.py '$actual'"; exit 1 | ||
| fi | ||
| echo "package=$pkg" >> "$GITHUB_OUTPUT" | ||
| echo "Releasing $pkg $ver" | ||
|
|
||
| - uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 | ||
|
|
||
| - name: Build the distribution | ||
| run: uv build --package "${{ steps.resolve.outputs.package }}" --out-dir dist | ||
|
|
||
| - name: Publish to PyPI | ||
| uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # Run `uvx pre-commit install` once to enable. Mirrors the lint/format gates in CI. | ||
| repos: | ||
| - repo: https://github.com/astral-sh/ruff-pre-commit | ||
| rev: v0.15.16 | ||
| hooks: | ||
| - id: ruff-check | ||
| args: [--fix] | ||
| - id: ruff-format |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # Changelog | ||
|
|
||
| All notable changes to `blqs` and `blqs-cirq` are documented here. The format is | ||
| based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and both | ||
| packages follow [Semantic Versioning](https://semver.org/spec/v2.0.0.html). They | ||
| version independently; releases are tagged `blqs-vX.Y.Z` and `blqs-cirq-vX.Y.Z`. | ||
|
|
||
| ## [Unreleased] | ||
|
|
||
| ### Added | ||
|
|
||
| - Type information now ships with both packages (PEP 561 `py.typed` markers), so | ||
| downstream code type-checks against `blqs` and `blqs-cirq`. | ||
| - `blqs-cirq` wraps the gates added in cirq 1.6: `UniformSuperpositionGate`, and | ||
| the Google gates `WillowGate`, `AnalogDetuneQubit`, and `AnalogDetuneCouplerOnly`. | ||
|
|
||
| ### Changed | ||
|
|
||
| - **Minimum Python is now 3.11** (previously 3.7). Tested on 3.11 - 3.13. | ||
| - `blqs-cirq` now supports `cirq` and `cirq-google` `>=1.6,<2` (previously pinned | ||
| to 1.2.0). | ||
| - Packaging moved from `setup.py`/`requirements.txt` to `pyproject.toml` in a | ||
| uv workspace; development tooling is now `ruff` (lint + format) and `ty` | ||
| (type check), with a coverage gate. See `CONTRIBUTING.md`. | ||
|
|
||
| ### Removed | ||
|
|
||
| - Unused runtime dependencies `astor` and `pytype`. | ||
|
|
||
| ## [0.1.0] | ||
|
|
||
| - Initial release of `blqs` and `blqs-cirq`. |
Uh oh!
There was an error while loading. Please reload this page.