diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 079b9cf3..0c1314de 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,18 +14,20 @@ concurrency: cancel-in-progress: true jobs: - pre-commit: + pylint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 + - name: Setup uv + uses: yezz123/setup-uv@v4 with: - python-version: "3.x" - - uses: pre-commit/action@v3.0.1 + uv-venv: ".venv" + - name: Install nox + run: uv pip install nox - name: PyLint run: | echo "::add-matcher::$GITHUB_WORKSPACE/.github/matchers/pylint.json" - pipx run nox -s pylint + nox -s pylint checks: runs-on: ubuntu-latest @@ -38,6 +40,7 @@ jobs: - "3.10" - "3.11" - "3.12" + name: Check Python ${{ matrix.python-version }} steps: - uses: actions/checkout@v4 @@ -47,19 +50,22 @@ jobs: python-version: ${{ matrix.python-version }} allow-prereleases: true + - name: Setup uv + uses: yezz123/setup-uv@v4 + with: + uv-venv: ".venv" + - name: Requirements check - run: python -m pip list + run: uv pip list - name: Install package - run: python -m pip install -e ".[test]" + run: uv pip install -e ".[test]" - name: Test package run: python -m pytest - name: Install plotting requirements too - if: matrix.python-version != '3.12' - run: python -m pip install -e ".[test,plot]" + run: uv pip install -e ".[test,plot]" - name: Test plotting too - if: matrix.python-version != '3.12' run: python -m pytest --mpl diff --git a/noxfile.py b/noxfile.py index 416194c5..e2e6f7e3 100644 --- a/noxfile.py +++ b/noxfile.py @@ -7,10 +7,9 @@ import nox -ALL_PYTHONS = ["3.7", "3.8", "3.9", "3.10", "3.11"] - +nox.needs_version = ">=2024.3.2" nox.options.sessions = ["lint", "tests"] - +nox.options.default_venv_backend = "uv|virtualenv" DIR = Path(__file__).parent.resolve() @@ -35,7 +34,7 @@ def pylint(session: nox.Session) -> None: session.run("pylint", "hist", *session.posargs) -@nox.session(python=ALL_PYTHONS, reuse_venv=True) +@nox.session(reuse_venv=True) def tests(session): """ Run the unit and regular tests. @@ -102,12 +101,9 @@ def build(session): Build an SDist and wheel. """ - build_p = DIR.joinpath("build") - if build_p.exists(): - shutil.rmtree(build_p) - - session.install("build") - session.run("python", "-m", "build") + args = [] if shutil.which("uv") else ["uv"] + session.install("build==1.2.0", *args) + session.run("python", "-m", "build", "--installer=uv") @nox.session() @@ -130,6 +126,6 @@ def boost(session): session.chdir("boost-histogram") session.install(".") session.chdir(DIR) - session.install("-e.[test,plot]") + session.install("-e.[test,plot]", "pip") session.run("pip", "list") session.run("pytest", *session.posargs)