HATCH-RUN(1)

πŸ“¦
version 1.16.4 Β· 2 versions
, in epel 10, fedora 43, fedora 44

✨ 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


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