Skip to content

Commit

Permalink
build: migrate to uv (#284)
Browse files Browse the repository at this point in the history
* build: migrate to uv

* build: restore phirc optional deps

* ci: disable docs build on windows
  • Loading branch information
qartik authored Feb 3, 2025
1 parent 601690d commit 77eea69
Show file tree
Hide file tree
Showing 7 changed files with 1,447 additions and 47 deletions.
15 changes: 7 additions & 8 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,22 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
enable-cache: true
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
python -m pip install -e .
uv sync --all-extras --dev
- name: Pre-commit checks
run: |
pre-commit run --all-files
uv run pre-commit run --all-files
- name: Run tests
run: |
python -m pytest
uv run pytest
- name: Sphinx documentation build
if: ${{ matrix.os != 'windows-latest' }}
run: |
make docs
- name: Deploy to GitHub Pages
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ repos:
- id: debug-statements

- repo: https://github.com/crate-ci/typos
rev: typos-v0.10.34
rev: typos-dict-v0.12.4
hooks:
- id: typos

Expand Down
18 changes: 9 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
.PHONY: install dev dev-all tests lint docs clean build

install:
pip install .
uv pip install .

dev:
pip install -e .
uv pip install -e .

dev-all:
pip install -e .[phirc]
uv pip install -e .[phirc]

tests:
python tests/e2e_test.py
pytest -s -x -vv tests/test*.py
uv run python tests/e2e_test.py
uv run pytest -s -x -vv tests/test*.py

lint:
pre-commit run --all-files
uv run pre-commit run --all-files

docs:
# sphinx-apidoc --implicit-namespaces -f -o docs/source/ pytket
sphinx-build -M html docs/source/ docs/build/
# uv run sphinx-apidoc --implicit-namespaces -f -o docs/source/ pytket
uv run sphinx-build -M html docs/source/ docs/build/

clean:
rm -rf *.egg-info dist build docs/build

build: clean
python -m build --sdist --wheel -n
uv build
15 changes: 3 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,12 @@ options:
Clone the repository and run:
```sh
python -m venv .venv
source .venv/bin/activate
pip install -U pip setuptools
pip install -r requirements.txt
pre-commit install
```
Then, install the project using:
```sh
pip install -e .
uv sync
uv run pre-commit install
```
See `Makefile` for other useful commands.
## Testing
Issue `pytest` from the root directory.
Issue `make tests` from the root directory.
17 changes: 12 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,16 @@ dependencies = [
"phir>=0.3.3",
"pytket>=1.34.0,<2",
"wasmtime>=19.0.0",
]
]

[project.optional-dependencies]
docs = ["sphinx", "pydata_sphinx_theme"]
phirc = ["projectq", "quantum-pecos>=0.6.0.dev2"]
tests = ["pytest"]
[dependency-groups]
dev = [
"networkx<3",
"pre-commit==4.1.0",
"pydata-sphinx-theme>=0.16.1",
"pytest==8.3.4",
"sphinx>=8.1.3",
]

[project.scripts]
phirc = "pytket.phir.cli:main"
Expand All @@ -45,6 +49,9 @@ Changelog = "https://github.com/CQCL/pytket-phir/blob/main/CHANGELOG.md"
Documentation = "https://cqcl.github.io/pytket-phir/"
Repository = "https://github.com/CQCL/pytket-phir.git"

[project.optional-dependencies]
phirc = ["projectq>=0.8.0", "quantum-pecos>=0.6.0.dev2"]

[tool.setuptools.packages.find]
where = ["."]

Expand Down
12 changes: 0 additions & 12 deletions requirements.txt

This file was deleted.

Loading

0 comments on commit 77eea69

Please sign in to comment.