qiskit-experiments
qiskit-experiments copied to clipboard
Replace `tox` with `nox`
Summary
This PR replaces tox
with nox
, an attractive alternative with configuration purely in Python.
Details and comments
The recent issues with tox
have been well-documented (see https://github.com/Qiskit/rustworkx/pull/851 for one). nox
is used by quite a few big projects, including pip
. Besides the Python configuration file, it has a command-line interface similar to tox
but with more options, such as tags. For example, now you can run nox -t ci
to run the exact suite of builds that the CI uses.
Potential caveats to using nox
:
- By default,
nox
passes all environmental variables unliketox
. If there are ever specific variables we don't want to pass, they need to be manually overwritten (See https://github.com/wntrblm/nox/issues/253). - Possibly slower performance. I saw a comment mention this but it was a few years old. We'll see how fast the CI on this PR runs.
On the first CI run, the performance seems slightly better than tox
. Almost all test builds ran 1-4 minutes faster with the exception of docs, which was a few minutes slower.
A note for migrating from tox
: nox
provides the tox-to-nox
tool for generating a first pass noxfile.py
from an existing tox.ini
. The tool did not work for me in the 2022.11.21
release (it's a known issue: https://github.com/wntrblm/nox/issues/671), but the previous release worked fine. I still needed to update a lot of the file afterwards, but it's much faster than starting from scratch.