Skip to content

Commit

Permalink
ci: use uv in a few places
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <[email protected]>
  • Loading branch information
henryiii committed Mar 28, 2024
1 parent 75cc393 commit 23faefa
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
- "3.10"
- "3.11"
- "3.12"

name: Check Python ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v4
Expand All @@ -47,19 +48,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: up 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
18 changes: 7 additions & 11 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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.
Expand Down Expand Up @@ -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()
Expand All @@ -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)

0 comments on commit 23faefa

Please sign in to comment.