By default, Hatch will look for a pyproject.toml file in the current working directory and any parent directories. The directory storing the first found file will be considered the project root.
In this mode, Hatch will only work on the selected project. The project is located using multiple heuristics:
If the project is defined in the projects table then it must be a string, or an inline table with a location key, that is the full path to the project.
If the project matches a subdirectory in any of the directories listed in dirs.project, then that will be used as the project root.
An error will occur if the project cannot be found.
You can use the config set command to change the project you are working on:
$ hatchconfigsetprojectproj2
New setting:project = "proj2"
The project can be selected on a per-command basis with the -p/--project (environment variable HATCH_PROJECT) root option.
Hatch will attempt to use the current shell based on parent processes. If the shell cannot be determined, then on Windows systems Hatch will use the SHELL environment variable, if present, followed by the COMSPEC environment variable, defaulting to cmd. On all other platforms only the SHELL environment variable will be used, defaulting to bash.
This determines where to store environments, with every key being the type of environment and the value being the desired storage location.
For example, if you wanted to store virtual environments in a .virtualenvs directory within your home directory, you could specify the following:
[dirs.env]virtual="~/.virtualenvs"
Any environment variables are also expanded.
If the path is not absolute, then it will be relative to the project root. So if you wanted to use a directory named .hatch in each project directory, you could do:
[dirs.env]virtual=".hatch"
Any type of environment that is not explicitly defined will default to <DATA_DIR>/env/<ENV_TYPE>.