Skip to content

Commit

Permalink
ci: faster with uv
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
  • Loading branch information
henryiii committed Sep 29, 2024
1 parent 5ee36da commit 11b367a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 13 deletions.
20 changes: 9 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'}
Expand All @@ -52,23 +52,19 @@ 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
env:
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
Expand All @@ -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
Expand Down
9 changes: 7 additions & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)

Expand All @@ -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,
)

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

Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions src/particle/_compat/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Check warning on line 15 in src/particle/_compat/typing.py

View workflow job for this annotation

GitHub Actions / pre-commit

Useless suppression of 'deprecated-class'
else:
from importlib.resources.abc import Traversable
Expand Down

0 comments on commit 11b367a

Please sign in to comment.