Custom build hook¶
これは、BuildHookInterfaceから継承する特定のPythonファイル内のカスタムクラスです。
Configuration¶
ビルドフックプラグイン名は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 |
---|---|---|
path | hatch_build.py | The path of the Python file |
Example¶
from hatchling.builders.hooks.plugin.interface import BuildHookInterface
class CustomBuildHook(BuildHookInterface):
...
複数のサブクラスが見つかった場合は、目的のビルドフックを返すget_build_hook
という名前の関数を定義する必要があります。
Note
定義されたPLUGIN_NAMEは無視され、常に「custom」になります。