Skip to content

Package py_binary without py_env #5

@aisbaa

Description

@aisbaa

Hi, yesterday I've tested rules_pyenv and I'm impressed, good job! The only small thing Is that it is a lot harder to package py_birnary target using pkg_tar. Because by default it includes pyenv, which is not what I want. Maybe you have solutions for that? Here's

py_binary(
    name = "py_cli_bin",
    srcs = ["entrypoint.py"],
    main = "entrypoint.py",
    deps = [
        ":cli_lib",
        ":cli_lib_auth",
    ] + cli_requirements,
    python_version = "PY3",
)

pkg_tar(
    name = "py_cli_tar",
    srcs = [
        ":py_cli_bin",
    ],
    include_runfiles = True, # this would include all deps including pyenv
)

I ended up creating source file group and writing simpler version of python bootstrap script to workaround this. Do you know a simple way to include runfiles but exclude pyenv?


Update. The method above fails to include include non-python files from cli_requirements. The other thing I tried is bazel build --spawn_strategy=local //cli:/py_cli_tar. It did succeed building tar package, but failed in another target during container_image build.

Related issue: bazelbuild/rules_pkg#135

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions