Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
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.
validations:
required: true
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
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
about: Ask usage questions and discuss ideas here.
24 changes: 24 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
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?
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.
validations:
required: true
- type: textarea
id: alternatives
attributes:
label: Alternatives considered
validations:
required: false
17 changes: 17 additions & 0 deletions .github/dependabot.yml
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: ["*"]
14 changes: 14 additions & 0 deletions .github/pull_request_template.md
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`)
127 changes: 63 additions & 64 deletions .github/workflows/blqs-ci.yml
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

type-check:
test:
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12", "3.13"]
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
57 changes: 57 additions & 0 deletions .github/workflows/release.yml
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
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
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
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
32 changes: 32 additions & 0 deletions CHANGELOG.md
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`.
Loading
Loading