Skip to main content

Generate modern CLIs from OpenAPI specifications

Project description

CLI WIZARD

cli-wizard-banner

PyPI version Python versions License Build status Tests Coverage Code style: black Downloads

Generate modern CLIs from OpenAPI specifications.

Table of Contents

Features

Code Generation

  • Generate complete Python CLI projects from OpenAPI v3 specifications
  • Automatic command grouping based on OpenAPI tags
  • Automatic help generation for all commands
  • Clean, colored terminal output
  • --debug flag for verbose logging
  • Built-in API client with configurable base URL and timeout
  • SSL/TLS support with custom CA certificate bundles
  • --ca-file option to specify custom CA certificates at runtime
  • --no-verify-ssl flag to disable certificate verification

Customization

  • YAML-based configuration for full customization
  • Configurable output directory and package name
  • Tag inclusion/exclusion filters
  • Custom command naming via TagMapping and CommandMapping
  • Customizable splash screen with color support
  • Configurable logging with colors, file output, and rotation

Developer Experience

  • Generated projects are pip-installable out of the box
  • Auto-generated pyproject.toml, README.md, and VERSION
  • Resources (CA certs, splash files) bundled in the package
  • Profile management for storing credentials and settings

Installation

pip install cli-wizard

Usage

Step 1: Prepare Your OpenAPI Specification

Ensure you have an OpenAPI v3 specification file (JSON or YAML format). For example, openapi.yaml:

openapi: 3.0.0
info:
  title: My API
  version: 1.0.0
paths:
  /users:
    get:
      operationId: listUsers
      summary: List all users
      tags:
        - Users
      responses:
        '200':
          description: OK

Step 2: Create a Configuration File

Create a cli-wizard.yaml file with your CLI settings. At minimum, you need PackageName and DefaultBaseUrl:

# Required parameters
PackageName: "my-cli"
DefaultBaseUrl: "https://api.example.com"

# Optional: customize the splash screen
SplashFile: "splash.txt"
SplashColor: "#00FFFF"

# Optional: filter which tags to include
IncludeTags:
  - Users
  - Products

Step 3: Generate the CLI

Run the generate command:

cli-wizard generate --openapi openapi.yaml --config cli-wizard.yaml --output my-cli

This creates a complete Python CLI project in the my-cli directory.

Step 4: Install the Generated CLI

Navigate to the generated project and install it:

pip install -e my-cli

Step 5: Use Your CLI

Your CLI is now ready to use:

my-cli --help
my-cli users list-users

Configuration

See configuration reference for full documentation. See the examples directory for complete configuration examples.

Commands

cli-wizard generate

Generate a CLI from an OpenAPI specification and configuration file.

cli-wizard generate [OPTIONS]

Options:

  • --openapi, -o - Path to OpenAPI spec file (default: openapi.yaml)
  • --config, -c - Path to config YAML file (default: cli-wizard.yaml)
  • --output, -d - Output directory for generated CLI (default: cli)
  • --working-dir, -w - Working directory for resolving relative paths

Issues

Please report any issues or feature requests on the GitHub Issues page.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cli_wizard-2.0.0.tar.gz (44.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cli_wizard-2.0.0-py3-none-any.whl (59.4 kB view details)

Uploaded Python 3

File details

Details for the file cli_wizard-2.0.0.tar.gz.

File metadata

  • Download URL: cli_wizard-2.0.0.tar.gz
  • Upload date:
  • Size: 44.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for cli_wizard-2.0.0.tar.gz
Algorithm Hash digest
SHA256 5ddd77ba4e1c3005316185580c57b563b4769a54fb64730df3583b7eda8d2154
MD5 e6f5959c6a5a2a51146664cbe5fbbee2
BLAKE2b-256 3cbea45594133c9347c5c9a05f98bfd71b8897e8037a8e356f89e3355aeef189

See more details on using hashes here.

File details

Details for the file cli_wizard-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: cli_wizard-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 59.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for cli_wizard-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 09acee180db9f423364593c350684100d14b7dbc6b90605853d4a83b94414586
MD5 0b44ded5b376d4ccc888d1e81771f52d
BLAKE2b-256 c03f6855224f1bb2023cbfd46642f6cc3e72850832e50407a59984c7e4c85abe

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page