Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle aliases as Documentables #775

Draft
wants to merge 71 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 55 commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
de67334
Add initial code for proper aliases handling.
Jun 26, 2021
e476cf8
Fix a reccursion error and reduce the scope of what is an module-leve…
Jun 26, 2021
5f5fca9
Still register the indirection for aliases defined in try/expect or i…
Jun 26, 2021
da6f4ce
Cleanup and documenting.
Jun 27, 2021
100e55b
Fix docstrings
Jun 27, 2021
275e815
Import Final from the typing_extensions module
Jun 27, 2021
f56d050
Add requirement typing_extensions; python_version < "3.8"
Jun 27, 2021
2c76275
Use ._alias_to attribute to store the aliases indirection instead of …
tristanlatr Jun 28, 2021
fccbd4f
Add Add Known aliases for modules and classes. Not fully functional...
tristanlatr Jun 28, 2021
e666795
Add some aliases in the RST demo
tristanlatr Jun 28, 2021
43c251b
Merge branch 'twisted-master' into alias - might be broken :/
Jan 2, 2022
3d67f95
broken :/
Jan 2, 2022
6a2af77
Merge meta files form 'twisted-master' into alias
tristanlatr May 23, 2022
606e54d
merge docs from 'twisted-master' into 'alias'
tristanlatr May 23, 2022
46c1e8e
Forgot a meta file.
tristanlatr May 23, 2022
59d46ee
merge source files 'twisted-master' into 'alias', currently fails 21 …
tristanlatr May 23, 2022
f0f38d7
wip debugging...
tristanlatr May 23, 2022
6f2e374
Add a test
tristanlatr May 23, 2022
f0b4255
Merge branch 'add-a-test-for-module-attributes-and-aliases' into alias
tristanlatr May 23, 2022
5bae337
Fix tests
tristanlatr May 23, 2022
ca1e470
passing ctx to ast.Name() is required for python 3.6
tristanlatr May 25, 2022
7cd0554
add test
tristanlatr Jun 11, 2022
174526e
Merge branch 'master' into alias
tristanlatr Jun 11, 2022
93f82d9
Re-export name in any case when processing imports parts of __all__
tristanlatr Jun 12, 2022
8cdc932
Merge branch 'alias' of github.com:tristanlatr/pydoctor into alias
tristanlatr Jun 12, 2022
fc66fa3
More tests
tristanlatr Jun 12, 2022
2db2386
Try fixing mypy
tristanlatr Jun 12, 2022
eab7a98
Move alias processing to post-process and refactors.
tristanlatr Jun 13, 2022
229405b
Move the name resolving logic into a new module: names.py
tristanlatr Jun 17, 2022
7e98ed6
Fix infinite recusion (I just forgot the indirections arg to be passe…
tristanlatr Jun 17, 2022
a0b6091
Add a tox environment that parses the cpython code to only generate t…
tristanlatr Jun 17, 2022
f82fb92
Fix expandName()
tristanlatr Jun 17, 2022
a907d14
Use protocol and more stricter checks
tristanlatr Jun 18, 2022
64a32f6
Wip import resolve import alises across modules
tristanlatr Jun 30, 2022
41cc53a
Merge branch 'twisted-master' into alias
tristanlatr Aug 18, 2022
312da1e
We now recursively resolve aliases.
tristanlatr Aug 18, 2022
fa528e4
Add docs
tristanlatr Aug 18, 2022
1fd1d17
Prevent recusrsion error
tristanlatr Aug 18, 2022
63d1894
Increase max recursions to 100.
tristanlatr Aug 18, 2022
627b82c
Small refactors
tristanlatr Aug 25, 2022
3d7e95f
Merge branch 'master' into tristanlatr/alias
tristanlatr Nov 11, 2022
e136938
Merge commit '5393bd867864aeef8e7e94f551589cbc35df96eb' into tristanl…
tristanlatr Nov 12, 2022
791da52
use report()
tristanlatr Nov 12, 2022
7fb204f
Merge commit '791da521a78af940b7092b582748112fceee401a' into 313-hand…
tristanlatr Apr 4, 2024
568478e
Remove invalid note and add missing method
tristanlatr Apr 4, 2024
c2df1e8
Loosen the checks for an alias to be recognixed, now it can be insode…
tristanlatr Apr 4, 2024
e5558de
If an import resolves to an unresolvable alias, then use the alias fu…
tristanlatr Apr 4, 2024
5811126
Add mypy exclude for newer pythons
tristanlatr Apr 4, 2024
57f1537
Revert "If an import resolves to an unresolvable alias, then use the …
tristanlatr Apr 4, 2024
6d650ad
When a module is not processed entirely, do not try to resolve it's i…
tristanlatr Apr 5, 2024
5ad8d5e
Better implementation of _resolveImport() which does not rely on the …
tristanlatr Apr 5, 2024
665b4ac
Fix a couple of issues
tristanlatr Apr 6, 2024
7a89071
Fix the linker so it doesn't always try to follow all aliases
tristanlatr Apr 6, 2024
43815d4
Filter aliases in look_for_name
tristanlatr Apr 6, 2024
97545a0
Try to be smarter in the linker
tristanlatr Jul 9, 2024
869c2c2
Cleanup dead code
tristanlatr Jul 9, 2024
40c514c
Small refactors
tristanlatr Jul 9, 2024
91f3b50
cleanup dead code
tristanlatr Jul 9, 2024
e051da3
cleanup test
tristanlatr Jul 9, 2024
e28f00f
Cleanup imports
tristanlatr Jul 9, 2024
d3b97da
Don't use the actual object for comparaison, it's not imported
tristanlatr Jul 9, 2024
8b49cc0
Merge branch 'master' into 313-handle-aliases
tristanlatr Jul 9, 2024
da8a85d
Roll back to the alias if definition not found
tristanlatr Jul 9, 2024
94045e1
Merge branch '313-handle-aliases' of github.com:twisted/pydoctor into…
tristanlatr Jul 9, 2024
deec764
Fix node2fullname()
tristanlatr Jul 9, 2024
e49925b
Fix node2fullname
tristanlatr Jul 9, 2024
39cb5d8
Try a better alternative for look_for_name()
tristanlatr Jul 9, 2024
3e28ee9
Linker more smart: keep a set of potential target names as well so we…
tristanlatr Jul 10, 2024
841d7dc
Fix the linker name -> expanded_target
tristanlatr Jul 10, 2024
9267269
Add todos
tristanlatr Aug 20, 2024
e7930bf
add a todo test
tristanlatr Sep 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ pydoctor 22.7.0
* Improve the extensibility of pydoctor (`more infos on extensions <https://pydoctor.readthedocs.io/en/latest/customize.html#use-a-custom-system-class>`_)
* Fix line numbers in reStructuredText xref warnings.
* Add support for `twisted.python.deprecated` (this was originally part of Twisted's customizations).
* Add support for re-exporting it names imported from a wildcard import.
* Add support for re-exporting names imported from a wildcard import.

pydoctor 22.5.1
^^^^^^^^^^^^^^^
Expand Down
5 changes: 4 additions & 1 deletion docs/epytext_demo/demo_epytext_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from abc import ABC
import math
from typing import overload, AnyStr, Dict, Generator, List, Union, Callable, Tuple, TYPE_CHECKING
from typing import overload, AnyStr, Dict, Generator, List, Union, Callable, Tuple, Sequence, Optional, Protocol, TYPE_CHECKING
from somelib import SomeInterface
import zope.interface
import zope.schema
Expand All @@ -32,6 +32,9 @@
This is also a constant, but annotated with typing.Final.
"""

Interface = Protocol
"""Aliases are also documented."""

@deprecated(Version("demo", "NEXT", 0, 0), replacement=math.prod)
def demo_product_deprecated(x, y) -> float: # type: ignore
return float(x * y)
Expand Down
15 changes: 14 additions & 1 deletion docs/restructuredtext_demo/demo_restructuredtext_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import math
import zope.interface
import zope.schema
from typing import overload, Callable, Sequence, Optional, AnyStr, Generator, Union, List, Dict, TYPE_CHECKING
from typing import overload, Protocol, Callable, Sequence, Optional, AnyStr, Generator, Union, List, Dict, TYPE_CHECKING
from incremental import Version
from twisted.python.deprecate import deprecated, deprecatedProperty

Expand All @@ -30,6 +30,9 @@
This is also a constant, but annotated with typing.Final.
"""

Interface = Protocol
"""Aliases are also documented."""

@deprecated(Version("demo", "NEXT", 0, 0), replacement=math.prod)
def demo_product_deprecated(x, y) -> float: # type: ignore
return float(x * y)
Expand Down Expand Up @@ -145,6 +148,7 @@ class DemoClass(ABC, _PrivateClass):
.. versionchanged:: 1.2
Add `read_and_write_delete` property.
"""
#FIXME: For some reason, the alias Demo do ont appear in the class page :/

def __init__(self, one: str, two: bytes) -> None:
"""
Expand Down Expand Up @@ -199,6 +203,12 @@ def read_and_write_delete(self) -> None:
"""
This is a docstring for deleter.
"""
pass

ro = read_only
rw = read_and_write
rwd = read_and_write_delete


class IContact(zope.interface.Interface):
"""
Expand All @@ -215,3 +225,6 @@ class IContact(zope.interface.Interface):

def send_email(text: str) -> None:
pass

_Demo = _PrivateClass
Demo = DemoClass
4 changes: 4 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ warn_unused_ignores=True

plugins=mypy_zope:plugin


exclude = (?x)(
^pydoctor\/test\/testpackages\/
)
# The following modules are currently only partially annotated:

[mypy-pydoctor.test.test_napoleon_docstring]
Expand Down
Loading