A re-implementation of py_library.
Supports "virtual" dependencies with a virtual_deps
attribute, which lists packages which are required
without binding them to a particular version of that package.
py_library(name, data, deps, imports, resolutions, srcs, virtual_deps)
ATTRIBUTES
Name | Description | Type | Mandatory | Default |
---|---|---|---|---|
name | A unique name for this target. | Name | required | |
data | Runtime dependencies of the program. The transitive closure of the data dependencies will be available in the .runfiles folder for this binary/test. The program may optionally use the Runfiles lookup library to locate the data files, see https://pypi.org/project/bazel-runfiles/. |
List of labels | optional | [] |
deps | Targets that produce Python code, commonly py_library rules. |
List of labels | optional | [] |
imports | List of import directories to be added to the PYTHONPATH. | List of strings | optional | [] |
resolutions | Satisfy a virtual_dep with a mapping from external package name to the label of an installed package that provides it. See virtual dependencies. | Dictionary: Label -> String | optional | {} |
srcs | Python source files. | List of labels | optional | [] |
virtual_deps | - | List of strings | optional | [] |
py_library_utils.implementation(ctx)
PARAMETERS
Name | Description | Default Value |
---|---|---|
ctx | - |
none |
py_library_utils.make_imports_depset(ctx, imports, extra_imports_depsets)
PARAMETERS
Name | Description | Default Value |
---|---|---|
ctx | - |
none |
imports | - |
[] |
extra_imports_depsets | - |
[] |
py_library_utils.make_instrumented_files_info(ctx, extra_source_attributes, extra_dependency_attributes)
PARAMETERS
Name | Description | Default Value |
---|---|---|
ctx | - |
none |
extra_source_attributes | - |
[] |
extra_dependency_attributes | - |
[] |
py_library_utils.make_merged_runfiles(ctx, extra_depsets, extra_runfiles, extra_runfiles_depsets)
PARAMETERS
Name | Description | Default Value |
---|---|---|
ctx | - |
none |
extra_depsets | - |
[] |
extra_runfiles | - |
[] |
extra_runfiles_depsets | - |
[] |
py_library_utils.make_srcs_depset(ctx)
PARAMETERS
Name | Description | Default Value |
---|---|---|
ctx | - |
none |
py_library_utils.resolve_virtuals(ctx, ignore_missing)
PARAMETERS
Name | Description | Default Value |
---|---|---|
ctx | - |
none |
ignore_missing | - |
False |