{"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":"en","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,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z"}