Skip to content

What environment variables are passed to each type of py_ rule? #2594

@j2kun

Description

@j2kun

Version: 0.23.1 (9c6e26911a79fbf510a8f06d8eedb40f412023cf7fa6d1461def27116bff022c)

I noticed today that inside py_test the running test has access to RUNFILES_DIR as an environment variable, but a py_binary does not.

I could not find a reference as to what environment variables are given to each type of rule.


Side note: I also tried upgrading to 1.1.0 (bazel version 6.4.0), but the steps at https://rules-python.readthedocs.io/en/latest/getting-started.html#using-a-workspace-file failed with

Failed to load Starlark extension '@heir_pip_deps//:requirements.bzl'.
Cycle in the workspace file detected. This indicates that a repository is used prior to being defined.
The following chain of repository dependencies lead to the missing definition.
 - @heir_pip_deps
 - @python_3_11_host
This could either mean you have to add the '@python_3_11_host' repository with a statement like `http_archive` in your WORKSPACE file (note that transitive dependencies are not added automatically), or move an existing definition earlier in your WORKSPACE file.

I suspect there is a typo in the getting started instructions, but removing _host also doesn't seem to work. This is my minimal reproducing workspace: https://gist.github.com/j2kun/4047ee409e3f17599eb4b8389e94ead1

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