@published decorator?
Closed this issue · 2 comments
Have you thought about offering a decorator, which would manage __all__
for me?
Indeed I have!
In fact this is the interface that I would (eventually) prefer.
There are other packages that do this: https://pypi.org/project/public/ https://pypi.org/project/atpublic/ https://pypi.org/project/publicize/
The problem, however, is that no other software pays attention to @public
decorators.
In particular, here are some packages I care about that interact with __all__
:
- sphinx.ext.autodoc (http://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html)
- pydoctor (https://github.com/twisted/pydoctor)
- pyflakes (and by extension, flake8: http://flake8.pycqa.org/en/latest/user/error-codes.html)
since it's a widely-respected convention, it's honored by a big long tail of other packages:
- https://pypi.org/project/sphinx-fakeinv/
- https://pypi.org/project/minipy/
- https://pypi.org/project/zope.app.apidoc/
Many of these tools statically read __all__
with ast.literal_eval
or similar, and therefore depend on it being directly present at compile time, not runtime.
As such, for the time being, until we have some way to make all these tools respect the (much nicer!) @public
decorator, we'll stick with __all__
.
Closing for now, but if someone wants to undertake the work to make this "long tail" work with publication
-ized packages, we could consider reopening.