You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 8, 2024. It is now read-only.
Subpar is a utility for creating self-contained python executables. It is
designed to work well with Bazel.
Status
This project is unmaintained and considered deprecated.
Historically, subpar was the only way to produce a deployable Python artifact in Bazel.
This is no longer true; --build_python_zip and the python_zip_file output_group allows you to create executable Python zip artifacts with the standard py_binary rule.
rules_docker can also be used to build container images that launch py_binary.
Add the following to the top of any BUILD files that declare par_binary()
rules:
load("@subpar//:subpar.bzl", "par_binary")
Usage
par_binary() is a drop-in replacement for py_binary() in your BUILD files
that also builds a self-contained, single-file executable for the application,
with a .par file extension.
To build the .par file associated with a par_binary(name=myname) rule, do
bazel build //my/package:myname.par
The .par file is created alongside the python stub and .runfiles
directories that py_binary() creates, but is independent of them.
It can be copied to other directories or machines, and executed
directly without needing the .runfiles directory. The body of the
.par file contains all the srcs, deps, and data files listed.
Limitations:
C extension modules in 'deps' is not yet supported
Automatic re-extraction of '.runfiles' is not yet supported
Does not include a copy of the Python interpreter ('hermetic .par')