Skip to content

Commit 6df89fe

Browse files
committed
Switch to using the nox tool for driving linting and testing
1 parent 374ffdd commit 6df89fe

7 files changed

Lines changed: 34 additions & 17 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,6 @@ jobs:
2424
with:
2525
python-version: ${{ matrix.python-version }}
2626
- name: Install dependencies
27-
run: |
28-
python -m pip install --upgrade pip
29-
python -m pip install .
30-
python -m pip install ruff
31-
- name: Lint
32-
run: python -m ruff check .
33-
- name: Test with python unittest
34-
run: python -m unittest
27+
run: python -m pip --disable-pip-version-check install nox
28+
- name: Lint & Test
29+
run: nox

.github/workflows/publish.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ name: Upload Python Package
1010

1111
on:
1212
release:
13-
types: [ published ]
13+
types: [published]
1414

1515
permissions:
1616
contents: read
@@ -25,9 +25,7 @@ jobs:
2525
with:
2626
python-version: '3.9'
2727
- name: Install dependencies
28-
run: |
29-
python -m pip install --upgrade pip
30-
pip install build
28+
run: python -m pip --disable-pip-version-check install build
3129
- name: Build package
3230
run: python -m build
3331
- name: Publish package

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ pip-delete-this-directory.txt
4444

4545
# Unit test / coverage reports
4646
htmlcov/
47+
.nox/
4748
.tox/
49+
.ruff_cache/
4850
.coverage
4951
.coverage.*
5052
.cache

README.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,18 +195,27 @@ with \
195195
```
196196

197197
## Documentation
198+
198199
The full documentation is available in the `docs` folder with a readable version on [Read the Docs](https://trsfile.readthedocs.io/).
199200

200201
## Contributing
201202

202-
### Testing
203-
The library supports Python `unittest` module and the tests can be executed with the following command:
204-
```
205-
python -m unittest
203+
Anyone is free to open a pull request.
204+
205+
### Testing / Developing
206+
207+
The library has tests and a linter has been set up for it. Both can be run with the following command:
208+
209+
```sh
210+
nox
206211
```
207212

213+
Install the `nox` executable (in a virtual environment) using `python -m pip install -r ./requirements.txt`.
214+
208215
### Creating Releases
216+
209217
We use Github Actions to publish packages to PYPy. Read the [Github docs on how to create a new release](https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository) and trigger the publishing workflow:
210218

211219
## License
220+
212221
[BSD 3-Clause Clear License](https://choosealicense.com/licenses/bsd-3-clause-clear/)

noxfile.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import nox
2+
import nox.project
3+
4+
5+
@nox.session(reuse_venv=True)
6+
def lint(session: nox.Session) -> None:
7+
requirements = nox.project.load_toml("pyproject.toml")["project"]["optional-dependencies"]["DEV"]
8+
session.install(*requirements)
9+
session.run("ruff", "check")
10+
session.run("python", "-m", "unittest", "discover")

pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,12 @@ dependencies = [
2929

3030
[project.optional-dependencies]
3131
DEV = [
32+
"m2r2",
33+
"numpy",
34+
"ruff",
3235
"sphinx",
3336
"sphinx-autobuild",
3437
"sphinx_rtd_theme",
35-
"m2r2"
3638
]
3739

3840
[project.urls]

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nox

0 commit comments

Comments
 (0)