Skip to content

Commit 1eeb986

Browse files
authored
✨ Adopt uv in CI (#368)
## Description This PR updates the CI configuration to use uv by Astral (the creators of ruff), which is an extremely fast Python package installer and resolver, written in Rust. It is sesigned as a drop-in replacement for common pip and pip-tools workflows. See https://github.com/astral-sh/uv Similar to ruff, it is extremely fast and in very active development. This should speed up any of the Python-based CI runs without much confirguration overhead. This PR refactors the `minimums` check to make use of `uv`'s `--resolution=lowest-direct" feature. This allows us to completely get rid of the `constraints.txt` file. Furthermore, it makes use of the new versions of `mqt-core`'s reusable workflows. ## Checklist: <!--- This checklist serves as a reminder of a couple of things that ensure your pull request will be merged swiftly. --> - [x] The pull request only contains commits that are related to it. - [x] I have added appropriate tests and documentation. - [x] I have made sure that all CI jobs on GitHub pass. - [x] The pull request introduces no new warnings and follows the project's style guidelines. --------- Signed-off-by: burgholzer <[email protected]>
1 parent d1bcc8f commit 1eeb986

File tree

5 files changed

+20
-18
lines changed

5 files changed

+20
-18
lines changed

.github/codecov.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ flag_management:
3333
- name: python
3434
paths:
3535
- "src/mqt/**/*.py"
36-
after_n_builds: 3
36+
after_n_builds: 12
3737
statuses:
3838
- type: project
3939
threshold: 0.5%

extern/mqt-core

noxfile.py

+17-10
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import argparse
66
import os
7+
import shutil
78
import sys
89
from typing import TYPE_CHECKING
910

@@ -12,6 +13,9 @@
1213
if TYPE_CHECKING:
1314
from collections.abc import Sequence
1415

16+
nox.needs_version = ">=2024.3.2"
17+
nox.options.default_venv_backend = "uv|virtualenv"
18+
1519
nox.options.sessions = ["lint", "tests"]
1620

1721
PYTHON_ALL_VERSIONS = ["3.8", "3.9", "3.10", "3.11", "3.12"]
@@ -49,6 +53,11 @@ def _run_tests(
4953
if os.environ.get("CI", None) and sys.platform == "win32":
5054
env["SKBUILD_CMAKE_ARGS"] = "-T ClangCL"
5155

56+
if shutil.which("cmake") is None and shutil.which("cmake3") is None:
57+
session.install("cmake")
58+
if shutil.which("ninja") is None:
59+
session.install("ninja")
60+
5261
_extras = ["test", *extras]
5362
if "--cov" in posargs:
5463
_extras.append("coverage")
@@ -66,29 +75,27 @@ def tests(session: nox.Session) -> None:
6675
_run_tests(session)
6776

6877

69-
@nox.session()
78+
@nox.session(reuse_venv=True, venv_backend="uv")
7079
def minimums(session: nox.Session) -> None:
7180
"""Test the minimum versions of dependencies."""
7281
_run_tests(
7382
session,
74-
install_args=["--constraint=test/python/constraints.txt"],
83+
install_args=["--resolution=lowest-direct"],
7584
run_args=["-Wdefault"],
85+
extras=["qiskit", "evaluation"],
7686
)
77-
session.run("pip", "list")
87+
session.run("uv", "pip", "list")
7888

7989

8090
@nox.session(reuse_venv=True)
8191
def docs(session: nox.Session) -> None:
82-
"""Build the docs. Pass "--serve" to serve. Pass "-b linkcheck" to check links."""
92+
"""Build the docs. Use "--non-interactive" to avoid serving. Pass "-b linkcheck" to check links."""
8393
parser = argparse.ArgumentParser()
84-
parser.add_argument("--serve", action="store_true", help="Serve after building")
8594
parser.add_argument("-b", dest="builder", default="html", help="Build target (default: html)")
8695
args, posargs = parser.parse_known_args(session.posargs)
8796

88-
if args.builder != "html" and args.serve:
89-
session.error("Must not specify non-HTML builder with --serve")
90-
91-
extra_installs = ["sphinx-autobuild"] if args.serve else []
97+
serve = args.builder == "html" and session.interactive
98+
extra_installs = ["sphinx-autobuild"] if serve else []
9299
session.install(*BUILD_REQUIREMENTS, *extra_installs)
93100
session.install("--no-build-isolation", "-ve.[docs]")
94101
session.chdir("docs")
@@ -106,7 +113,7 @@ def docs(session: nox.Session) -> None:
106113
*posargs,
107114
)
108115

109-
if args.serve:
116+
if serve:
110117
session.run("sphinx-autobuild", *shared_args)
111118
else:
112119
session.run("sphinx-build", "--keep-going", *shared_args)

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ tnflow = [
5050
"networkx",
5151
]
5252
test = ["pytest>=7.0"]
53-
coverage = ["mqt.ddsim[test]", "pytest-cov"]
53+
coverage = ["mqt.ddsim[test]", "pytest-cov>=4"]
5454
docs = [
5555
"mqt.ddsim[tnflow]",
5656
"furo>=2023.08.17",

test/python/constraints.txt

-5
This file was deleted.

0 commit comments

Comments
 (0)