Skip to main content

A Click-based CLI to communicate with remote Frappe sites.

Project description

Frappe Remote CLI Tool

A Python command-line utility built with Click and Requests to communicate with a remote Frappe site (v15).

Features

  • Local Configuration: Securely store connection URLs and API credentials locally in ~/.frappe-cli.json (permissions enforced at 0600). Supports multiple site profiles.
  • Interactive Prompts: Prompts you for configuration parameters when setting up connection configs if options are omitted.
  • SSL Verification Control: Bypass SSL certificate validation using the --no-verify option for local or development environments.
  • Remote RPC Executions: Call any remote whitelisted Python methods on the site via frappe.call.
  • REST DocType CRUD: Query, fetch, insert, update, or delete DocType records using clean subcommand interfaces.
  • Rich Formatting: Display API responses in raw JSON format by default (ideal for scripting/piping), with an optional -t / --table toggle flag to print formatted human-readable ASCII tables.
  • Robust Exception Handling: Clean terminal error formatting without raw stack traces.

Installation

Ensure you have Python 3.10+ installed.

Global Installation (Recommended)

The easiest way to run the CLI globally is using uv or pipx:

# Install with uv
uv tool install frappe-remote-cli

# Or install with pipx
pipx install frappe-remote-cli

Alternatively, you can install it using standard pip:

pip install frappe-remote-cli

For Local Development

If you want to modify or contribute to the codebase:

  1. Clone this repository.
  2. Initialize virtual environment and install dependencies in editable mode:
python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"

Usage

Verify the CLI is registered in your path:

frappe-cli --help

Global Options

You can specify these options before any subcommand:

  • --profile <name>: Run the command against a specific profile configuration.
  • --no-verify: Disable SSL certificate verification (useful for self-signed certificates).

1. Configuration Setup

# Set connection parameters (prompts interactively for missing arguments)
frappe-cli config set \
  --site-url "https://my-frappe-site.com" \
  --api-key "ab12cd34ef56" \
  --api-secret "gh78ij90kl12" \
  --profile production

# Interactive config (will prompt for all missing values)
frappe-cli config set --profile staging

# List all configured profiles
frappe-cli config list

# Switch default profile
frappe-cli config use staging

# Inspect active profile configuration
frappe-cli config show

# Run connection diagnostic for active profile
frappe-cli config check

# Run connection diagnostic for a specific profile with SSL validation disabled
frappe-cli --profile staging --no-verify config check

2. Method Execution (call)

Trigger any remote method decorated with @frappe.whitelist():

# Check logged-in user
frappe-cli call frappe.auth.get_logged_user

# Execute method with key-value parameters
frappe-cli call my_app.api.add -p a 10 -p b 20

# Format output as table instead of default JSON
frappe-cli call frappe.auth.get_logged_user --table

3. Document CRUD (doc)

List records:

frappe-cli doc list User --fields "name,email,first_name"

Get record:

frappe-cli doc get User Administrator

Create record:

frappe-cli doc create User -d '{"email": "new@example.com", "first_name": "New"}'

Update record:

frappe-cli doc update User new@example.com -d '{"first_name": "UpdatedName"}'

Delete record:

frappe-cli doc delete User new@example.com

Running Tests

Run the test suite containing unit, integration, and formatting tests:

pytest

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

frappe_remote_cli-0.1.2.tar.gz (15.1 kB view details)

Uploaded Source

Built Distribution

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

frappe_remote_cli-0.1.2-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file frappe_remote_cli-0.1.2.tar.gz.

File metadata

  • Download URL: frappe_remote_cli-0.1.2.tar.gz
  • Upload date:
  • Size: 15.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for frappe_remote_cli-0.1.2.tar.gz
Algorithm Hash digest
SHA256 16e93e8ea2024bba96d5a3f2c5d315a91c8f645df7216d6ddd973677ae76963c
MD5 3a16e6060d013ac6915a95f187680970
BLAKE2b-256 e61aa5c6b92052e12b57c327427efe48ed9c837d93d8cb17bfaff5021f4fd97e

See more details on using hashes here.

File details

Details for the file frappe_remote_cli-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for frappe_remote_cli-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b546e38c5422535dfed50f15f08a158a37e62afc197e81d4da5bce55a6f52e8a
MD5 f1b370ee9e57e648eaa300160e2d5332
BLAKE2b-256 2caf4d67e383d1879e720bafbf5ee52bb798eec816685d9fa0b48a39871714dd

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