hatch-run - Man Page

hatch run – Run commands within project environments

Synopsis

hatch run [OPTIONS] [ENV:]ARGS...

Description

This is a convenience wrapper around the hatch-env-run(1) command.

If the first argument contains a colon, then the preceding component will be interpreted as the name of the environment to target, overriding the -e/--env root option and the HATCH_ENV environment variable.

If the environment provides matrices, then you may also provide leading arguments starting with a + or - to select or exclude certain variables, optionally followed by specific comma-separated values.

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 run +py=310 -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(1)

hatch-env-run(1)

Referenced By

hatch(1).

July 2022