{"id":9129,"library":"more-click","title":"More Click","description":"More Click (more-click) is a Python library, currently at version 0.1.3, that provides implementations of common Command Line Interface (CLI) patterns built on top of the popular Click framework. It offers pre-defined options, web application integration utilities, and other conveniences to reduce boilerplate when developing Click-based CLIs. The library is actively maintained, with a focus on enhancing existing Click applications.","status":"active","version":"0.1.3","language":"en","source_language":"en","source_url":"https://github.com/cthoyt/more-click.git","tags":["click","cli","command-line","utility","patterns","web"],"install":[{"cmd":"pip install more-click","lang":"bash","label":"Install latest stable version"}],"dependencies":[{"reason":"Core dependency for building CLIs; more-click extends its functionality.","package":"click","optional":false},{"reason":"Requires Python 3.10 or higher.","package":"python","optional":false}],"imports":[{"note":"Common utility for adding a `--verbose` flag.","symbol":"verbose_option","correct":"from more_click import verbose_option"},{"note":"Utility for quickly creating a web application command.","symbol":"make_web_command","correct":"from more_click import make_web_command"},{"note":"Pre-defined option for specifying a host address.","symbol":"host_option","correct":"from more_click import host_option"},{"note":"Pre-defined option for specifying a port number.","symbol":"port_option","correct":"from more_click import port_option"},{"note":"Helper function to run a Flask app, optionally with Gunicorn.","symbol":"run_app","correct":"from more_click import run_app"}],"quickstart":{"code":"import click\nfrom more_click import make_web_command, verbose_option\n\n# Example of a simple web command using more-click's utility\nweb_command = make_web_command('my_package.wsgi:app') # Replace 'my_package.wsgi:app' with your actual Flask app import path\n\n@click.group()\ndef cli():\n    pass\n\n@cli.command()\n@verbose_option\n@click.option('--custom-flag', is_flag=True, help='A custom flag.')\ndef my_tool(verbose: bool, custom_flag: bool):\n    \"\"\"A command demonstrating more-click options and custom logic.\"\"\"\n    if verbose:\n        click.echo(\"Verbose mode enabled.\")\n    if custom_flag:\n        click.echo(\"Custom flag enabled.\")\n    click.echo(\"Running my_tool.\")\n\ncli.add_command(web_command, name='web') # Add the web command to your CLI group\n\nif __name__ == '__main__':\n    # To run the web command: python your_cli.py web --host 0.0.0.0 --port 8000\n    # To run my_tool: python your_cli.py my-tool -v --custom-flag\n    cli()","lang":"python","description":"This quickstart demonstrates how to use `more-click`'s `make_web_command` to integrate a Flask application into a Click CLI, and how to use a pre-defined option like `verbose_option` alongside custom Click options. Remember to replace 'my_package.wsgi:app' with the actual path to your Flask application instance."},"warnings":[{"fix":"Always use `from more_click import ...` in your Python code.","message":"When importing, use `more_click` (with an underscore) instead of `more-click` (with a hyphen). Python modules use underscores in their names, while package distribution names on PyPI often use hyphens.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure you are installing and importing the correct library for your desired functionality. If you need rich formatting, use `rich-click`. If you need reusable CLI patterns, use `more-click`.","message":"Do not confuse `more-click` with `rich-click`. While both build on Click, `more-click` provides common CLI patterns and utilities, whereas `rich-click` focuses specifically on enhancing the visual output and formatting of Click's help messages using the `rich` library.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Always import `click` alongside `more_click` and build your CLI using standard Click patterns, augmenting them with `more-click` utilities as needed.","message":"`more-click` is a collection of utilities and decorators that *extend* Click. It is not a standalone CLI framework and requires `click` to be installed and used as the underlying base for your commands.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Change your import statement from `import more-click` to `import more_click` or `from more_click import ...`.","cause":"Attempting to import the library using its PyPI package name (with a hyphen) instead of its module name (with an underscore).","error":"ModuleNotFoundError: No module named 'more-click'"},{"fix":"Verify that the string passed to `make_web_command('your_module:your_app_instance')` correctly points to your Flask application object. Ensure `your_module.py` and `your_app_instance` exist and are accessible.","cause":"The `make_web_command` utility expects a string pointing to a valid Flask application instance (e.g., 'my_package.wsgi:app'). If the specified path is incorrect or the app cannot be loaded, `run_app` will receive a `None` object.","error":"AttributeError: 'NoneType' object has no attribute 'run' (when using make_web_command)"}]}