Skip to content

Custom build hookカスタムビルドフック


This is a custom class in a given Python file that inherits from the BuildHookInterface.これは、BuildHookInterfaceから継承された特定のPythonファイル内のカスタムクラスです。

Configuration設定

The build hook plugin name is custom.ビルドフックプラグイン名は custom です。

[tool.hatch.build.hooks.custom]
[tool.hatch.build.targets.<TARGET_NAME>.hooks.custom]
[build.hooks.custom]
[build.targets.<TARGET_NAME>.hooks.custom]

Optionsオプション

Optionオプション Defaultデフォルト Description説明
pathpath hatch_build.pyhatch_build.py The path of the Python filePythonファイルのパス

Example

from hatchling.builders.hooks.plugin.interface import BuildHookInterface


class CustomBuildHook(BuildHookInterface):
    ...

If multiple subclasses are found, you must define a function named get_build_hook that returns the desired build hook.複数のサブクラスが見つかった場合は、目的のビルドフックを返す get_build_hook という名前の関数を定義する必要があります。

Note注意

Any defined PLUGIN_NAME is ignored and will always be custom.定義された PLUGIN_NAME は無視され、常に custom になります。