pdoc3 references internal symbols instead of public ones #228
Comments
|
Thanks for these issues!
Lines 622 to 628 in 04960e4
Duplicate of #231. Not quite sure how to tackle this one.
Duplicate of #112. Interpolating literal docstring strings with inferred types will be clumsy at best. If someone wants to try to tackle it, sure, but it likely won't be me. |
The source of MY_VAR = 10
"""This is my variable"""Isn't this string a PEP224 docstring for this variable? |
|
It is. But that's in the module |
True, but the same is true for the classes and functions in the sample as well. And those are being documented. Is there a conceptual reason why variables are handled differently? |
If I change the source to this: def my_function(iface: MyInterface) -> str:
"""My function doc
Args:
iface (MyInterface): interface parameter doc
Returns:
return value doc
"""
return ''e.g. include type information into the argument explicitly ( Example of the generated HTML: <dl>
<dt id="pdoc_test.my_function"><code class="name flex">
<span>def <span class="ident">my_function</span></span>(<span>iface: pdoc_test._internal.interface.MyInterface) ‑> str</span>
</code></dt>
<dd>
<div class="desc"><p>My function doc</p>
<h2 id="args">Args</h2>
<dl>
<dt><strong><code>iface</code></strong> : <code><a title="pdoc_test.MyInterface" href="#pdoc_test.MyInterface">MyInterface</a></code></dt>
<dd>interface parameter doc</dd>
</dl>
<h2 id="returns">Returns</h2>
<p>return value doc</p></div>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python hljs"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">my_function</span><span class="hljs-params">(iface: MyInterface)</span> -> str:</span>
<span class="hljs-string">"""My function doc
Args:
iface (MyInterface): interface parameter doc
Returns:
return value doc
"""</span>
<span class="hljs-keyword">return</span> <span class="hljs-string">''</span></code></pre>
</details>
</dd>
</dl>
|
Yeah, there's no way to access PEP224 docstrings at runtime (i.e. via Lines 220 to 230 in 04960e4 Likewise with the type annotations in functions parameters vs. annotations in docstrings — two different code paths. Type strings in docstrings are not modified, just queried, thus making Not at all saying it's all good and perfect, but it's what we currently have. |
I do not fully understand this comment. |
|
Should have rather said the module-local variable, the one present in the module, inferred from Lines 591 to 592 in 04960e4 Function params with linked annotations are constructed in one way: Lines 1312 to 1318 in 04960e4 and types in docstrings (any backtick-quoted identifier references, really; not only Args section types) in quite another:Lines 465 to 477 in 04960e4 Better ideas welcome. |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

I am keeping my python implementation details in a package called
_internaland export the methods, classes and variables that are supposed to be the public API by re-exporting them in the__init__.pyof the parent package, e.g. like so:the signature e.g. of
my_functionis:Expected Behavior
__all__to be visible in the documentationmy_functionto reference the public typeMyInterfacemy_functionto show type informationMyInterfacein the signature ofmy_functionto the documentation ofMyInterfaceActual Behavior
MY_VARis not documented at allmy_functionshows the internal type name not the public one (it showsdef my_function (iface: pdoc_test._internal.interface.MyInterface) ‑> str)instead ofdef my_function(iface: pdoc_test.MyInterface) ‑> strmy_functiondoes not show any type hintSteps to Reproduce
I have create a small repo to reproduce at:
https://github.com/Carsten-Leue/pdoc-test
Generated documentation showing the issue is here:
https://carsten-leue.github.io/pdoc-test/pdoc_test/
Additional info
0.8.3
The text was updated successfully, but these errors were encountered: