Registry / http-networking / cyclopts

cyclopts

JSON →
library4.23.3pypypi✓ verified 30d ago

Cyclopts is a modern, easy-to-use command-line interface (CLI) framework built on Python type hints, offering an intuitive and efficient developer experience. It provides advanced type hinting support, rich help page generation from docstrings, and extensive customization options for parsing and launching. The library is actively maintained, currently at version 4.10.1, with frequent updates and ongoing development towards version 5.0.

pip install cyclopts
INSTALL
IMPORT
SIG · CYCLOPTS
C
cyclopts
http-networkingpythonv4.23.3
Install
3.2s avg
Import
206ms
Disk
34MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v4.23.3 · 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.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.218s · 35.2MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 3.2s · import 0.194s · 36MB
34MB installed
● package 34MB
Code
Verified usage

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

App
✓ from cyclopts import App
Parameter
✓ from cyclopts import Parameter
Often used with `typing.Annotated` for detailed parameter configuration.
run
✓ from cyclopts import run
A terser API for simple applications with a single command.

This basic example demonstrates creating an `App` instance, registering a default command using the `@app.default` decorator, and defining parameters with type hints. Docstrings are automatically used to generate help messages. The `app()` call parses command-line arguments and executes the corresponding function.

from cyclopts import App app = App() @app.default def main(name: str, count: int = 1): """Greets the given name(s). Parameters ---------- name: str The name to greet. count: int Number of times to greet. """ for _ in range(count): print(f"Hello, {name}!") if __name__ == "__main__": # Example usage: python your_script.py World --count 3 # Or: python your_script.py --help app()
cyclopts --version
Debug
Known issues
breakingMajor version 5.x (currently in alpha) is expected to introduce breaking changes. While specific details are not yet fully documented, major version bumps typically involve API alterations. Always review the official migration guide when upgrading to a new major version.
fix
Consult the official Cyclopts v5 migration guide (when available) and update code to reflect new API patterns and behaviors.
affects: >=5.0.0a0
gotchaMigrating from Typer: `Argument` and `Option` from `typer` are replaced by `cyclopts.Parameter`. The handling of default actions, callbacks, `Enum` lookups, and `Union` types differs. Cyclopts natively supports `Union` types, unlike Typer.
fix
Replace `typer.Argument`/`typer.Option` with `cyclopts.Parameter`. Re-evaluate default command logic and how `Enum`/`Union` types are handled.
affects: All versions
gotchaParameter Resolution Order: When multiple `Parameter` annotations are applied (e.g., at the function, group, or app level), explicitly set attributes in `Annotated[..., Parameter()]` for a specific function parameter have the highest priority.
fix
Be aware of the resolution hierarchy: function-level annotations > group `default_parameter` > app `default_parameter`. Override specific behaviors at the highest-priority level needed.
affects: All versions
gotchaImplicit Type Coercion: If a function parameter lacks an explicit type hint, Cyclopts will attempt to infer its type from a non-None default value. If no default is provided, it defaults to `str`. This can lead to unexpected parsing if not explicitly hinted.
fix
Always provide explicit type hints (e.g., `value: int`) for function parameters to ensure correct type coercion and prevent unexpected `str` parsing.
affects: All versions
gotchaLazy Loading `--help` Behavior (pre-v4.8.0): Prior to version 4.8.0, running `--help` on a parent command would eagerly import and resolve *all* lazy child commands. This negated the startup-time benefits of lazy loading.
fix
Upgrade to Cyclopts v4.8.0 or later. For lazy commands, provide the `help=` argument at registration time (e.g., `app.command('module:command_func', help='Description')`) to display descriptions without triggering imports.
affects: <4.8.0
gotchaRequired parameters without default values must always be provided with an argument during command invocation. Not supplying a value for a required parameter will result in a runtime error.
fix
Ensure all required parameters are supplied with their corresponding argument values when invoking a command. Define a default value for parameters if they should be optional.
affects: All versions
Errors
Common errors & fixes
Invalid value "200" for "AGE". You are too old to be using this application.
The input value provided for a command-line argument failed a custom or built-in validation rule, even after successful type coercion. Cyclopts re-interprets `ValueError`, `TypeError`, or `AssertionError` into a user-friendly `ValidationError` message.
fix
Adjust the input value to comply with the expected validation criteria or modify the validator function if the criteria are incorrect. For example, if using `cyclopts.validators.Number.range()`, ensure the input falls within the specified range.
Unknown command "this-is-not-a-registered-command"
The command-line input specified a command name that has not been registered with the Cyclopts `App` instance using `@app.command` or `@app.default`.
fix
Ensure the command name provided on the command line exactly matches a registered command or check for typos. If the command should be available, verify it has been correctly registered with `@app.command` or that it is the default command using `@app.default`.
Parameter "--values" was specified multiple times.
A command-line parameter was provided more than once, and its definition (e.g., in `Parameter(allow_repeating=False)`) does not permit multiple occurrences.
fix
Modify the command-line input to specify the parameter only once, or adjust the `Parameter` definition in your code to `allow_repeating=True` if the argument is intended to accept multiple values that form a list or similar collection.
ImportError: Cannot import module 'nonexistent.module'.
When using Cyclopts's lazy loading feature for commands (e.g., `app.command("module.path:function")`), the specified Python module or attribute could not be found or imported at the time the command was executed.
fix
Verify that the import path (e.g., `nonexistent.module` and `func`) is correct and that the module is accessible within your Python environment. Ensure there are no typos in the module path or the function/App name specified after the colon.
Upgrade
Version history
4.23.3latest on PyPI · released Aug 26, 2026
Audit
Dependencies
richrequiredUsed for generating aesthetically pleasing help pages and formatting exceptions in the console.
typing-extensionsrequiredProvides backports of new `typing` features for older Python versions, especially `Annotated`.
attrsrequiredEnables advanced type hinting support for `attrs` classes.
docstring-parserrequiredParses function docstrings (ReST, Google, Numpydoc, Epydoc styles) to automatically generate CLI help text.
Agent activity
16 hits · last 30 days
node
14
OpenAI (training)
1
Resources
cyclopts — pip install cyclopts · libregistry