Build self-contained python executables.
par_binary
par_binary(name, **kwargs)
An executable Python program.
par_binary() is a drop-in replacement for py_binary() that also builds a self-contained, single-file executable for the application, with a .par file extension.
The name
attribute shouldn't include the .par
file extension,
it's added automatically. So, for a rule like
par_binary(name="myname")
, build the file myname.par
by doing
bazel build //mypackage:myname.par
See py_binary for arguments and usage.
Attributes
name |
A unique name for this rule. |
**kwargs |
|
par_test
par_test(name, **kwargs)
An executable Python test.
Just like par_binary, but for py_test instead of py_binary. Useful if you specifically need to test a module's behaviour when used in a .par binary.
Attributes
name |
A unique name for this rule. |
**kwargs |
|
parfile
parfile(name, src, compiler, compiler_args, default_python_version, imports, main, zip_safe)
A self-contained, single-file Python program, with a .par file extension.
You probably want to use par_binary() instead of this.
TODO(b/27502830): A directory foo.par.runfiles is also created. This is a bug, don't use or depend on it.
Attributes
name |
A unique name for this rule. |
src |
A py_binary() target |
compiler |
Internal use only. |
compiler_args |
|
default_python_version |
A string specifying the default Python major version to use when building this par file. |
imports |
List of import directories to be added to the PYTHONPATH. |
main |
The name of the source file that is the main entry point of the application. See py_binary.main |
zip_safe |
Whether to import Python code and read datafiles directly from the zip archive. Otherwise, if False, all files are extracted to a temporary directory on disk each time the par file executes. |
parfile_test
parfile_test(name, src, compiler, compiler_args, default_python_version, imports, main, zip_safe)
Identical to par_binary, but the rule is marked as being a test.
You probably want to use par_test() instead of this.
Attributes
name |
A unique name for this rule. |
src |
A py_binary() target |
compiler |
Internal use only. |
compiler_args |
|
default_python_version |
A string specifying the default Python major version to use when building this par file. |
imports |
List of import directories to be added to the PYTHONPATH. |
main |
The name of the source file that is the main entry point of the application. See py_binary.main |
zip_safe |
Whether to import Python code and read datafiles directly from the zip archive. Otherwise, if False, all files are extracted to a temporary directory on disk each time the par file executes. |