--- id: publication version: "0.0.3" license: unclear license_treatment: permissive maintenance: dormant --- # publication — Publication helps you maintain public-api-friendly modules by preventing unintentional access to private implementation details via introspection. License: permissive · Maintenance: dormant · Downloads: 8.3M/mo ## 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 above — 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 pip install publication uv add publication 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: unspecified - Install friction: low - Maintenance: dormant - Downloads: 8.3M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags hide private implementation details, enforce public API boundaries, control module introspection, prevent accidental private imports, manage __all__ at runtime, module namespace filtering, api-design, module-introspection [View on SkillFed](https://skillfed.io/packages/publication) · [View on PyPI](https://pypi.org/project/publication/)