Skip to content
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

build: migrate to uv #284

Merged
merged 3 commits into from
Feb 3, 2025
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
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