epath.resource_path#
- etils.epath.resource_path(package: str | types.ModuleType) etils.epath.abstract_path.Path [source]#
Returns read-only root directory path of the module.
Used to access module resource files.
Usage:
path = epath.resource_path('tensorflow_datasets') / 'README.md' content = path.read_text()
This is compatible with everything, including zipapp (.par).
Resource files should be in the data= of the py_library( (when using bazel).
To write to your project (e.g. automatically update your code), read-only resource paths can be converted to read-write paths with epath.to_write_path(path).
- Parameters:
package – Module or module name.
- Returns:
The read-only path to the root module directory