Skip to content

Latest commit

 

History

History
313 lines (203 loc) · 24.5 KB

rules.md

File metadata and controls

313 lines (203 loc) · 24.5 KB

Public build rule API re-exports

pycross_lock_file

load("@rules_pycross//pycross:defs.bzl", "pycross_lock_file")

pycross_lock_file(name, out, always_include_sdist, annotations, default_alias_single_version,
                  default_build_dependencies, disallow_builds, fully_qualified_environment_labels,
                  generate_file_map, local_wheels, lock_model_file, pypi_index, remote_wheels,
                  repo_prefix, target_environments)

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
out The output file. Label required
always_include_sdist Always include an entry for a package's sdist if one exists. Boolean optional False
annotations Optional annotations to apply to packages. Dictionary: String -> String optional {}
default_alias_single_version Generate aliases for all packages that have a single version in the lock file. Boolean optional False
default_build_dependencies A list of package keys (name or name@version) that will be used as default build dependencies. List of strings optional []
disallow_builds Do not allow pycross_wheel_build targets in the final lock file (i.e., require wheels). Boolean optional False
fully_qualified_environment_labels Generate fully-qualified environment labels. Boolean optional True
generate_file_map Generate a FILES dict containing a mapping of filenames to repo labels. Boolean optional False
local_wheels A list of wheel files. List of labels optional []
lock_model_file The lock model JSON file. Label required
pypi_index The PyPI-compatible index to use (must support the JSON API). String optional ""
remote_wheels A mapping of remote wheels to their sha256 hashes. Dictionary: String -> String optional {}
repo_prefix The prefix to apply to repository targets. Defaults to the lock file target name. String optional ""
target_environments A list of pycross_target_environment labels. List of labels optional []

pycross_pdm_lock_model

load("@rules_pycross//pycross:defs.bzl", "pycross_pdm_lock_model")

pycross_pdm_lock_model(name, all_development_groups, all_optional_groups, default,
                       development_groups, lock_file, optional_groups, project_file,
                       require_static_urls)

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
all_development_groups Install all dev dependencies. Boolean optional False
all_optional_groups Install all optional dependencies. Boolean optional False
default Whether to install dependencies from the default group. Boolean optional True
development_groups List of development dependency groups to install. List of strings optional []
lock_file The lock file. Label required
optional_groups List of optional dependency groups to install. List of strings optional []
project_file The pyproject.toml file. Label required
require_static_urls Require that the lock file is created with --static-urls. Boolean optional True

pycross_poetry_lock_model

load("@rules_pycross//pycross:defs.bzl", "pycross_poetry_lock_model")

pycross_poetry_lock_model(name, all_optional_groups, default, lock_file, optional_groups,
                          project_file)

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
all_optional_groups Install all optional dependencies. Boolean optional False
default Whether to install dependencies from the default group. Boolean optional True
lock_file The poetry.lock file. Label required
optional_groups List of optional dependency groups to install. List of strings optional []
project_file The pyproject.toml file. Label required

pycross_target_environment

load("@rules_pycross//pycross:defs.bzl", "pycross_target_environment")

pycross_target_environment(name, abis, config_setting, envornment_markers, flag_values,
                           implementation, platforms, python_compatible_with, version)

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
abis A list of PEP 425 abi tags. Defaults to ['none']. List of strings optional ["none"]
config_setting Optional config_setting target to select this environment. Label optional None
envornment_markers Environment marker overrides. Dictionary: String -> String optional {}
flag_values A list of flag values that, when satisfied, indicates this target_platform should be selected (together with python_compatible_with). Dictionary: Label -> String optional {}
implementation The PEP 425 implementation abbreviation. Defaults to 'cp' for CPython. String optional "cp"
platforms A list of PEP 425 platform tags. Defaults to ['any']. List of strings optional ["any"]
python_compatible_with A list of constraints that, when satisfied, indicates this target_platform should be selected (together with flag_values). List of labels optional []
version The python version. String required

pycross_uv_lock_model

load("@rules_pycross//pycross:defs.bzl", "pycross_uv_lock_model")

pycross_uv_lock_model(name, all_development_groups, all_optional_groups, default,
                      development_groups, lock_file, optional_groups, project_file,
                      require_static_urls)

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
all_development_groups Install all dev dependencies. Boolean optional False
all_optional_groups Install all optional dependencies. Boolean optional False
default Whether to install dependencies from the default group. Boolean optional True
development_groups List of development dependency groups to install. List of strings optional []
lock_file The lock file. Label required
optional_groups List of optional dependency groups to install. List of strings optional []
project_file The pyproject.toml file. Label required
require_static_urls Require that the lock file is created with --static-urls. Boolean optional True

pycross_wheel_build

load("@rules_pycross//pycross:defs.bzl", "pycross_wheel_build")

pycross_wheel_build(name, deps, data, build_env, config_settings, copts, linkopts, native_deps,
                    path_tools, post_build_hooks, pre_build_hooks, sdist, target_environment)

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
deps A list of Python build dependencies for the wheel. List of labels optional []
data Additional data and dependencies used by the build. List of labels optional []
build_env Environment variables passed to the sdist build. Values are subject to 'Make variable', location, and build_cwd_token expansion. Dictionary: String -> String optional {}
config_settings PEP 517 config settings passed to the sdist build. Values are subject to 'Make variable', location, and build_cwd_token expansion. Dictionary: String -> List of strings optional {}
copts Additional C compiler options. List of strings optional []
linkopts Additional C linker options. List of strings optional []
native_deps A list of native build dependencies (CcInfo) for the wheel. List of labels optional []
path_tools A mapping of binaries to names that are placed in PATH when building the sdist. Dictionary: Label -> String optional {}
post_build_hooks A list of binaries that are executed after the wheel is built. List of labels optional []
pre_build_hooks A list of binaries that are executed prior to building the sdist. List of labels optional []
sdist The sdist file. Label required
target_environment The target environment to build for. Label optional None

pycross_wheel_library

load("@rules_pycross//pycross:defs.bzl", "pycross_wheel_library")

pycross_wheel_library(name, deps, enable_implicit_namespace_pkgs, install_exclude_globs,
                      python_version, wheel)

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
deps A list of this wheel's Python library dependencies. List of labels optional []
enable_implicit_namespace_pkgs If true, disables conversion of native namespace packages into pkg-util style namespace packages. When set all py_binary and py_test targets must specify either legacy_create_init=False or the global Bazel option --incompatible_default_to_explicit_init_py to prevent __init__.py being automatically generated in every directory. This option is required to support some packages which cannot handle the conversion to pkg-util style. Boolean optional True
install_exclude_globs A list of globs for files to exclude during installation. List of strings optional []
python_version The python version required for this wheel ('PY2' or 'PY3') String optional ""
wheel The wheel file. Label required

pycross_wheel_zipimport_library

load("@rules_pycross//pycross:defs.bzl", "pycross_wheel_zipimport_library")

pycross_wheel_zipimport_library(name, deps, wheel)

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
deps A list of this wheel's Python library dependencies. List of labels optional []
wheel The wheel file. Label required

PycrossWheelInfo

load("@rules_pycross//pycross:defs.bzl", "PycrossWheelInfo")

PycrossWheelInfo(name_file, wheel_file)

Information about a Python wheel.

FIELDS

Name Description
name_file File: A file containing the canonical name of the wheel.
wheel_file File: The wheel file itself.

package_annotation

load("@rules_pycross//pycross:defs.bzl", "package_annotation")

package_annotation(always_build, build_dependencies, build_target, ignore_dependencies,
                   install_exclude_globs)

Annotations to apply to individual packages.

PARAMETERS

Name Description Default Value
always_build If True, don't use pre-build wheels for this package. False
build_dependencies A list of additional package keys (name or name@version) to use when building this package from source. []
build_target An optional override build target to use when and if this package needs to be built from source. None
ignore_dependencies A list of package keys (name or name@version) to drop from this package's set of declared dependencies. []
install_exclude_globs A list of globs for files to exclude during installation. []

RETURNS

str: A json encoded string of the provided content.

pypi_file

load("@rules_pycross//pycross:defs.bzl", "pypi_file")

pypi_file(name, filename, index, keep_metadata, package_name, package_version, repo_mapping, sha256)

Downloads a file from a PyPI-compatible package index.

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this repository. Name required
filename The name of the file to download. String required
index The base URL of the PyPI-compatible package index to use. Defaults to pypi.org. String optional "https://pypi.org"
keep_metadata Whether to store the pypi_metadata.json file for debugging. Boolean optional False
package_name The package name. String required
package_version The package version. String required
repo_mapping In WORKSPACE context only: a dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.

For example, an entry "@foo": "@bar" declares that, for any time this repository depends on @foo (such as a dependency on @foo//some:target, it should actually resolve that dependency within globally-declared @bar (@bar//some:target).

This attribute is not supported in MODULE.bazel context (when invoking a repository rule inside a module extension's implementation function).
Dictionary: String -> String optional
sha256 The expected SHA-256 of the file downloaded. String required