skillfed

public

replace __all__ with @public.add decorator

public v2020.12.3 107.9K downloads/30d#12,588 on PyPI15
Permissive license Unlicense Abandoned released

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 public

uv

uv add public

poetry

poetry add public

Installing 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__

License :: Public DomainOperating System :: OS IndependentProgramming Language :: Python :: 3

Tags

python __all__ decoratormodule export decoratorpublic api markerreplace __all__ pythonmodule visibility controlpython package exportsdynamic __all__ management
module-metadataabandoned

More Software Development packages