Skip to content

Commit

Permalink
Replace all instances of tox with nox
Browse files Browse the repository at this point in the history
  • Loading branch information
agriyakhetarpal committed Aug 28, 2024
1 parent b797a91 commit bb3067d
Showing 1 changed file with 17 additions and 24 deletions.
41 changes: 17 additions & 24 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,31 @@
# Contributing

Use Tox to run tests and linting, e.g.
Use [Nox](https://nox.thea.codes/en/stable/) to run tests and linting, e.g.,

```shell
pip install tox
pip install nox
```

`nox` will run all checks in an isolated virtual environment with Autograd and its dependencies, including its optional dependencies, installed.

## Run tests, linting, packaging checks

```shell
tox list # list all Tox environments
tox run -e ruff # run code style checks
tox run -e py # run tests with your default Python
tox run -e package # verify packaging
tox # run all Tox environments
```
| Command | Description |
| ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `nox --list` | Lists all available Nox sessions, including selected ones |
| `nox -s lint` | Runs code style checks with pre-commit and pre-commit hooks as listed in `.pre-commit-config.yaml`. Accepts posargs to pass additional arguments to the linter. |
| `nox -s tests` | Runs tests with your default Python interpreter. Accepts posargs to pass additional arguments and configuration to `pytest`. |
| `nox -s validate-package` | Builds a source distribution and a wheel using `pypa/build` and checks the package with `twine` in strict mode. |
| `nox` | Runs all selected sessions, as listed in `nox.options.sessions` in `noxfile.py`. |

Make sure all tests pass before you push your changes to GitHub.
GH Actions will run the tests across all supported Python versions.

## Using arguments (reformat, upload package, help)
## Using positional arguments (reformat, upload package, help)

You can use additional arguments for the tools called by Tox by
separating them from the Tox arguments by a double-dash `--`, e.g.

```shell
tox run -e ruff -- autograd/core.py --show-source
tox run -e ruff -- autograd/core.py --fix
```
You can use additional arguments for the tools (`pytest`, `pre-commit`, etc.) called by Nox by
separating them from the Nox arguments by a double-hyphen `--`, e.g.,

```shell
tox run -e package -- upload
```

```shell
tox run -e py -- --help
```
- `nox -s tests -- --tests/test_tuple.py` runs just the tests listed `tests/test_tuple.py`.
- `nox -s lint -- --fix` runs the linter with the `--fix` flag.
- and so on.

0 comments on commit bb3067d

Please sign in to comment.