8000 py_wheel generated package structure · Issue #199 · bazel-contrib/rules_python · GitHub
[go: up one dir, main page]

Skip to content
py_wheel generated package structure #199
Closed
@sha1n

Description

@sha1n

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0