bazel-runfiles
What it is and what it does
bazel-runfiles is a lookup library that helps Python code find and access files and binaries that Bazel has packaged as runfiles. When Bazel builds a Python binary or test, it stages dependencies and data files in a runfiles tree; this library provides the API to locate those files at runtime using either a manifest file or a directory structure, depending on the Bazel configuration.
The library is designed for use within Bazel-built projects. You create a Runfiles object, then call its Rlocation method with a workspace-qualified path to get the actual filesystem location of a runfile. It also supports setting up environment variables for subprocesses that need to access runfiles themselves. The implementation automatically detects whether to use manifest-based or directory-based lookup based on environment variables set by Bazel.
Use it for:
- Access data files packaged alongside a Bazel-built Python binary at runtime.
- Locate and run other Bazel-built binaries from within a Python test or application.
- Set up environment variables for subprocesses spawned by a Bazel-built Python program so they can find their own runfiles.
- Resolve workspace-qualified paths to actual filesystem paths in a Bazel build system.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides a Python API to locate and access runfiles (data files and binaries) built and packaged by Bazel, supporting both manifest-based and directory-based lookup strategies.
Yes, if you are building Python binaries or tests with Bazel and need to access runfiles at runtime. The package is actively maintained, has no dependencies, and carries a permissive license. It is essential infrastructure for Bazel-Python integration but only relevant within a Bazel project; installing it outside that context is unnecessary.
Install
bazel-runfiles on PyPI
pip
pip install bazel-runfilesuv
uv add bazel-runfilespoetry
poetry add bazel-runfilesInstalling bazel-runfiles
Before you install
Low install friction with no runtime dependencies. Active maintenance as of 2026-08-14 with recent releases. Stable production status.
License in practice
Permissive license (Apache Software License) allows use in commercial and proprietary projects without significant restrictions.
Quickstart
pip install bazel-runfiles
from runfiles import Runfiles
r = Runfiles.Create()
path = r.Rlocation("my_workspace/path/to/data.txt")
with open(path, "r") as f:
contents = f.readlines()
Requires Python 3.7 or later. Only useful within a Bazel-built project that generates runfiles; requires proper Bazel environment variables to be set.
Verify before relying
- Whether the package works correctly outside a Bazel-managed build environment or with older Bazel versions.
- Performance characteristics when dealing with large numbers of runfiles or deeply nested directory structures.
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 0 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 5,069,741/month — #2,174 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: bazel_runfiles-2.3.1-py3-none-any.whl
Tags
More Build Tools packages
Provides reusable utilities for Python…
permissive · top 100 on PyPI
tqdmWraps any iterable to display a real-time…
copyleft · top 100 on PyPI
pippip is the standard installer for Python…
permissive · top 100 on PyPI
hatchlingHatchling is a standards-compliant Python build…
permissive · top 100 on PyPI
grpcio-toolsGenerates Python gRPC service stubs and message…
permissive · top 1,000 on PyPI
pre-commitpre-commit is a framework for installing and…
permissive · top 1,000 on PyPI
absl-pyProvides Google's production-tested Python…
permissive · top 1,000 on PyPI
locateProvides utilities to locate the current Python…
unclear · top 5,000 on PyPI
subprocess.runProvides a simplified interface to run shell…
permissive · top 15,000 on PyPI
emportEmport provides a single function to import…
permissive · top 15,000 on PyPI
invokeInvoke is a Python library for defining and…
permissive · top 1,000 on PyPI
denoPackages and distributes Deno (a…
permissive · top 15,000 on PyPI
runsRuns multiple subprocess commands from a text…
permissive · top 5,000 on PyPI
PyQt6-Qt6Provides the Qt6 runtime libraries required by…
copyleft · top 5,000 on PyPI
PyTestArchPyTestArch lets you define and test…
permissive · top 15,000 on PyPI
intel-cmplr-lic-rtProvides Intel oneAPI runtime licensing and…
unclear · top 15,000 on PyPI