Repository navigation
Replies: 1 comment
|
The key difference is that Hatch's dev mode is an editable wheel, not a normal wheel copied into Current Hatch/Hatchling documents the wheel target's First check the import rather than the site-packages directory: hatch run test:python -c "import my_pkg.my_file as m; print(m.__file__)"For an editable install, seeing that resolve into your checkout (for example There is also an explicit escape hatch when automatic dev-mode path detection is confused by unusual build-hook/file-selection setups such as “exclude Python sources from the wheel because Cython emits .pyd files”: [tool.hatch.build.targets.wheel]
dev-mode-dirs = ["src"]Current Hatch docs describe So I would separate the two desired artifacts:
That also explains why |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi, I am currently using hatch in a project with hatch-cython to compile parts of it. I have been able to set up the hatch-cython hook such that it compiles the files I desire and excludes some (using its
excludeoption) likeThen I can choose which are excluded when I build the wheel
Above I exclude the .py files because I will instead have compiled .pyd files. I then tell it not to exclude
my_file.pybecause I do not have a compiled version of it from cython.This seems to work correctly and if I
hatch buildand thenpip install --target my_pkg my_pkg.whlthen I can see it builds the wheel as I specify.On the other hand, when I run in a test environment and it installs the package in development mode, only the compiled pyd files are included and
my_file.pyis not in the installed directoryC:\Users\<user>\AppData\Local\hatch\env\virtual\my_pkg\<id>\test\Lib\site-packages\my_pkg.Some related config for my test env
Note that if I add
dev-mode = falseintool.hatch.envs.testthen it builds correctly (I suppose because it is building from the wheel instead). How, then, is the package built in development mode and how come it is not following the exclude rules I set for the wheel? I notice that it still seems to trigger the cython hook I setup for wheel and generates the files correctly (i.e it is compiling everything exceptmy_file.py).I might update with a minimum reproducible example later if it helps but if anyone even has some info on exactly how dev builds are set up that would be useful info.
All reactions