From 11b367aaaef292768e0338cf804b13cbc57633b8 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Sun, 29 Sep 2024 02:11:13 -0400 Subject: [PATCH] ci: faster with uv Signed-off-by: Henry Schreiner --- .github/workflows/ci.yml | 20 +++++++++----------- noxfile.py | 9 +++++++-- pyproject.toml | 1 + src/particle/_compat/typing.py | 1 + 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ceb4254d..0d18ca56 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,7 +35,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest] + os: [ubuntu-latest, macos-latest, windows-latest] python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] include: - {os: macos-13, python-version: '3.8'} @@ -52,14 +52,10 @@ jobs: with: python-version: ${{ matrix.python-version }} - - name: Install package - run: python -m pip install -e .[test] - - - name: Requirements list - run: python -m pip list + - uses: astral-sh/setup-uv@v3 - name: Test package - run: python -m pytest ./tests --cov=src/particle --cov-report=xml + run: uvx nox -s tests --force-python=${{ matrix.python-version }} - name: Test coverage with Codecov uses: codecov/codecov-action@v4 @@ -67,8 +63,8 @@ jobs: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - name: Test docstrings with doctest - if: "runner.os == 'Linux' && matrix.python-version == 3.12" - run: python -m pytest --doctest-modules src/particle --ignore=src/particle/particle/convert.py + if: runner.os == 'Linux' && matrix.python-version == '3.12' + run: uvx nox -s tests --doctest-modules src/particle --ignore=src/particle/particle/convert.py notebooks: runs-on: ubuntu-latest @@ -82,11 +78,13 @@ jobs: with: python-version: "3.x" + - uses: astral-sh/setup-uv@v3 + - name: Install package - run: python -m pip install -e .[test] + run: uv pip install --system -e .[test] - name: Install notebook requirements - run: python -m pip install nbconvert jupyter_client ipykernel + run: uv pip install --system nbconvert jupyter_client ipykernel - name: Run the notebooks inplace run: jupyter nbconvert --execute --inplace notebooks/*.ipynb diff --git a/noxfile.py b/noxfile.py index 3165fdab..2900bdc7 100644 --- a/noxfile.py +++ b/noxfile.py @@ -5,6 +5,8 @@ import nox nox.options.sessions = ["lint", "pylint", "tests"] +nox.needs_version = ">=2024.4.15" +nox.options.default_venv_backend = "uv|virtualenv" @nox.session @@ -19,7 +21,7 @@ def pylint(session: nox.Session) -> None: Run pylint. """ - session.install("pylint~=2.15.0") + session.install("pylint~=3.3.0") session.install("-e", ".[dev]") session.run("pylint", "src", *session.posargs) @@ -29,6 +31,9 @@ def tests(session: nox.Session) -> None: session.install("-e", ".[test]") session.run( "pytest", + "--cov=src/particle", + "--cov-report=xml", + "--cov-report=term", *session.posargs, ) @@ -47,7 +52,7 @@ def build(session: nox.Session) -> None: ) -@nox.session(python="3.8") +@nox.session(python="3.8", venv_backend="virtualenv") def zipapp(session: nox.Session) -> None: tmpdir = session.create_tmp() diff --git a/pyproject.toml b/pyproject.toml index 40327ebd..d18343d3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -137,6 +137,7 @@ messages_control.disable = [ "too-many-instance-attributes", "too-many-lines", "too-many-locals", + "too-many-positional-arguments", "too-many-public-methods", "too-many-return-statements", "too-many-statements", diff --git a/src/particle/_compat/typing.py b/src/particle/_compat/typing.py index 5f621cc3..ba21e2a0 100644 --- a/src/particle/_compat/typing.py +++ b/src/particle/_compat/typing.py @@ -11,6 +11,7 @@ if sys.version_info < (3, 9): from importlib_resources.abc import Traversable elif sys.version_info < (3, 11): + # pylint: disable-next=deprecated-class from importlib.abc import Traversable else: from importlib.resources.abc import Traversable