Replies: 1 comment 1 reply
-
Do you want it just for one target like or maybe Hatch could populate an env var with a unique value per build invocation? |
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
-
Hi,
Is there a way to implement some "scope" for build hooks similar to test fixtures?
I am running hatch 1.4.0.
Context
I use
hatch
to build a "dataset package" (meaning a python library with very few lines of codes but including heavy binary artifacts).I would like to improve the following workflow:
build.py
) that downloads & merges files from multiple sources into a single binary resource.linters
anddocs
envs to skip-install. So far so good running the CI.hatch_build.py
in theinitialize()
method of the custom hook.version != "editable"
condition.This is where things get messy.
I would like the custom hook to run the actual build function only once per CLI use and only if needed.
I can easily implement the
clean
method to remove artifacts and a custom "skip-if-exists" configuration key with the setup above. However, the removal and artifact creation would still happen twice with thehatch build -c
command (building tarball and wheel).My question boils down to this: what would be the best way to run a hook only once or share information between runs?
Beta Was this translation helpful? Give feedback.
All reactions