<html devsite>
<head>
  <meta name="project_path" value="/_project.yaml">
  <meta name="book_path" value="/versions/6.0.0/_book.yaml">
</head>
<body>

<h1 class="page-title" id="modules.PyRuntimeInfo">PyRuntimeInfo</h1>

<!-- {% raw %} -->

Contains information about a Python runtime, as returned by the <code>py_runtime</code>rule.<p>A Python runtime describes either a <em>platform runtime</em> or an <em>in-build runtime</em>. A platform runtime accesses a system-installed interpreter at a known path, whereas an in-build runtime points to a <code>File</code> that acts as the interpreter. In both cases, an "interpreter" is really any executable binary or wrapper script that is capable of running a Python script passed on the command line, following the same conventions as the standard CPython interpreter.

<h2>Members</h2>
<ul>
    <li>
    <a href="#PyRuntimeInfo">PyRuntimeInfo</a>
  </li>
      <li>
    <a href="#coverage_files">coverage_files</a>
  </li>
      <li>
    <a href="#coverage_tool">coverage_tool</a>
  </li>
      <li>
    <a href="#files">files</a>
  </li>
      <li>
    <a href="#interpreter">interpreter</a>
  </li>
      <li>
    <a href="#interpreter_path">interpreter_path</a>
  </li>
      <li>
    <a href="#python_version">python_version</a>
  </li>
      <li>
    <a href="#stub_shebang">stub_shebang</a>
  </li>
  </ul>

      <h2 id="PyRuntimeInfo">PyRuntimeInfo</h2>
        <p><pre class="rule-signature"><a class="anchor" href="PyRuntimeInfo.html">PyRuntimeInfo</a> PyRuntimeInfo(interpreter_path=None, interpreter=None, files=None, coverage_tool=None, coverage_files=None, python_version, stub_shebang='#!/usr/bin/env python3')</pre></p>

    The <code>PyRuntimeInfo</code> constructor.

          <!-- hide-from-toc is a class used by DevSite for the public Bazel site
      (https://developers.google.com/devsite/reference/styles/headings#hide_headings_from_the_toc) -->
      <h3 class="hide-from-toc">Parameters</h3>
      <table class="table table-bordered table-condensed table-params">
        <colgroup>
          <col class="col-param">
          <col class="param-description">
        </colgroup>
        <thead>
          <tr>
            <th>Parameter</th>
            <th>Description</th>
          </tr>
        </thead>
        <tbody>
                  <tr>
            <td id="PyRuntimeInfo.interpreter_path">
              <code>interpreter_path</code>
            </td>
            <td>
                          <code><a class="anchor" href="string.html">string</a>; or <a class="anchor" href="globals.html#None">None</a></code>;
                                     default = None<br/>
                          The value for the new object's <code>interpreter_path</code> field. Do not give a value for this argument if you pass in <code>interpreter</code>.
            </td>
          </tr>
                  <tr>
            <td id="PyRuntimeInfo.interpreter">
              <code>interpreter</code>
            </td>
            <td>
                          <code><a class="anchor" href="File.html">File</a>; or <a class="anchor" href="globals.html#None">None</a></code>;
                                     default = None<br/>
                          The value for the new object's <code>interpreter</code> field. Do not give a value for this argument if you pass in <code>interpreter_path</code>.
            </td>
          </tr>
                  <tr>
            <td id="PyRuntimeInfo.files">
              <code>files</code>
            </td>
            <td>
                          <code><a class="anchor" href="depset.html">depset</a> of <a class="anchor" href="File.html">File</a>s; or <a class="anchor" href="globals.html#None">None</a></code>;
                                     default = None<br/>
                          The value for the new object's <code>files</code> field. Do not give a value for this argument if you pass in <code>interpreter_path</code>. If <code>interpreter</code> is given and this argument is <code>None</code>, <code>files</code> becomes an empty <code>depset</code> instead.
            </td>
          </tr>
                  <tr>
            <td id="PyRuntimeInfo.coverage_tool">
              <code>coverage_tool</code>
            </td>
            <td>
                          <code><a class="anchor" href="File.html">File</a>; or <a class="anchor" href="globals.html#None">None</a></code>;
                                     default = None<br/>
                          The value for the new object's <code>coverage_tool</code> field.
            </td>
          </tr>
                  <tr>
            <td id="PyRuntimeInfo.coverage_files">
              <code>coverage_files</code>
            </td>
            <td>
                          <code><a class="anchor" href="depset.html">depset</a> of <a class="anchor" href="File.html">File</a>s; or <a class="anchor" href="globals.html#None">None</a></code>;
                                     default = None<br/>
                          The value for the new object's <code>coverage_files</code> field. Do not give a value for this argument if you do not also pass in <code>coverage_tool</code>.
            </td>
          </tr>
                  <tr>
            <td id="PyRuntimeInfo.python_version">
              <code>python_version</code>
            </td>
            <td>
                                     required<br/>
                          The value for the new object's <code>python_version</code> field.
            </td>
          </tr>
                  <tr>
            <td id="PyRuntimeInfo.stub_shebang">
              <code>stub_shebang</code>
            </td>
            <td>
                          <code><a class="anchor" href="string.html">string</a></code>;
                                     default = '#!/usr/bin/env python3'<br/>
                          The value for the new object's <code>stub_shebang</code> field. Default is <code>#!/usr/bin/env python3</code>.
            </td>
          </tr>
                </tbody>
      </table>

        <h2 id="coverage_files">coverage_files</h2>
        <p><pre class="rule-signature"><a class="anchor" href="depset.html">depset</a> PyRuntimeInfo.coverage_files</pre></p>

    The files required at runtime for using <code>coverage_tool</code>. Will be <code>None</code> if no <code>coverage_tool</code> was provided.

         May return <code>None</code>.

        <h2 id="coverage_tool">coverage_tool</h2>
        <p><pre class="rule-signature"><a class="anchor" href="File.html">File</a> PyRuntimeInfo.coverage_tool</pre></p>

    If set, this field is a <code>File</code> representing tool used for collecting code coverage information from python tests. Otherwise, this is <code>None</code>.

         May return <code>None</code>.

        <h2 id="files">files</h2>
        <p><pre class="rule-signature"><a class="anchor" href="depset.html">depset</a> PyRuntimeInfo.files</pre></p>

    If this is an in-build runtime, this field is a <code>depset</code> of <code>File</code>s that need to be added to the runfiles of an executable target that uses this runtime (in particular, files needed by <code>interpreter</code>). The value of <code>interpreter</code> need not be included in this field. If this is a platform runtime then this field is <code>None</code>.

         May return <code>None</code>.

        <h2 id="interpreter">interpreter</h2>
        <p><pre class="rule-signature"><a class="anchor" href="File.html">File</a> PyRuntimeInfo.interpreter</pre></p>

    If this is an in-build runtime, this field is a <code>File</code> representing the interpreter. Otherwise, this is <code>None</code>. Note that an in-build runtime can use either a prebuilt, checked-in interpreter or an interpreter built from source.

         May return <code>None</code>.

        <h2 id="interpreter_path">interpreter_path</h2>
        <p><pre class="rule-signature"><a class="anchor" href="string.html">string</a> PyRuntimeInfo.interpreter_path</pre></p>

    If this is a platform runtime, this field is the absolute filesystem path to the interpreter on the target platform. Otherwise, this is <code>None</code>.

         May return <code>None</code>.

        <h2 id="python_version">python_version</h2>
        <p><pre class="rule-signature"><a class="anchor" href="string.html">string</a> PyRuntimeInfo.python_version</pre></p>

    Indicates whether this runtime uses Python major version 2 or 3. Valid values are (only) <code>"PY2"</code> and <code>"PY3"</code>.


        <h2 id="stub_shebang">stub_shebang</h2>
        <p><pre class="rule-signature"><a class="anchor" href="string.html">string</a> PyRuntimeInfo.stub_shebang</pre></p>

    "Shebang" expression prepended to the bootstrapping Python stub script used when executing <code>py_binary</code> targets.  Does not apply to Windows.



</body>
</html>

<!-- {% endraw %} -->
