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.1.tar.gz (14.9 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.1-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: frappe_remote_cli-0.1.1.tar.gz
  • Upload date:
  • Size: 14.9 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.1.tar.gz
Algorithm Hash digest
SHA256 c816726f4d5a017e86a7cc6aed487b758ecbbda785ee3c654ed7831d46883e89
MD5 46ec0dccd97dab2bc83e7aa125a8fcf9
BLAKE2b-256 61cf0e574ba4e3a6d874abafbb874d712d02bf2eb9c9585f7ecd2611bb9b61a7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for frappe_remote_cli-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7fa887fd9d1fbba7932efdd2f6f1b8f477ade5ff5e0610c473358e76408a8f92
MD5 f9b8d983e4990930aff146cda7c2fc83
BLAKE2b-256 1a8150cb0ea8ad90635407d63d6c8e1f9a4f020a4080794f871b2531e8795205

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