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-build(1), hatch-clean(1), hatch-config(1), hatch-dep(1), hatch-env(1), hatch-fmt(1), hatch-new(1), hatch-project(1), hatch-publish(1), hatch-python(1), hatch-shell(1), hatch-status(1), hatch-version(1)

hatch(1)

hatch-env-run(1)

Referenced By

hatch(1), hatch-build(1), hatch-clean(1), hatch-config(1), hatch-dep(1), hatch-env(1), hatch-env-run(1), hatch-fmt(1), hatch-new(1), hatch-project(1), hatch-publish(1), hatch-python(1), hatch-shell(1), hatch-status(1), hatch-version(1).

December 2023