-
I have a custom .pth file that needs to be installed in order for the project to work (imports). I cant change the imports because they are also at the user side of this legacy project. => Some sub directories of the project need to be on python path. I did this via [tool.hatch.build.targets.wheel.force-include] where custom.pth: subdir1/subdir2 When the project is installed into site-packages (normal use case) this works. But in dev mode these paths must be absolute. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
You can create a custom build hook and then set |
Beta Was this translation helpful? Give feedback.
I implemented the build hook for initialize so that a foo_dev.pth file with absolute paths is created dynamically. This works.
Then i added force_include_editable to pyproject.toml:
[tool.hatch.build.targets.wheel.force-include]
"foo.pth" = "foo.pth"
[tool.hatch.build.targets.wheel.force_include_editable]
"foo_dev.pth" = "foo.pth"
=> I install the project via uv pip install -e PATH inside the shell of another hatch project
=> wheel.force-include is always used, wheel.force_include_editable is ignored, what i am may doing wrong?
edit:
I tried patching the build_data["force_include"] in the initialize method. This works with pip but with uv the .pth file is messed up, looks like uv does thi…