Skip to content

Document centrally about tox/nox #112

@chrisjsewell

Description

@chrisjsewell

I was going to bring this up in meta, since I've started adding tox.ini to repositories (see markdown-it-py and myst-parser).
Basically tox/nox are very helpful when switching between different repos/projects, to quickly run the tests and doc builds against multiple environments

The "normal" workflow for me before was to open up a repository's folder in VS Code, create a conda environment, install the package into it, then run pytest, make html, etc

With https://tox.readthedocs.io it doesn't preclude you from doing this, but offers an easier/quicker approach; you just have tox installed in your base environment (and optionally tox-conda when using conda). Then, when you open a new repo folder all you have to do is run tox.
Depending on your tox.ini and what python versions you have available, this will then create one or more virtual environments in a local .tox folder, then run the tests using each environment.
For example, with the myst-parser tox.ini it runs: py36-sphinx2,py37-sphinx2,py38-sphinx2,py36-sphinx3,py37-sphinx3,py38-sphinx3,docs, by default, or you can run a single one with e.g. tox -e py38-sphinx3

To parse additional arguments to pytest, you just put them after a -- (assuming this is setup in the tox.ini) e.g. tox -e py38-sphinx3 -- -x path/to/test.py

nox is less mature/widely used than tox, but builds on tox, by offering a more configurable execution process, due to using a "dynamic" python configuration file (nox.py) instead of a "static" file (tox.ini). This is needed here for running the live server.

Hmm, what does removing the nox folder do?

So getting back to your original question. If you delete the .tox/.nox folder you simply delete any previously built environments and tox/nox will rebuild them when called (you can also force a rebuild with tox -r.

Originally posted by @chrisjsewell in executablebooks/sphinx-book-theme#187 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions