skillfed

publication

Publication helps you maintain public-api-friendly modules by preventing unintentional access to private implementation details via introspection.

publication v0.0.3 8.3M downloads/30d#1,639 on PyPI43
Permissive license DORMANT released

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 publication

uv

uv add publication

poetry

poetry add publication

Installing 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

License :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 2Programming Language :: Python :: 3

Tags

hide private implementation detailsenforce public API boundariescontrol module introspectionprevent accidental private importsmanage __all__ at runtimemodule namespace filtering
api-designmodule-introspection

More Software Development packages