Skip to content
Merged
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
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# SCM syntax highlighting & preventing 3-way merges
uv.lock merge=binary linguist-language=TOML linguist-generated=true -diff
Comment thread
emlynsg marked this conversation as resolved.
17 changes: 17 additions & 0 deletions .github/actions/setup-uv/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Set up uv
description: Install the pinned version of uv and cache its package cache

runs:
using: composite
steps:
- name: Install uv
shell: bash
run: pip install -r .github/uv-requirements.txt

- name: Cache uv packages
uses: actions/cache@v4
with:
path: ~/.cache/uv
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
restore-keys: |
uv-${{ runner.os }}-
Comment thread
emlynsg marked this conversation as resolved.
6 changes: 5 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
version: 2
updates:
- package-ecosystem: "pip"
- package-ecosystem: "uv"
directory: "/"
schedule:
interval: weekly
groups:
python-packages:
patterns:
- "*"
- package-ecosystem: "pip"
directory: "/.github"
schedule:
interval: "weekly"
ignore:
- dependency-name: "qiskit"
# There is a bug with Mypy and Qiskit 2.4.0
Expand Down
1 change: 1 addition & 0 deletions .github/uv-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
uv==0.11.3
Comment thread
emlynsg marked this conversation as resolved.
15 changes: 5 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,11 @@ jobs:
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0 # Fetch all, necessary to find tags and branches
fetch-depth: 0 # Fetch all, necessary to find tags and branches
fetch-tags: true

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}

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

- name: Setup nox
run: pip install -c requirements-dev.txt nox
- name: Setup uv
uses: ./.github/actions/setup-uv

- run: nox --python ${{ matrix.python }}
- name: Run nox
run: uv run --extra dev nox -db uv --python ${{ matrix.python }}
16 changes: 5 additions & 11 deletions .github/workflows/cov.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: pytest-cov

# Need to include "push"
on: [push, pull_request]

permissions:
Expand All @@ -16,22 +15,17 @@ jobs:
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0 # Fetch all, necessary to find tags and branches
fetch-depth: 0 # Fetch all, necessary to find tags and branches
fetch-tags: true

- name: Set up Python
uses: actions/setup-python@v5
- name: Setup uv
uses: ./.github/actions/setup-uv
with:
enable-cache: true
Comment thread
emlynsg marked this conversation as resolved.
python-version: ${{ env.python-version }}

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

- name: Install graphix with dev deps.
run: pip install .[dev,extra]

- name: Run pytest
run: pytest --cov=./graphix --cov-report=xml --cov-report=term --doctest-modules
run: uv run --extra dev --extra extra pytest --cov=./graphix --cov-report=xml --cov-report=term --doctest-modules

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
Expand Down
35 changes: 15 additions & 20 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,44 +22,39 @@ jobs:
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0 # Fetch all, necessary to find tags and branches
fetch-depth: 0 # Fetch all, necessary to find tags and branches
fetch-tags: true

- uses: actions/setup-python@v5
- name: Setup uv
uses: ./.github/actions/setup-uv
with:
enable-cache: true
python-version: ${{ env.python-version }}

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

- name: Install graphix
run: pip install -e ".[dev,doc]"

- name: Make docs
run: sphinx-build -W docs/source docs/build -j auto
run: uv run --extra dev --extra doc sphinx-build -W docs/source docs/build -j auto

lint-text:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5

- uses: actions/setup-python@v5
- name: Setup uv
uses: ./.github/actions/setup-uv
with:
python-version: ${{ env.python-version }}
enable-cache: true

- name: Run language-agnostic linters
run: |
pip install pre-commit

# Non-fixable
pre-commit run -a check-case-conflict
pre-commit run -a check-yaml
uvx pre-commit run -a check-case-conflict
uvx pre-commit run -a check-yaml

# Fixable
pre-commit run -a end-of-file-fixer || true
pre-commit run -a fix-byte-order-marker || true
pre-commit run -a mixed-line-ending || true
pre-commit run -a trailing-whitespace || true
uvx pre-commit run -a end-of-file-fixer || true
uvx pre-commit run -a fix-byte-order-marker || true
uvx pre-commit run -a mixed-line-ending || true
uvx pre-commit run -a trailing-whitespace || true

- uses: actions/setup-node@v4

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ jobs:
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
with:
python-version: ${{ env.python-version }}
- name: Install pypa/build
Expand Down
37 changes: 15 additions & 22 deletions .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,37 +15,30 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Cache pip dependencies
uses: actions/cache@v4
- uses: actions/checkout@v5
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements-dev.txt') }}
restore-keys: |
${{ runner.os }}-pip-
fetch-depth: 0

- name: Install dependencies
run: python -m pip install --upgrade pip && python -m pip install ruff -c requirements-dev.txt
- name: Setup uv
uses: ./.github/actions/setup-uv
with:
enable-cache: true
cache-dependency-glob: "pyproject.toml"

- name: Run Ruff Linter
run: ruff check --output-format=github
run: uv run --with ruff ruff check --output-format=github

format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Cache pip dependencies
uses: actions/cache@v4
- uses: actions/checkout@v5
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements-dev.txt') }}
restore-keys: |
${{ runner.os }}-pip-
fetch-depth: 0

- name: Install dependencies
run: python -m pip install --upgrade pip && python -m pip install ruff -c requirements-dev.txt
- name: Setup uv
uses: ./.github/actions/setup-uv
with:
enable-cache: true

- name: Run Ruff Formatter Check
run: ruff format --check
run: uv run --with ruff ruff format --check
27 changes: 12 additions & 15 deletions .github/workflows/typecheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,18 @@ jobs:
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0 # Fetch all, necessary to find tags and branches
fetch-depth: 0 # Fetch all, necessary to find tags and branches
fetch-tags: true

- uses: actions/setup-python@v5
- name: Setup uv
uses: ./.github/actions/setup-uv
with:
enable-cache: true
python-version: ${{ env.python-version }}

- run: |
python -m pip install --upgrade pip
pip install -e .[dev,extra,typing]
pip install --no-deps -e .[no-deps]
- run: uv run --extra dev --extra extra --extra typing mypy

- run: mypy

- run: pyright
- run: uv run --extra dev --extra extra --extra typing pyright

# Check that `mypy` find installed `graphix` package (#328)
#
Expand All @@ -54,20 +51,20 @@ jobs:
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0 # Fetch all, necessary to find tags and branches
fetch-depth: 0 # Fetch all, necessary to find tags and branches
fetch-tags: true

- uses: actions/setup-python@v5
- name: Setup uv
uses: ./.github/actions/setup-uv
with:
enable-cache: true
python-version: ${{ env.python-version }}

- name: Install graphix and mypy
run: |
python -m pip install --upgrade pip
pip install .[dev]
run: uv sync --extra dev --no-editable

- name: Test type-checking
run: |
cd ${{ runner.temp }}
echo "from graphix import Pattern" > test_graphix_type.py
mypy test_graphix_type.py
uv run --project ${{ github.workspace }} --no-sync mypy test_graphix_type.py
Comment thread
emlynsg marked this conversation as resolved.
5 changes: 3 additions & 2 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
version: 2

build:
os: ubuntu-20.04
os: ubuntu-24.04
tools:
python: "3.11"

Expand All @@ -15,6 +15,7 @@ sphinx:

python:
install:
- requirements: requirements-doc.txt
- method: pip
path: .
extra_requirements:
- doc
Loading
Loading