Feature Request: Add an option to allow the user to specify which `__init__.py` gets the patch
arcondello opened this issue · comments
We are currently running into the limit for namespace packages documented in the README
- `delvewheel` creates or patches `__init__.py` in each top-level package so that the DLLs are loaded properly during import. This will cause issues if you have a top-level namespace package that requires `__init__.py` to be absent to function properly.
Would it be possible to allow the user to specify the "top-level" of the package they wish to delocate? Something like
delvewheel repair ... --top-level=package/subpackage/
Alternatively, I believe that all we would need is the ability to move the patch to the subpackage's __init__.py
rather than the top-level __init__.py
. So maybe something like
delvewheel repair ... --patch-init=package/subpackage/__init__.py
I can make the PR if you approve of an approach.
Or is there some alternative you would suggest? On our side, we can "manually" move the patch after running develwheel, but of course an upstream fix would be ideal.
Cross link to our issue dwavesystems/dwave-preprocessing#130 if that's helpful.
I think the best solution would be for me to add an option to explicitly mark something as a namespace package. In your case, that would look something like
delvewheel repair --namespace-package dwave ...
This would avoid touching dwave\__init__.py
and would patch dwave\preprocessing\__init__.py
instead.
I'll make this change.
Great, makes sense, thank you!