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

  </td>
</tr>

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

  </td>
</tr>

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

  </td>
</tr>
<tr id="parfile.default_python_version">
  <td><code>default_python_version</code></td>
  <td>
    <p><code>String; Required</code></p>
    <p>A string specifying the default Python major version to use when building this par file.</p>

Identical to par_binary, but the rule is marked as being a test.

You probably want to use par_test() instead of this.

Attributes

  </td>
</tr>
<tr id="parfile_test.default_python_version">
  <td><code>default_python_version</code></td>
  <td>
    <p><code>String; Required</code></p>
    <p>A string specifying the default Python major version to use when building this par file.</p>