<p dir="auto">More about this in -&gt; <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="981868037" data-permission-text="Title is private" data-url="https://github.com/microsoft/pylance-release/issues/1737" data-hovercard-type="issue" data-hovercard-url="/microsoft/pylance-release/issues/1737/hovercard?comment_id=908574952&amp;comment_type=issue_comment" href="https://github.com/microsoft/pylance-release/issues/1737#issuecomment-908574952">microsoft/pylance-release#1737 (comment)</a></p>
<p dir="auto">vscode autocompletion<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/42299606/131394457-106902a0-8665-4e68-bc72-645b0ecf1d07.png"><img src="https://user-images.githubusercontent.com/42299606/131394457-106902a0-8665-4e68-bc72-645b0ecf1d07.png" alt="131223662-3ce951c3-9b59-41d9-b617-6f3a010bedfe" style="max-width: 100%;"></a></p>
<p dir="auto">Mypy requires public API of a package being exported using either <code class="notranslate">__all__</code> or <code class="notranslate">import ... as ...</code> syntax.</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="python3 -m venv env
source env/bin/activate
pip install -U pip mypy jax
python -m mypy --install-types --non-interactive --strict -c &quot;from jax import numpy as jnp; xs = jnp.zeros(1)&quot;

&lt;string&gt;:1: error: Module has no attribute &quot;zeros&quot;
Found 1 error in 1 file (checked 1 source file)"><pre class="notranslate">python3 -m venv env
<span class="pl-c1">source</span> env/bin/activate
pip install -U pip mypy jax
python -m mypy --install-types --non-interactive --strict -c <span class="pl-s"><span class="pl-pds">"</span>from jax import numpy as jnp; xs = jnp.zeros(1)<span class="pl-pds">"</span></span>

<span class="pl-k">&lt;</span>string<span class="pl-k">&gt;</span>:1: error: Module has no attribute <span class="pl-s"><span class="pl-pds">"</span>zeros<span class="pl-pds">"</span></span>
Found 1 error <span class="pl-k">in</span> 1 file (checked 1 <span class="pl-c1">source</span> file)</pre></div>
<p dir="auto">Currently, projects that are using jax need to set<code class="notranslate">--no-implicit-reexport=False</code>.</p>
<p dir="auto">There are some references on that matter.</p>
<ul dir="auto">
<li><a href="https://www.python.org/dev/peps/pep-0484/#stub-files" rel="nofollow">PEP-0484</a>
<blockquote>
<ul dir="auto">
<li>Modules and variables imported into the stub are not considered exported from the stub unless the import uses the import ... as ... form or the equivalent from ... import ... as ... form.</li>
<li>However, as an exception to the previous bullet, all objects imported into a stub using from ... import * are considered exported.</li>
</ul>
</blockquote>
</li>
<li><a href="https://mypy.readthedocs.io/en/stable/command_line.html#cmdoption-mypy-no-implicit-reexport" rel="nofollow">MyPy docs</a>
<blockquote>
<p dir="auto"><code class="notranslate">--no-implicit-reexport</code> always treated as enabled for stub files.</p>
</blockquote>
</li>
</ul>
<p dir="auto">Is it possible to add a little boilerplate to <code class="notranslate">__init__.py</code> to make it working? :-)</p>