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 <[email protected]>
  • Loading branch information
henryiii committed Sep 29, 2024
1 parent 5ee36da commit de1ce90
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 20 deletions.
50 changes: 32 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
include:
- {os: macos-13, python-version: '3.8'}
- {os: macos-13, python-version: '3.12'}
- {os: windows-latest, python-version: '3.8'}
- {os: windows-latest, python-version: '3.12'}
os: [ubuntu-latest, macos-latest, windows-latest]

steps:
- uses: actions/checkout@v4
Expand All @@ -50,25 +44,43 @@ jobs:

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
python-version: |
3.8
3.9
3.10
3.11
3.12
3.13
- name: Install package
run: python -m pip install -e .[test]
- uses: astral-sh/setup-uv@v3

- name: Python 3.8
run: uvx nox -s tests --force-python=3.8

- name: Python 3.9
run: uvx nox -s tests --force-python=3.9

- name: Requirements list
run: python -m pip list
- name: Python 3.10
run: uvx nox -s tests --force-python=3.10

- name: Test package
run: python -m pytest ./tests --cov=src/particle --cov-report=xml
- name: Python 3.11
run: uvx nox -s tests --force-python=3.11

- name: Python 3.12
run: uvx nox -s tests --force-python=3.12

- name: Python 3.13
run: uvx nox -s tests --force-python=3.13

- 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'
run: uvx nox -s tests --force-python=3.12 -- --doctest-modules src/particle --ignore=src/particle/particle/convert.py

notebooks:
runs-on: ubuntu-latest
Expand All @@ -82,11 +94,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="pip")
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 de1ce90

Please sign in to comment.