publication
Publication helps you maintain public-api-friendly modules by preventing unintentional access to private implementation details via introspection.
What it is and what it does
Publication is a runtime module namespace filter that enforces a library's declared public API by hiding everything not listed in `__all__`. It solves the problem that Python developers typically discover a module's interface by exploring it interactively (via `dir()`, tab-completion, or IDE auto-import) rather than reading documentation, leading to accidental dependencies on private implementation details and imports that library authors never intended to support.
The package works by intercepting module access and removing non-public names from the runtime namespace while preserving them in a `_private` pseudo-module for legitimate internal use (tests, type-checking, inter-module access). This lets library authors write code naturally without underscore-prefixing everything, while still making the public surface clear to exploratory users. It requires only a single `publish()` call at the end of your module.
Use it for:
- Prevent users from accidentally importing internal helper functions or re-exported dependencies when exploring your library interactively
- Maintain a clean public API surface without resorting to underscore-prefixing all internal code and modules
- Allow internal tests and modules to access private implementation details via the `_private` namespace while keeping them hidden from external users
- Align library author expectations (documented public API) with user discovery patterns (interactive exploration)
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Publication hides private implementation details and imports from a module's public namespace by respecting `__all__`, while keeping them accessible via a `_private` pseudo-module for internal use.
Yes, if you are authoring a library and want to enforce a clean public API without underscore-prefixing all internal code. No, if you need active maintenance or modern Python tooling support—the package has been dormant since 2019 and may have compatibility issues with recent Python versions and type checkers. Consider it for stable, mature libraries where the one-time setup cost is justified; avoid it for new projects requiring ongoing support.
Install
publication on PyPI
pip
pip install publicationuv
uv add publicationpoetry
poetry add publicationInstalling publication
Before you install
Low install friction with no runtime dependencies. The package is dormant since January 2019 with no recent maintenance; it works with both Python 2 and 3 but has not been actively developed for several years.
License in practice
Licensed under MIT (permissive), so you can use, modify, and distribute it freely with minimal restrictions.
Quickstart
# In your module
from publication import publish
def public_function():
pass
def _private_function():
pass
__all__ = ['public_function']
publish()
# Internal code can access private details via module._private
Verify before relying
- Whether the package works correctly with Python versions released after 2019
- Compatibility with modern introspection tools and type checkers beyond the basic Mypy guidance in the description
- Whether the _private pseudo-module approach works reliably with all import patterns and edge cases
Package facts
| License | not declared (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | dormant — 2,768 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 8,276,943/month — #1,639 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: publication-0.0.3-py2.py3-none-any.whl
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
publicProvides a decorator-based alternative to…
permissive · top 15,000 on PyPI
apipkgapipkg lets you define a package's exported…
permissive · top 5,000 on PyPI
xmodLets a module behave like a callable object or…
permissive · top 5,000 on PyPI
cursorHides or shows the terminal cursor in Python…
copyleft · top 15,000 on PyPI
azure-synapse-managedprivateendpointsManages private endpoints for Azure Synapse…
permissive · top 5,000 on PyPI
stdlibsProvides a static listing of all known modules…
permissive · top 5,000 on PyPI
docspec-pythonParses Python source code into structured…
unclear · top 15,000 on PyPI
pyseccomppyseccomp provides a pure-Python interface to…
permissive · top 5,000 on PyPI