bazel-distribution icon indicating copy to clipboard operation
bazel-distribution copied to clipboard

[assemble-pip] Support stripping a path prefix from package files

Open caseyduquettesc opened this issue 2 years ago • 0 comments

What is the goal of this PR?

In a monorepo with many python packages, where each is individually published, the libraries might be a directory or two lower in the repo than what you want to be published.

For example, take this folder structure

javacode/
pybindings/
    apiclient/
        BUILD.bazel
        __init__.py

All the python packages are under pybindings, but I don't want the root folder showing up in the users' imports.

Currently, the assembled file persists the pybindings/apiclient structure. I'd like to propose a way to strip pybindings/ in this case and assemble a file starting at apiclient.

What are the changes implemented in this PR?

Adds strip_prefix to assemble_pip. When the input files are copied, if there's a strip_prefix, and a file starts with that prefix, it is stripped from the start of the path.

caseyduquettesc avatar Jul 15 '22 05:07 caseyduquettesc