hatch-env-run - Man Page
hatch env run – Run commands within project environments
Synopsis
hatch env run [Options] [ARGS]...
Description
The -e /--env option overrides the equivalent root option and the HATCH_ENV environment variable.
If environments provide matrices, then you may use the -i / --include and -x / --exclude options to select or exclude certain variables, optionally followed by specific comma-separated values.
Options
- -e, --env TEXT
The environments to target
- -i, --include TEXT
The matrix variables to include
- -x, --exclude TEXT
The matrix variables to exclude
- -f, --filter TEXT
The JSON data used to select environments
- --force-continue
Run every command and if there were any errors exit with the first code
- --ignore-compat
Ignore incompatibility when selecting specific environments
- -h, --help
Show a help message and exit
Examples
For example, if you have the following configuration:
- pyproject.toml
[[tool.hatch.envs.test.matrix]] python = ["39", "310"] version = ["42", "3.14", "9000"]
- hatch.toml
[[envs.test.matrix]] python = ["39", "310"] version = ["42", "3.14", "9000"]
then running:
hatch env run -i py=310 -x -version=9000 test:pytest
would execute pytest in the environments test.py310-42 and test.py310-3.14. Note that py may be used as an alias for python.
See Also
hatch-env-create(1), hatch-env-find(1), hatch-env-prune(1), hatch-env-remove(1), hatch-env-show(1)
Referenced By
hatch-env(1), hatch-env-create(1), hatch-env-find(1), hatch-env-prune(1), hatch-env-remove(1), hatch-env-show(1), hatch-run(1).