Open brettcannon opened 3 years ago
Cool, so the idea is to have a command that can just process a pep 621 pyproject.toml
and do the right thing?
@nox.package_session
def tests(session):
# Before getting here Nox has already created a virtualenv and installed the package & it's dependencies specified in `pyproject.toml`.
session.run("pytest", "tests")
We could have some customization here:
# Let the package specify its tests dependencies as an extra in pyproject.toml
@nox.package_session(extras=["tests"])
@nox.package_session(path="relative/path/to/pyproject.toml")
# Runs the session for each version of python available that's compatible with the package.
@nox.package_session(all_pythons=True)
Or am I misunderstanding?
Nope, you got it!
How would this feature be useful? I can define my e.g. testing dependencies in one place and then have all of my tooling that I run locally -- both on the command-line and via my editor -- and in CI pull from the same dependency spec.
The goal is for the common test/build/lint steps in Nox to be nothing more than specifying the command to execute, while dependency specification lives in the package details of the project so they are only defined once. This may only be truly feasible once PEP 621 gains traction.
Describe the solution you'd like Couple options.
Describe alternatives you've considered
noxfile.py
.noxfile.py
which will add the appropriate helper function or decorator.