How to skip copying artifacts? #4
Unanswered
angelo-peronio
asked this question in
Q&A
Replies: 2 comments 1 reply
-
I also ran into this issue. How about making |
Beta Was this translation helpful? Give feedback.
0 replies
-
I found an indirect way to have hatch-build-scripts do what I want:
Then the copying step of hatch-build-scripts is effectively skipped. Relevant excerpts from my [build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.build.targets.sdist]
only-packages = true
[tool.hatch.build.targets.wheel]
dependencies = ["hatch-build-scripts", "ruff"]
exclude = ["**/formats/*.ksy"]
artifacts = ["**/formats/*.py"]
# Compile the Kaitai Struct definitions for the wheel.
[[tool.hatch.build.targets.wheel.hooks.build-scripts.scripts]]
work_dir = "src/fxx/jad/formats"
commands = [
"kaitai-struct-compiler.bat --verbose=file --target=python --python-package=. *.ksy",
"ruff format --verbose --force-exclude --exclude=__init__.py *.py",
]
# Hack: we do not specify any artifact here to skip the copying step
# from work_dir to out_dir.
# Instead, we specified above tool.hatch.build.targets.wheel.artifacts
artifacts = []
clean_artifacts = false |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to use hatch-build-scripts to compile Kaitai Struct format definitions into Python modules while building a wheel. In my case, the format definitions within the sdist are in
fxx/jad/formats
, and I would like to have the resulting Python modules in the same folder.I managed to have hatch-build-scripts compile the Python modules, but it subsequently fails to copy them to the
out_dir
, since they already are where they should be.I tried the following in my
pyproject.toml
:python -m build
generates the Python modules infxx/jad/formats
as expected, but fails to copy them, since they already are where they should be:Is it possible to use hatch-build-scripts to do what I am aiming to? If so, how?
If not, I can think of different ways to implement it within hatch-build-scripts. For instance:
SameFileError
exception, orout_dir
is an empty string, orcopy_artifacts
Boolean configuration parameter.Beta Was this translation helpful? Give feedback.
All reactions