Skip to content

implement python os.getenv() in starlark #1980

Description

@nicks

Several people have asked for easier ways to read the current environment, like python's os.getenv()

The current workaround is to do str(local('echo $ENV_VAR')). This works, but is not super portable or ergonomic.

Interestingly, Starlark/Bazel has a way to do this:
https://github.com/bazelbuild/bazel/blob/1f684e1b87cd8881a0a4b33e86ba66743e32d674/src/main/java/com/google/devtools/build/lib/bazel/repository/skylark/SkylarkOS.java
but Starlark/Go does not

We should implement an os subset as a standalone package, so that other Starlark/Go-based projects can use it

See also: https://docs.python.org/3/library/os.html

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions