docs/versions/6.0.0/rules/lib/PyInfo.mdx
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="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>
<code><a class="anchor" href="depset.html">depset</a> of <a class="anchor" href="File.html">File</a>s</code>;
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 = False
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>
<code><a class="anchor" href="depset.html">depset</a> of <a class="anchor" href="string.html">string</a>s</code>;
default = unbound
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 = False
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 = False
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="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="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="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="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="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.