Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions .github/workflows/test_and_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@ on:
pull_request:
branches:
- main
- dev

jobs:
ci:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
python-version: [ '3.10', '3.11', '3.12' ]
os: [ ubuntu-latest, macos-latest, windows-latest ]
python-version: [ '3.12' ]
steps:
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -20,6 +23,6 @@ jobs:
- name: Install dependencies
run: uv sync
- name: Run linter checks
run: uv run flake8 . && uv run interrogate --verbose .
run: uv run ruff check . && uv run ruff format --check . && uv run interrogate --verbose .
- name: Run tests and coverage
run: uv run coverage run -m unittest discover && uv run coverage report
run: uv run coverage run -m pytest && uv run coverage report
30 changes: 20 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,43 @@

### Linters and testing

There are several libraries used to run linters, check documentation, and run tests.
This project uses [uv](https://docs.astral.sh/uv/) to manage its environment and
[ruff](https://docs.astral.sh/ruff/) for linting and formatting.

- Please test your changes using the **coverage** library, which will run the tests and log a coverage report:
- Install dependencies (including the `dev` group):

```bash
coverage run -m unittest discover && coverage report
uv sync
```

- Run tests with **pytest** under **coverage**:

```bash
uv run coverage run -m pytest && uv run coverage report
```

- Use **interrogate** to check that modules, methods, etc. have been documented thoroughly:

```bash
interrogate .
uv run interrogate .
```

- Use **flake8** to check that code is up to standards (no unused imports, etc.):
- Use **ruff** to lint the code (catches unused imports, style issues, sorts imports, etc.):

```bash
flake8 .
uv run ruff check .
```

- Use **black** to automatically format the code into PEP standards:
- Use **ruff** to automatically format the code:

```bash
black .
uv run ruff format .
```

- Use **isort** to automatically sort import statements:
- To apply ruff's autofixes in one shot:

```bash
isort .
uv run ruff check --fix . && uv run ruff format .
```

### Pull requests
Expand Down
Loading
Loading