Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
4823984
Move most setup.py content into pyproject.toml
google-labs-jules[bot] Nov 18, 2025
26620d6
Merge branch 'main' into mh-more-pyproject
mhucka Nov 24, 2025
73d09dd
Use more setuptools and pip features
mhucka Jan 1, 2026
ec48e0c
Read version number from qsimcirq/_version.py
mhucka Jan 1, 2026
3bce1cb
Bump actions/setup-python from 6.0.0 to 6.1.0 (#964)
dependabot[bot] Dec 1, 2025
77eee39
Remove OSV scanner workflow (#966)
mhucka Dec 30, 2025
586bfa2
Update .gemini/styleguide.md (#972)
mhucka Dec 30, 2025
3a61840
Add more runner names to `/.github/actionlint.yaml` (#970)
mhucka Dec 30, 2025
6844a8b
Add new, larger Windows runners to `.github/actionlint.yaml` (#975)
mhucka Dec 30, 2025
6fd22b7
Remove requirements files from MANIFEST.in
mhucka Jan 1, 2026
942584a
Replace `pip install -r requirements` with `pip install --group dev`
mhucka Jan 1, 2026
87826c7
Add cibuildwheel to dev requirements
mhucka Jan 1, 2026
7b66cf0
Remove unnecessary `cache-dependency-path` setting for setup-python
mhucka Jan 1, 2026
6b1791d
Remove no-longer-needed dev-requirements.txt
mhucka Jan 1, 2026
bc414de
Make dependencies be read from requirements.txt
mhucka Jan 1, 2026
6cc391a
Add more dependency constraints to deal with conflicts
mhucka Jan 1, 2026
7dadaf6
Speed up pytest in cibuildwheel by using parallelism
mhucka Jan 1, 2026
c1cf90b
Update installation commands in Dockerfile
mhucka Jan 1, 2026
97be565
Put back requirements.txt into MANIFEST.in
mhucka Jan 1, 2026
8f2792b
Put back installation of requirements.txt
mhucka Jan 1, 2026
c796145
Fix typo and an ambiguity
mhucka Jan 1, 2026
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
58 changes: 36 additions & 22 deletions .gemini/styleguide.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,29 @@
# qsim style guide

This style guide outlines the coding conventions for this project. There are
separate subsections for Python, C++, and other file types below.
This style guide for Gemini outlines the coding conventions for this project.

## General guidance

### Overall principles

* _Readability_: Code should be easy to understand for all team members.
* _Readability_: Code must be easy for humans to understand. Prefer clarity
over cleverness. Write elegant, well-structured code.

* _Maintainability_: Code should be easy to modify and extend.
* _Maintainability_: Code must be easy to modify and extend.

* _Consistency_: Adhering to a consistent style across all projects improves
collaboration and reduces errors.
* _Consistency_: Be consistent with naming convention, style, and other
patterns in the code base.

* _Performance_: While readability is paramount, code should be efficient.

### Overall development approach

* Code should be modular and adhere to language idioms and best practices.

* Data obtained from the user or read from a file should be validated.
Identify and guard against potential vulnerabilities in data handling or
input validation.

* When new functions, classes, and files are introduced, they should also
have corresponding tests. Existing tests must continue to pass (or be
updated) when changes are introduced, and code should be covered by tests.
Expand All @@ -28,16 +34,16 @@ separate subsections for Python, C++, and other file types below.

* Tests must be independent and must not rely on the state of other tests.
Setup and teardown functions should be used to create a clean environment
for each test run. External dependencies (e.g., databases, network
services, file system) must be mocked to ensure the test is isolated to the
unit under test.
for each test run. External dependencies (e.g., databases, network services,
file system) must be mocked to ensure the test is isolated to the unit under
test.

* Make sure to cover edge cases: write tests for invalid inputs, null values,
empty arrays, zero values, and off-by-one errors.

* Use asserts intelligently. Test assertions should be specific: instead of
just asserting `true`, assert that a specific value equals an expected
value. Provide meaningful failure messages.
* Use asserts in tests intelligently. Test assertions should be specific:
instead of just asserting `true`, assert that a specific value equals an
expected value. Provide meaningful failure messages.

### Overall code format conventions

Expand Down Expand Up @@ -77,7 +83,7 @@ present at the top level of this project repository):

* [`.yamllint.yaml`](../.yamllint.yaml) for YAML files.

### Overall code commenting conventions
### Overall code comment conventions

Every source file must begin with a header comment with the copyright and
license. We use the Apache 2.0 license. Here is an example of the required file
Expand All @@ -99,23 +105,20 @@ header for a Python language code file:
# limitations under the License.
```

License headers are necessary on Python, C++, Bash/shell, and other programming
License headers are necessary in Python, C++, Bash/shell, and other programming
language files, as well as configuration files in YAML, TOML, ini, and other
config file formats. They are not necessary in Markdown or plain text files.

For comments in other parts of the files, follow these guidelines:

* _Write clear and concise comments_: Comments should explain the "why", not
the "what". The code itself shows what it's doing. The comments should
explain the intent, trade-offs, and reasoning behind the implementation.
the "what". The comments should explain the intent, trade-offs, and
reasoning behind the implementation.

* _Comment sparingly_: Well-written code should be self-documenting where
possible. It's not necessary to add comments for code fragments that can
reasonably be assumed to be self-explanatory.

* _Use complete sentences_: Start comments with a capital letter, use
proper punctuation, and use proper grammar.

## Python-specific guidance

This section outlines coding conventions for Python code in this project.
Expand Down Expand Up @@ -161,9 +164,9 @@ naming, we can reduce cognitive load on human users and developers.
amplitudes. If a function expects a NumPy array of amplitudes, its type
annotation should be `np.ndarray`.

### Docstrings and documentation
### Python docstrings and documentation

For Python code, this project uses [Google style doc strings](
This project uses [Google style doc strings](
http://google.github.io/styleguide/pyguide.html#381-docstrings) with a Markdown
flavor and support for LaTeX. Docstrings use tripe double quotes, and the first
line should be a concise one-line summary of the function or object.
Expand Down Expand Up @@ -227,7 +230,7 @@ The following programs can be used to perform some automated formatting.

### Python type annotations

This project makes extensive use of type annotations as defined by [PEP 484](
This project uses type annotations as defined by [PEP 484](
https://peps.python.org/pep-0484/). All new code should use type annotations
where possible, especially on public classes and functions to serve as
documentation, but also on internal code so that the `mypy` type checker can
Expand Down Expand Up @@ -298,3 +301,14 @@ To build tests without running them, instead use:
```shell
bzel build tests:all
```

## Shell script-specific guidance

Shell scripts should use Bash.

### Shell script formatting

Use the [Google Shell Style Guide](
https://google.github.io/styleguide/shellguide.html) with the following changes:

* Use indentation of 4 spaces, not 2.
32 changes: 27 additions & 5 deletions .github/actionlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,35 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Summary: config actionlint (https://github.com/rhysd/actionlint) for certain
# things we use.
# Summary: configure actionlint (https://github.com/rhysd/actionlint) to
# recognize action runner names/labels that we use.

self-hosted-runner:
# We don't have self-hosted runners, but we do use some of the "partner"
# runner images from https://github.com/actions/partner-runner-images
# and some runners that actionlint doesn't currently recognize.
labels:
# Defined in Quantumlib org.
- ubuntu-22.04-arm64-2-core
- ubuntu-22.04-arm64-8-core
- ubuntu-22.04-arm64-16-core

- ubuntu-22.04-x64-2-core
- ubuntu-22.04-x64-8-core
- ubuntu-22.04-x64-16-core

- ubuntu-24.04-arm64-2-core
- ubuntu-24.04-arm64-8-core
- ubuntu-24.04-arm64-16-core

- ubuntu-24.04-x64-2-core
- ubuntu-24.04-x64-8-core
- ubuntu-24.04-x64-16-core

- windows-2022-x64-8-core
- windows-2025-x64-8-core
- windows-2025-x64-16-core

# From https://github.com/actions/partner-runner-images
- ubuntu-24.04-arm

# New from GitHub (late 2025) but currently not known by actionlint.
# https://docs.github.com/en/actions/reference/runners/github-hosted-runners
- ubuntu-slim
48 changes: 28 additions & 20 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,18 @@
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v5
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v5
with:
python-version: ${{env.python-version}}
cache: pip
cache-dependency-path: |
requirements.txt
dev-requirements.txt

- name: Upgrade pip
run: python -m pip install --upgrade pip

- name: Install dependencies
run: pip install -r requirements.txt -r dev-requirements.txt
run: |
pip install -r requirements.txt
pip install --group dev
- name: Check format
continue-on-error: ${{inputs.soft-linting == 'true'}}
Expand Down Expand Up @@ -230,17 +232,19 @@
submodules: recursive

- name: Set up Python
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v5
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v5
id: setup
with:
python-version: ${{matrix.python_version}}
cache: pip
cache-dependency-path: |
requirements.txt
dev-requirements.txt

- name: Upgrade pip
run: python -m pip install --upgrade pip

- name: Install dependencies
run: pip install -r requirements.txt -r dev-requirements.txt
run: |
pip install -r requirements.txt
pip install --group dev
- name: Set up Bazel
uses: './.github/actions/set-up-bazel'
Expand Down Expand Up @@ -316,16 +320,18 @@
submodules: recursive

- name: Set up Python
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v5
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v5
with:
python-version: ${{env.python-version}}
cache: pip
cache-dependency-path: |
requirements.txt
dev-requirements.txt

- name: Upgrade pip
run: python -m pip install --upgrade pip

- name: Install dependencies
run: pip install -r requirements.txt -r dev-requirements.txt
run: |
pip install -r requirements.txt
pip install --group dev
- name: Set up Bazel
uses: './.github/actions/set-up-bazel'
Expand Down Expand Up @@ -371,16 +377,18 @@
submodules: recursive

- name: Set up Python
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v5
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v5
with:
python-version: ${{env.python-version}}
cache: pip
cache-dependency-path: |
requirements.txt
dev-requirements.txt

- name: Upgrade pip
run: python -m pip install --upgrade pip

- name: Install dependencies
run: pip install -r requirements.txt -r dev-requirements.txt
run: |
pip install -r requirements.txt
pip install --group dev
- name: Set up Bazel
uses: './.github/actions/set-up-bazel'
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/cirq_compatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,21 @@
submodules: recursive

- name: Set up Python with caching of pip dependencies
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v5
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v5
with:
python-version: '3.12'
cache: pip
cache-dependency-path: |
requirements.txt
dev-requirements.txt

- name: Upgrade pip
run: python -m pip install --upgrade pip

- name: Install latest dev version of Cirq
run: pip install --upgrade cirq~=1.0.dev

- name: Install qsim dev requirements
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install -r dev-requirements.txt
pip install --group dev
- name: Run Python tests
env:
Expand Down
Loading
Loading