skillfed

entrypoint

Decorated functions as entry points.

entrypoint v2.1.0 110.4K downloads/30d#12,467 on PyPI4
Permissive license MIT DORMANT released

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 entrypoint

uv

uv add entrypoint

poetry

poetry add entrypoint

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: UtilitiesTyping :: Typed

Tags

entry point decoratorconsole script boilerplatemain function decoratordecorated entry pointsscript entry point helperavoid if __name__ == __main__entry point abstraction
cli-scriptingdecorator-pattern

More Utilities packages