Skip to content

Add support for workspace status keys expansion for distribution attribute in py_wheel #1250

Closed
@ns-tkonduri

Description

@ns-tkonduri

I have a request to add support for workspace status keys expansion for distribution attribute in py_wheel.
We would like to use workspace status keys in distribution similar to the version in py_wheel.
Example:

py_wheel(
    name = "pywheel",
    author = "ABC",
    author_email = "abc@xyz.com",
    distribution = "test{DIST_VARIABLE}",
    homepage = "https://www.xyz.com",
    license = "Proprietary",
    python_tag = "py3",
    requires = some_variable,
    version = "{VARIABLE_VERSION}",
    deps = [
        "//xyz:pylibrary",
    ],
)

Currently, distribution does not support passing a workspace status key like {DIST_VARIABLE}.
distribution = "test{DIST_VARIABLE}",

Note: This would be an important feature for us as we move ahead with using Bazel in our Python projects.

Our goal is to dynamically determine the distribution attribute in the py_wheel rule within the BUILD.bazel file of our repositories, depending on the branch in the source code's version control system (Git).

We aim to seamlessly support both feature and release branches without the necessity of modifying the py_wheel file every time the code transitions between different branch types. To achieve this, we plan to utilize workspace status to identify the branch name and determine a DISTRIBUTION_SUFFIX accordingly.

The reason for manipulating the distribution is rooted in the behavior of tools like pip-compile, which determine version compatibility and replacements. If we don't modify the distribution, which represents the library name, builds from main, release, and feature branches will be merged into a single update stream.

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