Hatch configuration¶Hatchの設定¶
Configuration for Hatch itself is stored in a config.toml file located by default in one of the following platform-specific directories.Hatch自体の設定は、デフォルトで以下のプラットフォーム固有のディレクトリのいずれかにあるconfig.tomlファイルに保存されます。
| Platformプラットフォーム | Pathパス |
|---|---|
| macOSmacOS | ~/Library/Application Support/hatch~/Library/Application Support/hatch |
| WindowsWindows | %USERPROFILE%\AppData\Local\hatch%USERPROFILE%\AppData\Local\hatch |
| UnixUnix | $XDG_CONFIG_HOME/hatch (the XDG_CONFIG_HOME environment variable default is ~/.config)$XDG_CONFIG_HOME/hatch(XDG_CONFIG_HOME環境変数のデフォルトは~/.configです) |
You can select a custom path to the file using the --config root option or by setting the HATCH_CONFIG environment variable.ファイルへのカスタムパスを選択するには、--config ルートオプションを使用するか、HATCH_CONFIG環境変数を設定します。
The file can be managed by the config command group.ファイルは、configコマンドグループによって管理できます。
Mode¶モード¶
The mode key controls how Hatch selects the project to work on.modeキーは、Hatchが作業するプロジェクトを選択する方法を制御します。
Local¶ローカル¶
mode = "local"
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.デフォルトでは、Hatchは現在の作業ディレクトリおよび親ディレクトリ内のpyproject.tomlファイルを探します。最初に見つかったファイルを格納しているディレクトリがプロジェクトルートと見なされます。
Project¶プロジェクト¶
mode = "project"
project = "proj1"
[projects]
proj1 = "/path/to/project1"
proj2 = {"location": "/path/to/project2"}
[dirs]
project = ["/path/to/monorepo1", "/path/to/monorepo2"]
In this mode, Hatch will only work on the selected project. The project is located using multiple heuristics:このモードでは、Hatchは選択されたprojectのみに作用します。プロジェクトは複数のヒューリスティックを使用して特定されます:
- If the project is defined in the
projectstable then it must be a string, or an inline table with alocationkey, that is the full path to the project.プロジェクトがprojectsテーブルで定義されている場合、それは文字列であるか、locationキーを持つインラインテーブルでなければなりません。これはプロジェクトへのフルパスです。 - If the project matches a subdirectory in any of the directories listed in
dirs.project, then that will be used as the project root.プロジェクトがdirs.projectにリストされている任意のディレクトリ内のサブディレクトリと一致する場合、それがプロジェクトルートとして使用されます。
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:作業中のプロジェクトを変更するには、config setコマンドを使用できます:
$ hatch config set project proj2
New setting:
project = "proj2"
The project can be selected on a per-command basis with the -p/--project (environment variable HATCH_PROJECT) root option.プロジェクトは、-p/--project(環境変数HATCH_PROJECT)ルートオプションでコマンドごとに選択できます。
Aware¶アウェア¶
mode = "aware"
This is essentially the local mode with a fallback to the project mode.これは本質的にlocalモードで、projectモードへのフォールバックです。
Shell¶シェル¶
You can control the shell used to enter environments with the shell key.環境に入るために使用するシェルをshellキーで制御できます。
If defined as a string, it must be the name of one of the supported shells and be available along your PATH.文字列として定義されている場合、それはサポートされているシェルの1つの名前でなければならず、PATHに沿って利用可能である必要があります。
shell = "fish"
If the executable name of your shell differs from the supported name, you can define the shell as a table with name and path keys.シェルの実行可能名がサポートされている名前と異なる場合、shellをnameとpathキーを持つテーブルとして定義できます。
[shell]
name = "bash"
path = "/bin/ash"
You can change the default arguments used to spawn most shells with the args key. The default for such supported shells is usually ["-i"].ほとんどのシェルを生成するために使用されるデフォルトの引数はargsキーで変更できます。このようなサポートされているシェルのデフォルトは通常["-i"]です。
[shell]
name = "bash"
args = ["--login"]
Supported¶サポートされている¶
| Shellシェル | Name名前 | Arguments引数 | macOSmacOS | WindowsWindows | UnixUnix |
|---|---|---|---|---|---|
| Almquist shellAlmquist shell | ashash | ["-i"]["-i"] | |||
| BashBash | bashbash | ["-i"]["-i"] | |||
| Command Promptコマンドプロンプト | cmdcmd | ||||
| C shellCシェル | cshcsh | ["-i"]["-i"] | |||
| fishfish | fishfish | ["-i"]["-i"] | |||
| NushellNushell | nu | [] | |||
| PowerShellPowerShell | pwsh, powershellpwsh, powershell | ||||
| tcshtcsh | tcshtcsh | ["-i"]["-i"] | |||
| xonshxonsh | xonshxonsh | ["-i"]["-i"] | |||
| Z shellZシェル | zshzsh | ["-i"]["-i"] |
Default¶デフォルト¶
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.Hatchは親プロセスに基づいて現在のシェルを使用しようとします。シェルが特定できない場合、WindowsシステムではHatchは存在する場合はSHELL環境変数を使用し、その後COMSPEC環境変数を使用し、デフォルトでcmdにフォールバックします。他のすべてのプラットフォームでは、SHELL環境変数のみが使用され、デフォルトでbashにフォールバックします。
Directories¶ディレクトリ¶
Data¶データ¶
[dirs]
data = "..."
This is the directory that is used to persist data. By default it is set to one of the following platform-specific directories.これはデータを永続化するために使用されるディレクトリです。デフォルトでは、次のプラットフォーム固有のディレクトリのいずれかに設定されています。
| Platformプラットフォーム | Pathパス |
|---|---|
| macOSmacOS | ~/Library/Application Support/hatch~/Library/Application Support/hatch |
| WindowsWindows | %USERPROFILE%\AppData\Local\hatch%USERPROFILE%\AppData\Local\hatch |
| UnixUnix | $XDG_DATA_HOME/hatch (the XDG_DATA_HOME environment variable default is ~/.local/share)$XDG_DATA_HOME/hatch(XDG_DATA_HOME 環境変数のデフォルトは ~/.local/share です) |
You can select a custom path to the directory using the --data-dir root option or by setting the HATCH_DATA_DIR environment variable.カスタムパスをディレクトリに選択するには、--data-dir ルートオプションを使用するか、HATCH_DATA_DIR 環境変数を設定します。
Cache¶キャッシュ¶
[dirs]
cache = "..."
This is the directory that is used to cache data. By default it is set to one of the following platform-specific directories.これはデータをキャッシュするために使用されるディレクトリです。デフォルトでは、次のプラットフォーム固有のディレクトリのいずれかに設定されています。
| Platformプラットフォーム | Pathパス |
|---|---|
| macOSmacOS | ~/Library/Caches/hatch~/Library/Caches/hatch |
| WindowsWindows | %USERPROFILE%\AppData\Local\hatch\Cache%USERPROFILE%\AppData\Local\hatch\Cache |
| UnixUnix | $XDG_CACHE_HOME/hatch (the XDG_CACHE_HOME environment variable default is ~/.cache)$XDG_CACHE_HOME/hatch(XDG_CACHE_HOME 環境変数のデフォルトは ~/.cache です) |
You can select a custom path to the directory using the --cache-dir root option or by setting the HATCH_CACHE_DIR environment variable.カスタムパスをディレクトリに選択するには、--cache-dir ルートオプションを使用するか、HATCH_CACHE_DIR 環境変数を設定します。
Environments¶環境¶
[dirs.env]
<ENV_TYPE> = "..."
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:例えば、仮想環境をホームディレクトリ内の.virtualenvsディレクトリに保存したい場合、次のように指定できます:
[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:パスが絶対パスでない場合、プロジェクトルートに対して相対的になります。したがって、各プロジェクトディレクトリに.hatchという名前のディレクトリを使用したい場合、次のようにできます:
[dirs.env]
virtual = ".hatch"
Any type of environment that is not explicitly defined will default to <DATA_DIR>/env/<ENV_TYPE>.明示的に定義されていない任意の種類の環境は、デフォルトで<DATA_DIR>/env/<ENV_TYPE>になります。
Python installations¶Pythonインストール¶
[dirs]
python = "..."
This determines where to install specific versions of Python.これは特定のバージョンのPythonをインストールする場所を決定します。
The following values have special meanings:次の値には特別な意味があります:
| Value価値 | Pathパス |
|---|---|
isolated (default)isolated (デフォルト) | <DATA_DIR>/pythons<DATA_DIR>/pythons |
Terminal¶ターミナル¶
You can configure how all output is displayed using the terminal.styles table. These settings are also applied to all plugins.すべての出力がどのように表示されるかは、terminal.styles テーブルを使用して設定できます。これらの設定はすべてのプラグインにも適用されます。
[terminal.styles]
error = "..."
...
Cross-platform terminal capabilities are provided by Rich.クロスプラットフォームのターミナル機能は、Rich によって提供されます。
Output levels¶出力レベル¶
The levels of output are as follows. Note that the verbosity indicates the minimum level at which the output is displayed.出力のレベルは次のとおりです。冗長性は、出力が表示される最小レベルを示します。
| Levelレベル | Defaultデフォルト | Verbosity冗長性 | Description説明 |
|---|---|---|---|
debugdebug | boldbold | 1 - 31 - 3 | Messages that are not useful for most user experiencesほとんどのユーザー体験にとって役に立たないメッセージ |
errorerror | bold redbold red | -2 | Messages indicating some unrecoverable error回復不可能なエラーを示すメッセージ |
infoinfo | boldbold | 0 | Messages conveying basic information基本的な情報を伝えるメッセージ |
successsuccess | bold cyan太字 シアン | 0 | Messages indicating some positive outcomeポジティブな結果を示すメッセージ |
waiting待機中 | bold magenta太字 マゼンタ | 0 | Messages shown before potentially time consuming operations時間がかかる可能性のある操作の前に表示されるメッセージ |
warning警告 | bold yellow太字 イエロー | -1 | Messages conveying important information重要な情報を伝えるメッセージ |
See the documentation and color reference for guidance on valid values.有効な値に関するガイダンスについては、ドキュメントとカラーリファレンスを参照してください。
Spinner¶スピナー¶
You can select the sequence used for waiting animations with the spinner option.シーケンスを選択して、spinnerオプションを使用して待機アニメーションを設定できます。
[terminal.styles]
spinner = "..."