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

✨ Adopt uv in CI #368

Merged
merged 3 commits into from
Apr 12, 2024
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: 1 addition & 1 deletion .github/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ flag_management:
- name: python
paths:
- "src/mqt/**/*.py"
after_n_builds: 3
after_n_builds: 12
statuses:
- type: project
threshold: 0.5%
Expand Down
27 changes: 17 additions & 10 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import argparse
import os
import shutil
import sys
from typing import TYPE_CHECKING

Expand All @@ -12,6 +13,9 @@
if TYPE_CHECKING:
from collections.abc import Sequence

nox.needs_version = ">=2024.3.2"
nox.options.default_venv_backend = "uv|virtualenv"

nox.options.sessions = ["lint", "tests"]

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

if shutil.which("cmake") is None and shutil.which("cmake3") is None:
session.install("cmake")
if shutil.which("ninja") is None:
session.install("ninja")

_extras = ["test", *extras]
if "--cov" in posargs:
_extras.append("coverage")
Expand All @@ -66,29 +75,27 @@ def tests(session: nox.Session) -> None:
_run_tests(session)


@nox.session()
@nox.session(reuse_venv=True, venv_backend="uv")
def minimums(session: nox.Session) -> None:
"""Test the minimum versions of dependencies."""
_run_tests(
session,
install_args=["--constraint=test/python/constraints.txt"],
install_args=["--resolution=lowest-direct"],
run_args=["-Wdefault"],
extras=["qiskit", "evaluation"],
)
session.run("pip", "list")
session.run("uv", "pip", "list")


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

if args.builder != "html" and args.serve:
session.error("Must not specify non-HTML builder with --serve")

extra_installs = ["sphinx-autobuild"] if args.serve else []
serve = args.builder == "html" and session.interactive
extra_installs = ["sphinx-autobuild"] if serve else []
session.install(*BUILD_REQUIREMENTS, *extra_installs)
session.install("--no-build-isolation", "-ve.[docs]")
session.chdir("docs")
Expand All @@ -106,7 +113,7 @@ def docs(session: nox.Session) -> None:
*posargs,
)

if args.serve:
if serve:
session.run("sphinx-autobuild", *shared_args)
else:
session.run("sphinx-build", "--keep-going", *shared_args)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ tnflow = [
"networkx",
]
test = ["pytest>=7.0"]
coverage = ["mqt.ddsim[test]", "pytest-cov"]
coverage = ["mqt.ddsim[test]", "pytest-cov>=4"]
docs = [
"mqt.ddsim[tnflow]",
"furo>=2023.08.17",
Expand Down
5 changes: 0 additions & 5 deletions test/python/constraints.txt

This file was deleted.

Loading