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.
The -i / --include and -x / --exclude options may be used to include or exclude certain variables, optionally followed by specific comma-separated values, and may be selected multiple times.
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
Notes
The inclusion option is treated as an intersection while the exclusion option is treated as a union i.e. an environment must match all of the included variables to be selected while matching any of the excluded variables will prevent selection.
Examples
If you have the following configuration:
- [[tool.hatch.envs.test.matrix]]
python = ["3.9", "3.10"] version = ["42", "3.14", "9000"]
then running:
hatch env run -i py=3.10 -x -version=9000 test:pytest
would execute pytest in the environments test.py3.10-42 and test.py3.10-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).