entrypoint
Decorated functions as entry points.
What it is and what it does
entrypoint is a lightweight decorator library that simplifies defining console entry points in Python scripts. Instead of writing the standard `if __name__ == "__main__":` boilerplate, you decorate your main function with `@entrypoint(__name__)` and it executes only when the script runs directly, not when imported. The library depends on attrs, named, and typing-aliases for its implementation.
The package offers multiple usage patterns: a simple decorator form for immediate execution, a `.call()` method for manual control over when the function runs, and an `is_main()` function that mimics the traditional `if __name__ == "__main__":` check. It enforces the convention that entry point functions take no arguments and return nothing, though this is only validated by type-checkers, not at runtime.
Use it for:
- Simplify CLI script definitions by replacing repetitive `if __name__ == "__main__":` blocks with a clean decorator.
- Ensure main functions are never accidentally executed during module imports in larger projects.
- Build command-line tools where you want explicit, type-safe entry point declarations.
- Migrate existing scripts to a more declarative entry point style without changing logic.
- Enforce consistent entry point patterns across a team or codebase.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides a decorator to mark functions as entry points, eliminating boilerplate code for console script execution while preventing accidental execution on import.
Yes, if you write console scripts regularly and want cleaner, more explicit entry point declarations. The package is stable, has no security issues, and adds minimal dependency weight. The dormant maintenance is not a concern—it is feature-complete and unlikely to need updates. Install it for codebases where you value readability and consistency in script structure.
Install
entrypoint on PyPI
pip
pip install entrypointuv
uv add entrypointpoetry
poetry add entrypointInstalling entrypoint
Before you install
Low friction installation with a pure Python wheel. Maintenance is dormant—last release was 789 days ago—but the package is marked Production/Stable and has no known vulnerabilities, suggesting it is feature-complete rather than abandoned.
License in practice
MIT license is permissive and imposes no restrictions on commercial or private use, modification, or redistribution, making this safe for any project.
Quickstart
from entrypoint import entrypoint
@entrypoint(__name__)
def main() -> None:
print("Hello, world!")
# Run: python file.py → prints "Hello, world!"
# Import: import file → no output
Requires Python 3.8 or above.
Verify before relying
- Whether the package is actively maintained or considered feature-complete and stable by design.
- Real-world adoption rate beyond the top 15000 PyPI packages metric.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — attrs, named, typing-aliases |
| Maintenance | dormant — 789 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 110,357/month — #12,467 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: entrypoint-2.1.0-py3-none-any.whl
Keywords: python, entrypoint, entry
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
entrypointsDiscovers and loads entry points from installed…
permissive · top 1,000 on PyPI
logdecoratorLogdecorator provides Python decorators to add…
permissive · top 15,000 on PyPI
entrypoint2Converts Python function signatures and…
permissive · top 15,000 on PyPI
AutologgingAutologging provides decorators to…
permissive · top 15,000 on PyPI
typing-aliasesProvides a collection of type aliases for…
permissive · top 15,000 on PyPI
backports.entry-points-selectableProvides forward-compatible access to…
permissive · top 15,000 on PyPI
decopatchDecopatch simplifies writing decorators in…
permissive · top 5,000 on PyPI
dpguiProvides a web-based GUI for collecting…
copyleft · top 15,000 on PyPI
mixed-methodsProvides a decorator that lets a single method…
permissive · top 15,000 on PyPI
cliffcliff is a framework for building command-line…
permissive · top 5,000 on PyPI