Skip to content

Builds


Configuration

ビルドは、tool.hatch.buildテーブルを使用して構成されます。すべてのtargetは、tool.hatch.build.targets内のセクションによって定義されます。次に例を示します:

[tool.hatch.build.targets.sdist]
exclude = [
  "/.github",
  "/docs",
]

[tool.hatch.build.targets.wheel]
packages = ["src/foo"]
[build.targets.sdist]
exclude = [
  "/.github",
  "/docs",
]

[build.targets.wheel]
packages = ["src/foo"]

Building

引数なしでbuildコマンドを呼び出すと、sdistおよびwheelターゲットが構築されます。:

$ hatch build
[sdist]
dist/hatch_demo-1rc0.tar.gz

[wheel]
dist/hatch_demo-1rc0-py3-none-any.whl

特定のターゲットのみを構築するには、-t/--targetオプションを使用します。:

$ hatch build -t wheel
[wheel]
dist/hatch_demo-1rc0-py3-none-any.whl

If the target supports multiple versions, you can specify the exact versions to build by appending a colon followed by the desired versions separated by commas:

ターゲットが複数のversionsをサポートしている場合は、コロンの後に目的のバージョンをカンマで区切って追加することで、ビルドする正確なバージョンを指定できます。:

$ hatch -v build -t wheel:standard
[wheel]
Building `wheel` version `standard`
dist/hatch_demo-1rc0-py3-none-any.whl

Packaging ecosystem

Hatchは最新のPythonパッケージ仕様にcompliesしているため、Hatchをビルドバックエンドとして使用するだけで、他のツールでプロジェクトを使用できます。

したがって、Hatchの環境管理の代わりにtoxを使用したり、cibuildwheelを使用してすべてのプラットフォームにパッケージを配布したりすることができ、どちらも特別な変更を加えることなくHatchを透過的に使用できます。