Skip to content

Buildsビルド


Configuration設定

Builds are configured using the tool.hatch.build table. Every target is defined by a section within tool.hatch.build.targets, for example:ビルドは設定されており、tool.hatch.buildテーブルを使用します。すべてのターゲットは、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ビルディング

Invoking the build command without any arguments will build the sdist and wheel targets:buildコマンドを引数なしで呼び出すと、sdistwheelターゲットがビルドされます:

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

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

To only build specific targets, use the -t/--target option:特定のターゲットのみをビルドするには、-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:ターゲットが複数のバージョンをサポートしている場合、コロンの後にカンマで区切った希望のバージョンを追加することで、ビルドする正確なバージョンを指定できます:

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

Packaging ecosystemパッケージングエコシステム

Hatch complies with modern Python packaging specs and therefore your projects can be used by other tools with Hatch serving as just the build backend.Hatch 現代のPythonパッケージング仕様に準拠しているため、あなたのプロジェクトは他のツールによって使用されることができ、Hatchは単にビルドバックエンドとして機能します。

So you could use tox as an alternative to Hatch's environment management, or cibuildwheel to distribute packages for every platform, and they both will transparently use Hatch without any extra modification.したがって、toxをHatchの環境管理の代替として使用したり、cibuildwheelを使用してすべてのプラットフォーム向けにパッケージを配布したりすることができ、どちらも追加の変更なしにHatchを透過的に使用します。