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

Support complex __all__ assignments #40

Closed
pawamoy opened this issue Feb 11, 2022 · 1 comment
Closed

Support complex __all__ assignments #40

pawamoy opened this issue Feb 11, 2022 · 1 comment
Labels
feature New feature or request

Comments

@pawamoy
Copy link
Member

pawamoy commented Feb 11, 2022

Is your feature request related to a problem? Please describe.
We claim to support __all__ variables for explicit exports. But we only do when it is assigned using a list/tuple and literal strings, not when summing lists and/or adding items later, and/or

Describe the solution you'd like
Support more complex assignments. Starred list elements and additions at least (+ and +=).

Describe alternatives you've considered
Stop reyling on __all__ and always resolve implicitly.

Additional context
Example: https://github.com/django/django/blob/main/django/db/models/__init__.py

@pawamoy pawamoy added the feature New feature or request label Feb 11, 2022
@tristanlatr
Copy link

Looks like it's pretty easy with astroid to do that. Work with pydocspec currently.

The inference of the __all__ variable: https://github.com/tristanlatr/pydocspec/blob/main/pydocspec/processor/mod_attr.py#L13-L46 (where it's called: https://github.com/tristanlatr/pydocspec/blob/main/pydocspec/astbuilder.py#L246)

The test case: https://github.com/tristanlatr/pydocspec/blob/main/pydocspec/test/test_astbuilder.py#L435-L470

It does not understand list.extend and list.append but I think it would be pretty easy to add since it supports the augmented assigment already.

pawamoy added a commit that referenced this issue Apr 18, 2022
@pawamoy pawamoy closed this as completed Apr 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants