public
replace __all__ with @public.add decorator
What it is and what it does
The public package replaces Python's traditional `__all__` list with a `@public.add` decorator. Instead of manually maintaining a list of exported names at the top of a module, you decorate each function, class, or name you want to export, and the package automatically populates `__all__` for you. This can reduce boilerplate and keep export declarations close to their definitions.
The package has no runtime dependencies and works by modifying the module's `__all__` attribute as decorators are applied. It supports decorating functions and classes individually, or calling `public.add()` with string names to add arbitrary exports. However, the project is abandoned with no updates since 2020-12-03, so it may have compatibility issues with newer Python versions or lack support for modern language features.
Use it for:
- Replacing manual `__all__` lists in modules where you prefer keeping export declarations next to their definitions.
- Reducing boilerplate in packages with many exported functions or classes by using decorators instead of list maintenance.
- Programmatically adding names to `__all__` at module load time without editing the source list.
- Teaching or documenting which names are part of a module's public API through decorator syntax.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides a decorator-based alternative to Python's `__all__` list for marking which names should be exported from a module or package.
No. The package is abandoned (last release 2020-12-03), offers minimal functionality that can be replicated in a few lines of code, and provides no advantage over manually maintaining `__all__`. The decorator pattern it provides is a stylistic choice with no functional benefit, and the lack of maintenance creates risk for compatibility issues.
Install
public on PyPI
pip
pip install publicuv
uv add publicpoetry
poetry add publicInstalling public
Before you install
High install friction with no runtime dependencies. The package is abandoned—last release was 2020-12-03 with no commits since—and has not been maintained. Use only if the decorator pattern is essential to your workflow.
License in practice
Licensed under Unlicense (public domain), permissive treatment. You may use, modify, and distribute freely with no restrictions or attribution requirements.
Quickstart
pip install public
import public
@public.add
def func():
pass
print(__all__) # ['func']
Verify before relying
- Whether the package works correctly with modern Python versions beyond those tested at release time.
- Whether the decorator correctly handles edge cases like nested modules or dynamic imports.
- Performance or compatibility impact when used in large codebases with many exports.
Package facts
| License | Unlicense (permissive) |
| Python support | not specified |
| Install friction | high — source build required |
| Runtime dependencies | none |
| Maintenance | abandoned — 2,080 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 107,903/month — #12,588 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: public-2020.12.3.tar.gz
Keywords: public, __all__
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
atpublicProvides @public and @private decorators to…
permissive · top 5,000 on PyPI
publicationPublication hides private implementation…
permissive · top 5,000 on PyPI
deprecatProvides a Python decorator to mark functions,…
permissive · top 15,000 on PyPI
singleton-decoratorProvides a decorator that enforces singleton…
copyleft · top 15,000 on PyPI
fastapi-decoratorsConverts functions into FastAPI-compatible…
permissive · top 15,000 on PyPI
DeprecatedProvides a @deprecated decorator to mark…
permissive · top 1,000 on PyPI
cursorHides or shows the terminal cursor in Python…
copyleft · top 15,000 on PyPI
zope.deprecationProvides a decorator and utilities to mark…
unclear · top 5,000 on PyPI
varnameRetrieves variable names at runtime from inside…
permissive · top 15,000 on PyPI
decoratorProvides utilities for writing function…
permissive · top 1,000 on PyPI