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

Understand augmented assignments and list modifications of __all__ variable #591

Open
tristanlatr opened this issue May 28, 2022 · 1 comment

Comments

@tristanlatr
Copy link
Contributor

Would be good to use some AST inference in order to have better output when a package is using append or extend on __all__ variable. Currently, we ignore those names, so they don't get re-exported.

@tristanlatr
Copy link
Contributor Author

tristanlatr commented Jan 3, 2024

Following pyright and mypy: the following idioms should be supported for defining the values contained within __all__.
These restrictions allow pydoctor to statically determine the value of __all__.

import submodule # or from x.y import submodule
__all__ = ('a', 'b')
__all__ = ['a', 'b']
__all__ += ['a', 'b']
__all__ += submodule.__all__
__all__.extend(['a', 'b'])
__all__.extend(submodule.__all__)
__all__.append('a')

from submodule import __all__ as submod_all
__all__.extend(submod_all)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant