用于编写构建脚本的Hatch插件
项目描述
Hatch Build Scripts
一个用于Hatch的插件,允许您运行任意构建脚本并将它们的工件包含在您的软件包分发中。
安装
要将pyproject.toml
文件中将其配置为build-system
需求。
[build-system]
requires = ["hatchling", "hatch-build-scripts"]
build-backend = "hatchling.build"
使用方法
现在您需要配置要运行的构建脚本。这是通过在您的pyproject.toml
文件中将脚本数组添加到tool.hatch.build.hooks.build-scripts.scripts
键来完成的。每个脚本都使用以下键进行配置
键 | 默认值 | 描述 |
---|---|---|
commands |
必需 | 要运行的命令数组。每个命令都在单独的shell中运行。 |
artifacts |
必需 | 要包含在您的软件包分发中的工件模式数组(与.gitignore 相同)。 |
out_dir |
"." |
将工件复制的目录。 |
work_dir |
"." |
运行命令的目录。所有工件模式都是相对于此目录的。 |
clean_artifacts |
true |
在运行命令之前是否从out_dir 中清理与工件模式匹配的文件。 |
clean_out_dir |
false |
在运行命令之前是否清理out_dir 。 |
在实际中,这看起来像
[[tool.hatch.build.hooks.build-scripts.scripts]]
out_dir = "out"
commands = [
"echo 'Hello, world!' > hello.txt",
"echo 'Goodbye, world!' > goodbye.txt",
]
artifacts = [
"hello.txt",
"goodbye.txt",
]
[[tool.hatch.build.hooks.build-scripts.scripts]]
# you can add more scripts here...
您可以通过在pyproject.toml
文件中添加一个[tool.hatch.build.hooks.build-scripts]
表来配置脚本的默认值。以下键受支持
键 | 默认值 | 描述 |
---|---|---|
out_dir |
"." |
将工件复制的目录。 |
work_dir |
"." |
运行命令的目录。所有工件模式都是相对于此目录的。 |
clean_artifacts |
true |
在运行命令之前是否从out_dir 中清理与工件模式匹配的文件。 |
clean_out_dir |
false |
在运行命令之前是否清理out_dir 。 |
项目详情
关闭
hatch_build_scripts-0.0.4.tar.gz 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | c78520986907e47538f2cbb24fde41edfc2cc55f452b5362fbae15ce4e6344f7 |
|
MD5 | 567766d3529de6a7fd53f269c6e897e2 |
|
BLAKE2b-256 | 6bc287097d54f22105b79c5166c7f279324da7b279cb1679366d5f5c9976a814 |
关闭
hatch_build_scripts-0.0.4-py3-none-any.whl 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 12a2e3c716ba1ec2d249cff6c8e6975b183f446b98f80ccbffec2c707f307470 |
|
MD5 | 7f2ea7dda6e84661e32690ff1a8556ce |
|
BLAKE2b-256 | 4322433e20bdf36074f6c0563ee05240aaf82c2e5ccc5e8cf758793225510e3b |