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.

  1. Clone this repository.
  2. Initialize virtual environment and install the package 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.0.tar.gz (14.6 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.0-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: frappe_remote_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 14.6 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.0.tar.gz
Algorithm Hash digest
SHA256 e444858a9bab5ff09cdddc5c158733dcd91fd7ae78147c5243a06e641f728ae5
MD5 a3f22f073be754bcd47b0c5243469ff0
BLAKE2b-256 f04704b2c724b49d52c98625e57d6f8889d039b1076b9002515383ff02c2d105

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for frappe_remote_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e30db9f3a501f99f90adf31540e3595d60b895c5444864a6e8f02f0bed7648b1
MD5 19751dea979613467e3ceeeaa851e899
BLAKE2b-256 5462a5f0b40a643a30017e0e9f61fc5d5833230ab04daac3a421596eee52e95f

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