Description
I'm trying to build wheel packages using the experimental py_wheel
rule and after looking at the code, I realize that the paths inside the package are starting from the workspace root and I cannot change that using rule parameters. My package code is located deep in a sub-tree of my repo and my imports are absolute, but relative to that sub-tree. This setup results in a broken wheel package, since my imports are not aligned with the filesystem structure.
In addition, I would love to be able to have a __main__.py
script at the root of the distributed package, so that my users can run the tools that I provide using python -m <package-name>
after they install the package. If I understand the current implementation correctly, the only way I can make that work is to put my main file in the root of the repo, which is not an option for me.
I believe this should be relatively easy to solve, if we add an attribute to the py_wheel
rule, that will allows the user to specify the package root path. This is somewhat similar to the py_test
and py_binary
imports
attribute that allows you to add custom import paths for the interpreter based on your tree structure.
Is there anything I can do to implement my requirements considering my constraints and using existing functionality? If not, would you consider a PR that adds the extra attributes I described above, or any other approach you can think of?
Thanks!