Registry / devops / entrypoint2

entrypoint2

JSON →
library1.1pypypi✓ verified 87d ago

Entrypoint2 is an easy-to-use command-line interface for Python modules. It translates function signatures and documentation directly into `argparse` configurations, simplifying CLI creation. The current version is 1.1. Releases appear to be infrequent and event-driven, rather than on a fixed cadence.

pip install entrypoint2
INSTALL
IMPORT
SIG · ENTRYPOINT2
E
entrypoint2
devopspythonv1.1
Install
1.5s avg
Import
53ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.054s · 17.9MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 1.5s · import 0.052s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

entrypoint
from entrypoint2 import entrypoint

Define a function and decorate it with `@entrypoint`. The function's arguments become command-line parameters. You can then run the module as a script.

from entrypoint2 import entrypoint @entrypoint def hello(message): print(f"Hello, {message}!") # To run from command line: # python -m your_module_name hello World # python -m your_module_name hello --help
entrypoint2 --version
Debug
Known issues
breakingOlder versions of `entrypoint2` or its predecessor, `entrypoint`, had known issues with Python 3 compatibility. Version 1.1 and later explicitly support Python 3.6 to 3.12 and are Python 3 'only'. Projects targeting Python 2 should use older, unmaintained versions at their own risk.
fix
Ensure you are using `entrypoint2` version 1.1 or higher for Python 3 projects. Migrate Python 2 code if necessary.
affects: <1.0 (for `entrypoint`), early `entrypoint2` versions
gotchaParameter type conversion is inferred from default argument values in the function signature. If a parameter has no default value, it is treated as a string by default. This can lead to unexpected type errors at runtime if a different type is expected and no default is provided.
fix
Always provide a default value with the desired type (e.g., `def func(count=0):`) or explicitly cast the argument within your function if a default is not suitable.
affects: All versions
gotchaAutomatic short flags (e.g., `-m` for `--message`) are generated from the first letter of a parameter. However, if multiple parameters start with the same letter, only the first one encountered will receive a short flag. Subsequent parameters with the same initial letter will not have a short flag.
fix
Avoid starting multiple parameters with the same letter if you rely on automatic short flag generation, or explicitly define short flags using `entrypoint`'s advanced options (if available, consult documentation) if unique short flags are critical.
affects: All versions
gotchaThe `--version` flag automatically attempts to read the version from `__version__`, `VERSION`, or `version` variables defined in the module. If multiple such variables exist, the order of precedence is not strictly documented and might lead to an unexpected version string being displayed.
fix
To ensure correct version reporting, define only one of `__version__`, `VERSION`, or `version` in your module, or explicitly pass the version string to the decorator if such an option is provided (consult official documentation).
affects: All versions
Errors
Common errors & fixes
error: the following arguments are required: <argument_name>
The command-line program was executed without providing a value for a required positional argument defined in the decorated function's signature.
fix
When running the script, provide the missing argument. For example, if 'message' is required, run `python your_script.py 'hello world'`.
ModuleNotFoundError: No module named 'entrypoint2'
The `entrypoint2` library is not installed in the Python environment being used, or the virtual environment is not activated correctly.
fix
Install `entrypoint2` using pip: `pip install entrypoint2`. Ensure your virtual environment is activated if applicable.
ImportError: Entry point ('console_scripts', '<script_name>') not found
This error typically occurs when the Python package containing the command-line script is not correctly installed or its `setuptools` entry points are not properly registered, often due to an outdated `setuptools` or `pip` version, or issues within the virtual environment.
fix
First, ensure `pip` and `setuptools` are up-to-date: `pip install --upgrade pip setuptools`. Then, reinstall your package, preferably in a clean virtual environment, or use `pip install -e .` for editable installs during development.
Upgrade
Version history
1.1latest on PyPI · released Jun 11, 2022
Audit
Dependencies

No dependency data recorded yet.

Agent activity
8 hits · last 30 days
node
8
Resources
entrypoint2 — pip install entrypoint2 · libregistry