Plugin utilities¶プラグインユーティリティ¶
hatchling.builders.utils.get_reproducible_timestamp() -> int ¶hatchling.builders.utils.get_reproducible_timestamp() -> int ¶
Returns an int derived from the SOURCE_DATE_EPOCH environment variable; see https://reproducible-builds.org/specs/source-date-epoch/.intを返します。これはSOURCE_DATE_EPOCH環境変数から派生したものです。詳細はhttps://reproducible-builds.org/specs/source-date-epoch/を参照してください。
The default value will always be: 1580601600デフォルト値は常に: 1580601600です。
Source code in hatchling/builders/utils.py
def get_reproducible_timestamp() -> int:
"""
Returns an `int` derived from the `SOURCE_DATE_EPOCH` environment variable; see
https://reproducible-builds.org/specs/source-date-epoch/.
The default value will always be: `1580601600`
"""
return int(os.environ.get("SOURCE_DATE_EPOCH", "1580601600"))
BuilderConfig ¶BuilderConfig ¶
Application ¶Application ¶
The way output is displayed can be configured by users.出力の表示方法は、ユーザーによって設定できます。
Important重要
Never import this directly; Hatch judiciously decides if a type of plugin requires the capabilities herein and will grant access via an attribute.これを直接インポートしないでください。Hatchは、プラグインの種類がここに示された機能を必要とするかどうかを慎重に判断し、属性を介してアクセスを許可します。
verbosity: int property ¶verbosity: int property ¶
The verbosity level of the application, with 0 as the default.アプリケーションの冗長性レベルで、デフォルトは0です。
abort(message: str = '', code: int = 1, **kwargs: Any) -> None ¶abort(message: str = '', code: int = 1, **kwargs: Any) -> None ¶
Terminate the program with the given return code.指定された戻りコードでプログラムを終了します。
display_debug(message: str = '', level: int = 1, **kwargs: Any) -> None ¶display_debug(message: str = '', level: int = 1, **kwargs: Any) -> None ¶
Meant to be used for messages that are not useful for most user experiences. The level option must be between 1 and 3 (inclusive).ほとんどのユーザー体験にとって役に立たないメッセージに使用されることを意図しています。levelオプションは1から3の間(含む)でなければなりません。
display_error(message: str = '', **kwargs: Any) -> None ¶display_error(message: str = '', **kwargs: Any) -> None ¶
Meant to be used for messages indicating some unrecoverable error.回復不可能なエラーを示すメッセージに使用されることを意図しています。
display_info(message: str = '', **kwargs: Any) -> None ¶display_info(message: str = '', **kwargs: Any) -> None ¶
Meant to be used for messages conveying basic information.基本情報を伝えるメッセージに使用されることを意図しています。
display_success(message: str = '', **kwargs: Any) -> None ¶display_success(message: str = '', **kwargs: Any) -> None ¶
Meant to be used for messages indicating some positive outcome.ポジティブな結果を示すメッセージに使用されることを意図しています。
Platform ¶Platform ¶
default_shell: str property ¶default_shell: str property ¶
Returns the default shell of the system.システムのデフォルトシェルを返します。
On Windows systems first try 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.Windowsシステムでは、最初にSHELL環境変数を試し、存在する場合はそれを使用し、次にCOMSPEC環境変数を使用し、デフォルトはcmdです。他のすべてのプラットフォームでは、SHELL環境変数のみが使用され、デフォルトはbashです。
modules: LazilyLoadedModules property ¶modules: LazilyLoadedModules property ¶
Accessor for lazily loading modules that either take multiple milliseconds to import (like shutil and subprocess) or are not used on all platforms (like shlex).複数のミリ秒を要するインポート(shutilやsubprocessのように)またはすべてのプラットフォームで使用されないモジュール(shlexのように)を遅延ロードするためのアクセサ。
home: Path property ¶home: Path property ¶
The user's home directory as a path-like object.ユーザーのホームディレクトリをパスのようなオブジェクトとして表します。
name: str property ¶name: str property ¶
One of the following:次のいずれか:
linuxlinuxwindowswindowsmacosmacos
display_name: str property ¶display_name: str property ¶
One of the following:次のいずれか:
LinuxLinuxWindowsWindowsmacOSmacOS
windows: bool property ¶windows: bool property ¶
Indicates whether Hatch is running on Windows.HatchがWindows上で実行されているかどうかを示します。
macos: bool property ¶macos: bool property ¶
Indicates whether Hatch is running on macOS.HatchがmacOS上で実行されているかどうかを示します。
linux: bool property ¶linux: bool property ¶
Indicates whether Hatch is running on neither Windows nor macOS.HatchがWindowsでもmacOSでも実行されていないかどうかを示します。
format_for_subprocess(command: str | list[str], *, shell: bool) -> str | list[str] ¶format_for_subprocess(command: str | list[str], *, shell: bool) -> str | list[str] ¶
Format the given command in a cross-platform manner for immediate consumption by subprocess utilities.与えられたコマンドをサブプロセスユーティリティによって即座に使用できるようにクロスプラットフォーム方式でフォーマットします。
run_command(command: str | list[str], *, shell: bool = False, **kwargs: Any) -> CompletedProcess ¶run_command(command: str | list[str], *, shell: bool = False, **kwargs: Any) -> CompletedProcess ¶
Equivalent to the standard library's subprocess.run, with the command first being properly formatted.標準ライブラリのsubprocess.runに相当し、コマンドは最初に適切にフォーマットされます。
check_command(command: str | list[str], *, shell: bool = False, **kwargs: Any) -> CompletedProcess ¶check_command(command: str | list[str], *, shell: bool = False, **kwargs: Any) -> CompletedProcess ¶
Equivalent to run_command, but non-zero exit codes will gracefully end program execution.run_commandに相当しますが、非ゼロの終了コードはプログラムの実行を優雅に終了させます。
check_command_output(command: str | list[str], *, shell: bool = False, **kwargs: Any) -> str ¶check_command_output(command: str | list[str], *, shell: bool = False, **kwargs: Any) -> str ¶
Equivalent to the output from the process returned by capture_process, but non-zero exit codes will gracefully end program execution.capture_processによって返されるプロセスの出力に相当しますが、非ゼロの終了コードはプログラムの実行を優雅に終了させます。
capture_process(command: str | list[str], *, shell: bool = False, **kwargs: Any) -> Popen ¶capture_process(command: str | list[str], *, shell: bool = False, **kwargs: Any) -> Popen ¶
Equivalent to the standard library's subprocess.Popen, with all output captured by stdout and the command first being properly formatted.標準ライブラリのsubprocess.Popenに相当し、すべての出力はstdoutによってキャプチャされ、コマンドは最初に適切にフォーマットされます。
EnvironmentContextFormatter ¶EnvironmentContextFormatter ¶
formatters() ¶formatters() ¶
This returns a mapping of supported field names to their respective formatting functions. Each function accepts 2 arguments:これは、サポートされているフィールド名のマッピングと、それぞれのフォーマット関数を返します。各関数は2つの引数を受け取ります:
- the
valuethat was passed to the format call, defaulting toNoneフォーマット呼び出しに渡されたvalue、デフォルトはNone - the modifier
data, defaulting to an empty string修飾子data、デフォルトは空の文字列
FileSystemContext ¶FileSystemContext ¶
This class represents a synchronized path between the local file system and a potentially remote environment.このクラスは、ローカルファイルシステムと潜在的にリモート環境との間の同期されたパスを表します。
env: EnvironmentInterface property ¶env: EnvironmentInterface property ¶
Returns the environment to which this context belongs.このコンテキストが属する環境を返します。
local_path: Path property ¶local_path: Path property ¶
Returns the local path to which this context refers as a path-like object.このコンテキストが参照するローカルパスを、パスのようなオブジェクトとして返します。
env_path: str property ¶env_path: str property ¶
Returns the environment path to which this context refers as a string. The environment may not be on the local file system.このコンテキストが参照する環境パスを文字列として返します。環境はローカルファイルシステム上にない場合があります。
sync_local() ¶sync_local() ¶
Synchronizes the local path as the source with the environment path as the source.ローカルパスをソースとして、環境パスをソースとして同期します。
sync_env() ¶sync_env() ¶
Synchronizes the environment path with the local path as the source.環境パスをソースとして、ローカルパスと同期します。
join(relative_path: str) -> FileSystemContext ¶join(relative_path: str) -> FileSystemContext ¶
Returns a new instance of this class with the given relative path appended to the local and environment paths.ローカルパスと環境パスに指定された相対パスを追加した新しいインスタンスを返します。
This method should not need overwriting.このメソッドはオーバーライドする必要はありません。