All Projects → benley → bazel_rules_pex

benley / bazel_rules_pex

Licence: Apache-2.0 license
Python PEX rules for Bazel

Programming Languages

python
139335 projects - #7 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to bazel rules pex

cmany
Easily batch-build cmake projects!
Stars: ✭ 15 (-59.46%)
Mutual labels:  build-automation, build-system
makesure
Simple task/command runner with declarative goals and dependencies
Stars: ✭ 230 (+521.62%)
Mutual labels:  build-automation, build-system
l3build
A testing and building system for LaTeX
Stars: ✭ 63 (+70.27%)
Mutual labels:  build-automation, build-system
build
Build system scripts based on GENie (https://github.com/bkaradzic/genie) project generator
Stars: ✭ 30 (-18.92%)
Mutual labels:  build-automation, build-system
Walk
A fast, general purpose, graph based build and task execution utility.
Stars: ✭ 108 (+191.89%)
Mutual labels:  build-automation, build-system
jagen
A software engineer's workspace manager and build systems wrapper
Stars: ✭ 32 (-13.51%)
Mutual labels:  build-automation, build-system
obs-docu
Official Open Build Service Documentation. Content gets reviewed and edited. Generated books are available at http://www.openbuildservice.org
Stars: ✭ 26 (-29.73%)
Mutual labels:  build-automation, build-system
Cbt
CBT - fun, fast, intuitive, compositional, statically checked builds written in Scala
Stars: ✭ 489 (+1221.62%)
Mutual labels:  build-automation, build-system
Hopp
Crazy rapid build system.
Stars: ✭ 24 (-35.14%)
Mutual labels:  build-automation, build-system
Flubucore
A cross platform build and deployment automation system for building projects and executing deployment scripts using C# code.
Stars: ✭ 695 (+1778.38%)
Mutual labels:  build-automation, build-system
Earthly
Repeatable builds
Stars: ✭ 5,805 (+15589.19%)
Mutual labels:  build-automation, build-system
Redo
Smaller, easier, more powerful, and more reliable than make. An implementation of djb's redo.
Stars: ✭ 1,589 (+4194.59%)
Mutual labels:  build-automation, build-system
Build Harness
🤖Collection of Makefiles to facilitate building Golang projects, Dockerfiles, Helm charts, and more
Stars: ✭ 236 (+537.84%)
Mutual labels:  build-automation, build-system
Klap
zero config, zero dependency bundler for tiny javascript packages
Stars: ✭ 143 (+286.49%)
Mutual labels:  packaging
Mason
Cross platform package manager for C/C++ apps
Stars: ✭ 230 (+521.62%)
Mutual labels:  packaging
Exodus
Painless relocation of Linux binaries–and all of their dependencies–without containers.
Stars: ✭ 2,560 (+6818.92%)
Mutual labels:  packaging
Sailboat
🐍 A quick and easy way to distribute your Python projects!
Stars: ✭ 137 (+270.27%)
Mutual labels:  packaging
cmake-python-distributions
This project provides a `setup.py` script that build CMake Python wheels.
Stars: ✭ 93 (+151.35%)
Mutual labels:  build-system
Recipe Robot
A kick ass tool for creating AutoPkg recipes.
Stars: ✭ 229 (+518.92%)
Mutual labels:  packaging
Rpmvenv
RPM packager for Python virtualenv.
Stars: ✭ 128 (+245.95%)
Mutual labels:  packaging

Python pex rules for Bazel

Overview

Rules

Macros


Overview

Build Status

Setup

Add something like this to your WORKSPACE file:

git_repository(
    name = "io_bazel_rules_pex",
    remote = "https://github.com/benley/bazel_rules_pex.git",
    tag = "0.3.0",
)
load("@io_bazel_rules_pex//pex:pex_rules.bzl", "pex_repositories")
pex_repositories()

In a BUILD file where you want to use these rules, or in your tools/build_rules/prelude_bazel file if you want them present repo-wide, add:

load(
    "@io_bazel_rules_pex//pex:pex_rules.bzl",
    "pex_binary",
    "pex_library",
    "pex_test",
    "pex_pytest",
)

Lastly, make sure that tools/build_rules/BUILD exists, even if it is empty, so that Bazel can find your prelude_bazel file.

pex_pytest

pex_pytest(name, srcs, deps, eggs, data, args, flaky, local, size, timeout, tags)

A variant of pex_test that uses py.test to run one or more sets of tests.

This produces two things:

  1. A pex_binary (<name>_runner) containing all your code and its dependencies, plus py.test, and the entrypoint set to the py.test runner.
  2. A small shell script to launch the <name>_runner executable with each of the srcs enumerated as commandline arguments. This is the actual test entrypoint for bazel.

Almost all of the attributes that can be used with pex_test work identically here, including those not specifically mentioned in this docstring. Exceptions are main and entrypoint, which cannot be used with this macro.

Attributes

name

Name; Required

A unique name for this rule.

srcs

Unknown; Required

List of files containing tests that should be run.

deps

List of strings; Optional

eggs

List of strings; Optional

data

List of strings; Optional

args

List of strings; Optional

flaky

Unknown; Optional

local

Unknown; Optional

size

Unknown; Optional

timeout

Unknown; Optional

tags

List of strings; Optional

## pex_repositories
pex_repositories()

Rules to be invoked from WORKSPACE for remote dependencies.

pex_binary

pex_binary(name, deps, data, srcs, disable_cache, eggs, entrypoint, interpreter, main, no_index, pex_use_wheels, pex_verbosity, repos, req_files, reqs, zip_safe)

Build a deployable pex executable.

Attributes

name

Name; Required

A unique name for this rule.

deps

List of labels; Optional; Default is []

Python module dependencies.

pex_library and py_library rules should work here.

data

List of labels; Optional; Default is []

Files to include as resources in the final pex binary.

Putting other rules here will cause the outputs of those rules to be embedded in this one. Files will be included as-is. Paths in the archive will be relative to the workspace root.

srcs

List of labels; Optional; Default is []

disable_cache

Boolean; Optional; Default is False

Disable caching in the pex tool entirely. Default: False

eggs

List of labels; Optional; Default is []

.egg and .whl files to include as python packages.

entrypoint

String; Optional; Default is ''

Name of a python module to use as the entrypoint.

e.g. your.project.main

If unspecified, the main attribute will be used. It is an error to specify both main and entrypoint.

interpreter

String; Optional; Default is ''

Path to the python interpreter the pex should to use in its shebang line.

main

Label; Optional

File to use as the entrypoint.

If unspecified, the first file from the srcs attribute will be used.

no_index

Boolean; Optional; Default is False

If True, don't use pypi to resolve dependencies for reqs and req_files; Default: False

pex_use_wheels

Boolean; Optional; Default is True

pex_verbosity

Integer; Optional; Default is 0

repos

List of labels; Optional; Default is []

Additional repository labels (filegroups of wheel/egg files) to look for requirements.

req_files

List of labels; Optional; Default is []

Add requirements from the given requirements files. Must be provided as labels.

This feature will reduce build determinism! It tells pex to resolve all the transitive python dependencies and fetch them from pypi.

It is recommended that you use eggs or specify no_index instead where possible.

reqs

List of strings; Optional; Default is []

External requirements to retrieve from pypi, in requirements.txt format.

This feature will reduce build determinism! It tells pex to resolve all the transitive python dependencies and fetch them from pypi.

It is recommended that you use eggs instead where possible.

zip_safe

Boolean; Optional; Default is True

## pex_library
pex_library(name, deps, data, srcs, disable_cache, eggs, no_index, repos, req_files, reqs)

Attributes

name

Name; Required

A unique name for this rule.

deps

List of labels; Optional; Default is []

Python module dependencies.

pex_library and py_library rules should work here.

data

List of labels; Optional; Default is []

Files to include as resources in the final pex binary.

Putting other rules here will cause the outputs of those rules to be embedded in this one. Files will be included as-is. Paths in the archive will be relative to the workspace root.

srcs

List of labels; Optional; Default is []

disable_cache

Boolean; Optional; Default is False

Disable caching in the pex tool entirely. Default: False

eggs

List of labels; Optional; Default is []

.egg and .whl files to include as python packages.

no_index

Boolean; Optional; Default is False

If True, don't use pypi to resolve dependencies for reqs and req_files; Default: False

repos

List of labels; Optional; Default is []

Additional repository labels (filegroups of wheel/egg files) to look for requirements.

req_files

List of labels; Optional; Default is []

Add requirements from the given requirements files. Must be provided as labels.

This feature will reduce build determinism! It tells pex to resolve all the transitive python dependencies and fetch them from pypi.

It is recommended that you use eggs or specify no_index instead where possible.

reqs

List of strings; Optional; Default is []

External requirements to retrieve from pypi, in requirements.txt format.

This feature will reduce build determinism! It tells pex to resolve all the transitive python dependencies and fetch them from pypi.

It is recommended that you use eggs instead where possible.

## pex_test
pex_test(name, deps, data, srcs, disable_cache, eggs, entrypoint, interpreter, main, no_index, pex_use_wheels, pex_verbosity, repos, req_files, reqs, zip_safe)

Attributes

name

Name; Required

A unique name for this rule.

deps

List of labels; Optional; Default is []

Python module dependencies.

pex_library and py_library rules should work here.

data

List of labels; Optional; Default is []

Files to include as resources in the final pex binary.

Putting other rules here will cause the outputs of those rules to be embedded in this one. Files will be included as-is. Paths in the archive will be relative to the workspace root.

srcs

List of labels; Optional; Default is []

disable_cache

Boolean; Optional; Default is False

Disable caching in the pex tool entirely. Default: False

eggs

List of labels; Optional; Default is []

.egg and .whl files to include as python packages.

entrypoint

String; Optional; Default is ''

Name of a python module to use as the entrypoint.

e.g. your.project.main

If unspecified, the main attribute will be used. It is an error to specify both main and entrypoint.

interpreter

String; Optional; Default is ''

Path to the python interpreter the pex should to use in its shebang line.

main

Label; Optional

File to use as the entrypoint.

If unspecified, the first file from the srcs attribute will be used.

no_index

Boolean; Optional; Default is False

If True, don't use pypi to resolve dependencies for reqs and req_files; Default: False

pex_use_wheels

Boolean; Optional; Default is True

pex_verbosity

Integer; Optional; Default is 0

repos

List of labels; Optional; Default is []

Additional repository labels (filegroups of wheel/egg files) to look for requirements.

req_files

List of labels; Optional; Default is []

Add requirements from the given requirements files. Must be provided as labels.

This feature will reduce build determinism! It tells pex to resolve all the transitive python dependencies and fetch them from pypi.

It is recommended that you use eggs or specify no_index instead where possible.

reqs

List of strings; Optional; Default is []

External requirements to retrieve from pypi, in requirements.txt format.

This feature will reduce build determinism! It tells pex to resolve all the transitive python dependencies and fetch them from pypi.

It is recommended that you use eggs instead where possible.

zip_safe

Boolean; Optional; Default is True

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].