feature request: conditional building
I'm not exactly sure how this would be best implemented, but it would be neat if there would be an option to enable/disable this plugin based on some external condition (maybe an env var being set?). This is because when using uv sync, it will build the wheel with the plugin enabled, and that takes a significant amount of time.
https://hatch.pypa.io/latest/config/build/#conditional-execution
Ah, indeed this looks like exactly what I was looking for. But I'm missing something:
[tool.hatch.build.targets.wheel.hooks.mypyc]
dependencies = ["hatch-mypyc"]
enable-by-default = false
require-runtime-dependencies = true
require-runtime-features = ["dev"]
Using HATCH_BUILD_HOOK_ENABLE_MYPYC=true uv build doesn't enable the hook.
And using this configuration instead (which is closer to the example in the documentation), it's used always.
[tool.hatch.build.targets.wheel.hooks.mypyc]
dependencies = ["hatch-mypyc"]
require-runtime-dependencies = true
require-runtime-features = ["dev"]
[tool.hatch.build.hooks.mypyc]
enable-by-default = false
I'd appreciate another hint
Same problem here. I did not manage to disable the mypyc hook from the environment either.