{"id":6358,"library":"entrypoint2","title":"entrypoint2","description":"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.","status":"active","version":"1.1","language":"python","source_language":"en","source_url":"https://github.com/ponty/entrypoint2","tags":["cli","argparse","command-line","decorator"],"install":[{"cmd":"pip install entrypoint2","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"symbol":"entrypoint","correct":"from entrypoint2 import entrypoint"}],"quickstart":{"code":"from entrypoint2 import entrypoint\n\n@entrypoint\ndef hello(message):\n    print(f\"Hello, {message}!\")\n\n# To run from command line:\n# python -m your_module_name hello World\n# python -m your_module_name hello --help","lang":"python","description":"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."},"warnings":[{"fix":"Ensure you are using `entrypoint2` version 1.1 or higher for Python 3 projects. Migrate Python 2 code if necessary.","message":"Older 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.","severity":"breaking","affected_versions":"<1.0 (for `entrypoint`), early `entrypoint2` versions"},{"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.","message":"Parameter 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.","severity":"gotcha","affected_versions":"All versions"},{"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.","message":"Automatic 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.","severity":"gotcha","affected_versions":"All versions"},{"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).","message":"The `--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.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'1.1':33 'appear':35 'argpars':24,50 'cadenc':48 'cli':27,49 'command':10,52 'command-lin':9,51 'configur':25 'creation':28 'current':30 'decor':54 'direct':22 'document':21 'driven':42 'easi':6 'easy-to-us':5 'entrypoint2':1,2 'event':41 'event-driven':40 'fix':47 'function':18 'infrequ':38 'interfac':12 'line':11,53 'modul':15 'python':14 'rather':43 'releas':34 'signatur':19 'simplifi':26 'translat':17 'use':8 'version':31","created_at":"2026-04-15T05:33:49.865128+00:00","updated_at":"2026-04-16T14:49:27.469151+00:00","problems":[{"fix":"When running the script, provide the missing argument. For example, if 'message' is required, run `python your_script.py 'hello world'`.","cause":"The command-line program was executed without providing a value for a required positional argument defined in the decorated function's signature.","error":"error: the following arguments are required: <argument_name>"},{"fix":"Install `entrypoint2` using pip: `pip install entrypoint2`. Ensure your virtual environment is activated if applicable.","cause":"The `entrypoint2` library is not installed in the Python environment being used, or the virtual environment is not activated correctly.","error":"ModuleNotFoundError: No module named 'entrypoint2'"},{"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.","cause":"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.","error":"ImportError: Entry point ('console_scripts', '<script_name>') not found"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"1.1","cli_name":"entrypoint2","cli_version":"sh: 1: entrypoint2: not found","type":"library","homepage":null,"github":"https://github.com/ponty/entrypoint2","docs":null,"changelog":null,"pypi":"https://pypi.org/project/entrypoint2/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-06-28","next_check":"2026-07-28","install_tag":null}}