Back to Bazel

PyInfo

docs/versions/7.2.0/rules/lib/providers/PyInfo.mdx

9.1.05.7 KB
Original Source
<html devsite> <head> <meta name="project_path" value="/_project.yaml"> <meta name="book_path" value="/versions/7.2.0/_book.yaml"> </head> <body> <h1 class="page-title" id="modules.PyInfo">PyInfo</h1>

{% dynamic setvar source_file "src/main/java/com/google/devtools/build/lib/starlarkbuildapi/python/PyInfoApi.java" %} {% dynamic setvar version "7.2.0" %} {% dynamic setvar original_path "/rules/lib/providers/PyInfo" %} {% include "_buttons.html" %}

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

Encapsulates information provided by the Python rules.

<h2>Members</h2> <ul> <li> <a href="#PyInfo">PyInfo</a> </li> <li> <a href="#has_py2_only_sources">has_py2_only_sources</a> </li> <li> <a href="#has_py3_only_sources">has_py3_only_sources</a> </li> <li> <a href="#imports">imports</a> </li> <li> <a href="#transitive_sources">transitive_sources</a> </li> <li> <a href="#uses_shared_libraries">uses_shared_libraries</a> </li> </ul>
  <h2 id="PyInfo">PyInfo</h2>
    <p><pre class="rule-signature"><a class="anchor" href="../providers/PyInfo.html">PyInfo</a> PyInfo(transitive_sources, uses_shared_libraries=False, imports=unbound, has_py2_only_sources=False, has_py3_only_sources=False)</pre></p>

The <code>PyInfo</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="PyInfo.transitive_sources">
          <code>transitive_sources</code>
        </td>
        <td>
                      <a class="anchor" href="../builtins/depset.html">depset</a> of <a class="anchor" href="../builtins/File.html">File</a>s;
                                 required

                      The value for the new object's <code>transitive_sources</code> field.
        </td>
      </tr>
              <tr>
        <td id="PyInfo.uses_shared_libraries">
          <code>uses_shared_libraries</code>
        </td>
        <td>
                                 default is <code>False</code>

                      The value for the new object's <code>uses_shared_libraries</code> field.
        </td>
      </tr>
              <tr>
        <td id="PyInfo.imports">
          <code>imports</code>
        </td>
        <td>
                      <a class="anchor" href="../builtins/depset.html">depset</a> of <a class="anchor" href="../core/string.html">string</a>s;
                                 default is <code>unbound</code>

                      The value for the new object's <code>imports</code> field.
        </td>
      </tr>
              <tr>
        <td id="PyInfo.has_py2_only_sources">
          <code>has_py2_only_sources</code>
        </td>
        <td>
                                 default is <code>False</code>

                      The value for the new object's <code>has_py2_only_sources</code> field.
        </td>
      </tr>
              <tr>
        <td id="PyInfo.has_py3_only_sources">
          <code>has_py3_only_sources</code>
        </td>
        <td>
                                 default is <code>False</code>

                      The value for the new object's <code>has_py3_only_sources</code> field.
        </td>
      </tr>
            </tbody>
  </table>

    <h2 id="has_py2_only_sources">has_py2_only_sources</h2>
    <p><pre class="rule-signature"><a class="anchor" href="../core/bool.html">bool</a> PyInfo.has_py2_only_sources</pre></p>

Whether any of this target's transitive sources requires a Python 2 runtime.


    <h2 id="has_py3_only_sources">has_py3_only_sources</h2>
    <p><pre class="rule-signature"><a class="anchor" href="../core/bool.html">bool</a> PyInfo.has_py3_only_sources</pre></p>

Whether any of this target's transitive sources requires a Python 3 runtime.


    <h2 id="imports">imports</h2>
    <p><pre class="rule-signature"><a class="anchor" href="../builtins/depset.html">depset</a> PyInfo.imports</pre></p>

A depset of import path strings to be added to the <code>PYTHONPATH</code> of executable Python targets. These are accumulated from the transitive <code>deps</code>.<p>The order of the depset is not guaranteed and may be changed in the future. It is recommended to use <code>default</code> order (the default).


    <h2 id="transitive_sources">transitive_sources</h2>
    <p><pre class="rule-signature"><a class="anchor" href="../builtins/depset.html">depset</a> PyInfo.transitive_sources</pre></p>

A (<code>postorder</code>-compatible) depset of <code>.py</code> files appearing in the target's <code>srcs</code> and the <code>srcs</code> of the target's transitive <code>deps</code>.


    <h2 id="uses_shared_libraries">uses_shared_libraries</h2>
    <p><pre class="rule-signature"><a class="anchor" href="../core/bool.html">bool</a> PyInfo.uses_shared_libraries</pre></p>

Whether any of this target's transitive <code>deps</code> has a shared library file (such as a <code>.so</code> file).<p>This field is currently unused in Bazel and may go away in the future.
</body> </html> <!-- {% endraw %} -->