HATCH-ENV-RUN(1)
π hatch env run β the vibe
okay bestie, so this is hatch-env-run(1), a User Commands manual page, and it's literally the glow-up your project environments have been waiting for. it's giving "run my commands, but make it inside the right environment." π
β¨ NAME β¨
hatch env run β run commands within project environments π«Ά
πΈ SYNOPSIS πΈ
hatch env run [OPTIONS] ARGS...
that's it. that's the whole entrance. ARGS... is your moment, bestie. π
π DESCRIPTION π
so here's the tea: the -e / --env option overrides the equivalent root option and the HATCH_ENV environment variable. no cap. it just wins. periodt.
and then the -i / --include and -x / --exclude options? they let you include or exclude certain variables, optionally followed by specific comma-separated values, and β this is the iconic part β they may be selected multiple times. yes you can stack them. yes it's a serve. π
π 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 π (yes, every command. it does not stop. it does not chill.)--ignore-compatβ ignore incompatibility when selecting specific environments π₯-h,--helpβ show a help message and exit πΈ
π¦ NOTES π¦
lowkey the most important lore on this whole page, so pay attention:
the inclusion option is treated as an intersection while the exclusion option is treated as a union.
translating that for the group chat: an environment must match all of the included variables to be selected, while matching any of the excluded variables will prevent selection. highkey simple once you say it like that. π
π EXAMPLES π
say your config looks like this:
[[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. π₯
and note β and this is the cute little detail β py may be used as an alias for python. iykyk. β
π SEE ALSO π
hatch-run(1)hatch-env-create(1),hatch-env-find(1),hatch-env-prune(1),hatch-env-remove(1),hatch-env-show(1)hatch-env(1),hatch(1)
and that's the whole page bestie, ily, go run some commands in the correct environment πβ¨
this little masterpiece is brought to you by the HATCH-ENV-RUN(1) era, dated August 2024 β the source/version of the whole thing. mwah. πππ¦
π¦ 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