Skip to main content
Version: 0.1.x

rules

Public API re-exports

Rules

py_wheel

Example usage (generated):

load("@aspect_rules_py//py:defs.bzl", "py_wheel")

py_wheel(
# A unique name for this target.
name = "",
)

name

Required name.

A unique name for this target.

src

Optional label. Default: None

Macros and Functions

py_binary

Wrapper macro for the py_binary rule, setting a default for imports.

It also creates a virtualenv to constrain the interpreter and packages used at runtime, you can bazel run [name].venv to produce this, then use it in the editor.

Example usage (generated):

load("@aspect_rules_py//py:defs.bzl", "py_binary")

py_binary(
# name of the rule
name = "",
)

name

Required.

name of the rule

srcs

Optional. Default: []

python source files

main

Optional. Default: None

the entry point. If absent, then the first entry in srcs is used.

imports

Optional. Default: ["."]

kwargs

Optional.

see py_binary attributes

py_library

Wrapper macro for the py_library rule, setting a default for imports

Example usage (generated):

load("@aspect_rules_py//py:defs.bzl", "py_library")

py_library(
# name of the rule
name = "",
)

name

Required.

name of the rule

imports

Optional. Default: ["."]

kwargs

Optional.

see py_library attributes

py_pytest_main

py_pytest_main wraps the template rendering target and the final py_library.

Example usage (generated):

load("@aspect_rules_py//py:defs.bzl", "py_pytest_main")

py_pytest_main(
# The name of the runable target that updates the test entry file.
name = "",
)

name

Required.

The name of the runable target that updates the test entry file.

py_library

Optional. Default: <function py_library>

Use this attribute to override the default py_library rule.

kwargs

Optional.

The extra arguments passed to the template rendering target.

py_test

Identical to py_binary, but produces a target that can be used with bazel test.

Example usage (generated):

load("@aspect_rules_py//py:defs.bzl", "py_test")

py_test(
name = "",
)

name

Required.

main

Optional. Default: None

srcs

Optional. Default: []

imports

Optional. Default: ["."]

kwargs

Optional.