HATCH-RUN(1)
β¨ HATCH-RUN(1) β¨
okay so this is the hatch-run page from the User Commands section of the manual, and bestie it is SO useful, let me tell you everything π
π NAME
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. literally just a cute lil shortcut, that's the vibe π«Ά
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. so like, the colon version WINS, no cap π
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. very main character of it tbh π
πΈ NOTES
Inclusions are treated as an intersection while exclusions are 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.
translation: to get picked, an env has to check every single inclusion box β . but one single exclusion match? instantly ghosted π periodt.
π EXAMPLES
For example, if you have the following configuration:
pyproject.toml
[[tool.hatch.envs.test.matrix]]
python = ["3.9", "3.10"]
version = ["42", "3.14", "9000"]
hatch.toml
[[envs.test.matrix]]
python = ["3.9", "3.10"]
version = ["42", "3.14", "9000"]
then running:
hatch run +py=3.10 -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. iconic shorthand, we love her π
π 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-self(1)hatch-shell(1)hatch-status(1)hatch-test(1)hatch-version(1)hatch(1)hatch-env-run(1)
and that's the whole page bestie!! August 2024, straight from the HATCH-RUN(1) era β go run some commands in a project environment and slay π§πβ¨
π¦ where this page comes from
- epel 10: hatch 1.15.1-2.el10_3 Β· MIT
- fedora 43: hatch 1.14.2-2.fc43 Β· MIT
- fedora 43: hatch 1.15.1-1.fc43 Β· MIT
- fedora 44: hatch 1.16.4-1.fc44 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms