From 5b26a1ba2c4c135d86a1fe635d1f67d29b9e9644 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Tue, 16 Jul 2024 23:33:59 -0400 Subject: [PATCH 1/2] ci: Remove unneeded coverage support Co-authored-by: Henry Schreiner --- .github/CONTRIBUTING.md | 8 -------- .github/workflows/ci.yml | 7 +------ pyproject.toml | 2 -- 3 files changed, 1 insertion(+), 16 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index b1f7a9f..07b63df 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -66,14 +66,6 @@ Use pytest to run the unit checks: pytest ``` -# Coverage - -Use pytest-cov to generate coverage reports: - -```bash -pytest --cov=cython-cmake -``` - # Building docs You can build the docs using: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0f31195..a7ce42e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,9 +61,4 @@ jobs: run: python -m pip install .[test] - name: Test package - run: >- - python -m pytest -ra --cov --cov-report=xml --cov-report=term - --durations=20 - - - name: Upload coverage report - uses: codecov/codecov-action@v4.5.0 + run: python -m pytest --durations=20 diff --git a/pyproject.toml b/pyproject.toml index b722c13..580177b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,11 +38,9 @@ any = "cython_cmake.cmake" [project.optional-dependencies] test = [ "pytest >=6", - "pytest-cov >=3", ] dev = [ "pytest >=6", - "pytest-cov >=3", ] docs = [ "sphinx>=7.0", From b087135db33721fa604c6105db693427365ec13f Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Tue, 16 Jul 2024 23:34:40 -0400 Subject: [PATCH 2/2] ci: Speed-up using "uv" instead of "pip" Co-authored-by: Henry Schreiner --- .github/workflows/ci.yml | 4 +++- .pre-commit-config.yaml | 1 + noxfile.py | 9 +++------ pyproject.toml | 11 ++++++----- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a7ce42e..6dee1a7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -57,8 +57,10 @@ jobs: python-version: ${{ matrix.python-version }} allow-prereleases: true + - uses: yezz123/setup-uv@v4 + - name: Install package - run: python -m pip install .[test] + run: uv pip install --system -e.[test] - name: Test package run: python -m pytest --durations=20 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6cf7b00..ef52a37 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -55,6 +55,7 @@ repos: args: [] additional_dependencies: - pytest + - scikit-build-core - repo: https://github.com/codespell-project/codespell rev: "v2.3.0" diff --git a/noxfile.py b/noxfile.py index 1b10b63..7418204 100644 --- a/noxfile.py +++ b/noxfile.py @@ -1,13 +1,14 @@ from __future__ import annotations import argparse -import shutil from pathlib import Path import nox DIR = Path(__file__).parent.resolve() +nox.needs_version = ">=2024.3.2" +nox.options.default_venv_backend = "uv|virtualenv" nox.options.sessions = ["lint", "pylint", "tests"] @@ -38,7 +39,7 @@ def tests(session: nox.Session) -> None: """ Run the unit and regular tests. """ - session.install(".[test]") + session.install("-e.[test]") session.run("pytest", *session.posargs) @@ -109,9 +110,5 @@ def build(session: nox.Session) -> None: Build an SDist and wheel. """ - build_path = DIR.joinpath("build") - if build_path.exists(): - shutil.rmtree(build_path) - session.install("build") session.run("python", "-m", "build") diff --git a/pyproject.toml b/pyproject.toml index 580177b..f1caf73 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,9 +38,8 @@ any = "cython_cmake.cmake" [project.optional-dependencies] test = [ "pytest >=6", -] -dev = [ - "pytest >=6", + "scikit-build-core", + "cython", ] docs = [ "sphinx>=7.0", @@ -62,9 +61,11 @@ version.source = "vcs" build.hooks.vcs.version-file = "src/cython_cmake/_version.py" [tool.hatch.envs.default] -features = ["test"] -scripts.test = "pytest {args}" +installer = "uv" +[tool.hatch.envs.hatch-test] +features = ["test"] +extra-dependencies = ["cmake", "ninja"] [tool.pytest.ini_options] minversion = "6.0"