A command-line tool for Frappe/ERPNext development environment management
Project description
WS Frappe CLI
A command-line tool for ### 1. Setup Development Environment
Create a new Frappe development environment:
ws setup my-erp-project
This command will:
- Create a new project directory wi###
ws setup
Initialize Frappe development environment.
Arguments:
PROJECT_NAME: Name of the project (required)
Options:
--frappe-version TEXT: Frappe version to install (default: v15.78.1)--python-path TEXT: Path to Python executable (default: python3)--force: Force setup even if directory exists
Example:
ws setup myproject --frappe-version v15.78.1
ws create-site
- Create a Python virtual environment
- Install frappe-bench
- Initialize a new bench with Frappext development environment management.
Overview
WS Frappe CLI simplifies the setup, configuration, and management of Frappe/ERPNext development environments. It provides an intuitive command-line interface for common development tasks.
🚀 Features
- 🔧 Environment Setup: Automatically set up Frappe/ERPNext development environment with virtual environment management
- 🏗️ Site Creation: Interactive site creation with validation and configuration
- 📦 App Management: Fetch and install apps from predefined list or custom GitHub repositories
- 📝 Template System: Install project documentation templates for tracking app versions and customizations
- 🔗 Git Integration: Optional Git repository initialization during setup
- ⚡ Productivity Shortcuts: Create system-wide shortcuts for common bench commands
- 🎨 Rich CLI: Colored output and interactive prompts for better user experience
- 🔄 Cross-platform: Works on Linux, macOS, and Windows
Installation
From PyPI (Recommended)
pip install ws-frappe-cli
From Source
git clone https://github.com/whitestork-erp/ws-frappe-cli.git
cd ws-frappe-cli
pip install -e .
Quick Start
1. Setup Development Environment
Initialize a new Frappe development environment:
Quick Start
ws setup
This command will:
- Create a Python virtual environment
- Install frappe-bench
- Initialize a new bench with Frappe
2. Create a Site
Create a new Frappe site:
ws create-site
Follow the interactive prompts to configure your site.
3. Install Apps
Install Frappe apps on your site:
# List predefined apps
ws fetch-app --list-predefined
# Install a specific app
ws fetch-app --app-name erpnext
# Install app from custom GitHub repository
ws fetch-app --app-name custom_app --git-repo https://github.com/user/custom_app.git
🎯 Get Apps Command
Install multiple apps from a GitHub repository's apps.json configuration file automatically.
Supports both public and private repositories with multiple authentication methods.
Required Arguments
GITHUB_URL: GitHub repository URL (HTTPS or SSH)- HTTPS:
https://github.com/user/repo - SSH:
git@github.com:user/repo.git
- HTTPS:
PROJECT_NAME: Project name within the repository's projects directory
Available Options
--dry-run: Preview what would be installed without installing--force: Skip confirmation prompt--app TEXT: Install only a specific app from the config--exclude TEXT: Exclude apps from installation (can be repeated)
Usage Examples
# Install all apps from GitHub repository project
ws get-apps https://github.com/user/repo whitestork
# Preview what would be installed
ws get-apps https://github.com/user/repo medis --dry-run
# Install only ERPNext
ws get-apps https://github.com/user/repo dbouk --app erpnext
# Install all except HRMS and Payments
ws get-apps https://github.com/user/repo nvox --exclude hrms --exclude payments
# Skip confirmation prompt
ws get-apps https://github.com/user/repo whitestork --force
Apps.json Format
The command fetches an apps.json file from docker-images/projects/{PROJECT_NAME}/apps.json in the GitHub repository with the following array structure:
[
{
"name": "erpnext",
"url": "https://github.com/frappe/erpnext",
"branch": "version-15"
},
{
"name": "hrms",
"url": "https://github.com/frappe/hrms",
"branch": "version-15"
},
{
"name": "custom_app",
"url": "https://github.com/user/custom_app",
"branch": "main"
}
]
How It Works
- GitHub Fetching: Downloads
apps.jsonfrom the specified GitHub repository - Smart Filtering: Automatically excludes the
frappeapp from installation - Branch Support: Handles specific branches and commit references
- Error Handling: Provides detailed feedback on installation success/failure
- Batch Processing: Installs multiple apps in sequence with summary report
🎯 Shortcuts Command
Create system-wide shortcuts for common bench commands to boost your productivity!
Available Options
--list: List available shortcuts--remove: Remove existing shortcuts
Available Shortcuts
bs- bench startbm- bench migratebcc- bench clear-cachebr- bench restartbef- bench export-fixtures
Usage Examples
# List available shortcuts
ws shortcuts --list
# Create shortcuts (must be run from a bench directory)
ws shortcuts
# Remove all shortcuts
ws shortcuts --remove
How It Works
- Cross-platform Support: Creates executable scripts on Windows (
.cmd) and Unix systems (shell scripts) - Smart Directory Detection: Automatically detects bench directory and activates virtual environment
- PATH Integration: Scripts are placed in
~/.local/bin(Unix) or Windows equivalent - Error Handling: Validates bench directory existence and virtual environment
Example Usage After Setup
Once shortcuts are created, you can use them from anywhere:
# Instead of: cd /path/to/bench && source env/bin/activate && bench start
bs
# Instead of: cd /path/to/bench && source env/bin/activate && bench migrate
bm
# Instead of: cd /path/to/bench && source env/bin/activate && bench clear-cache
bcc
Command Reference
ws setup
Initialize Frappe development environment.
Arguments:
PROJECT_NAME: Name of the project (required)
Options:
--frappe-version TEXT: Frappe version to install (default: v15.78.1)--python-path TEXT: Path to Python executable (default: python3)--force: Force setup even if virtual environment exists
Example:
ws setup myproject --frappe-version v15.78.1
ws create-site
Create a new Frappe site.
Options:
--site-name TEXT: Name of the site to create--admin-password TEXT: Administrator password--db-name TEXT: Database name--db-port TEXT: Database port (default: 3306)--db-root-username TEXT: Database root username (default: root)--db-root-password TEXT: Database root password--set-default: Set this site as the default site--install-apps: Install apps after site creation--apps TEXT: Specific apps to install (can be used multiple times)--no-interactive: Skip interactive prompts
Example:
ws create-site \
--site-name mysite.localhost \
--admin-password mypassword \
--set-default \
--install-apps \
--apps erpnext
ws fetch-app
Fetch and install Frappe apps.
Options:
--app-name TEXT: Name of the app to install--github-url TEXT: GitHub URL of the app--branch TEXT: Branch to install (default: develop)--site TEXT: Site to install the app on--list-predefined: List predefined apps available for installation--no-install: Only fetch the app, do not install on any site--force: Reinstall if app already exists
Examples:
# List predefined apps
ws-frappe-cli fetch-app --list-predefined
# Install ERPNext
ws-frappe-cli fetch-app --app-name erpnext
# Install custom app
ws-frappe-cli fetch-app \\
--app-name custom-app \\
--github-url https://github.com/user/custom-app \\
--branch main \\
--site mysite.localhost
Predefined Apps
The CLI comes with several predefined apps that can be installed easily:
- ERPNext: Enterprise Resource Planning
- HRMS: Human Resource Management System
- Payments: Payment Gateway Integration
- E-commerce Integrations: E-commerce Platform Integrations
Development Workflow
A typical development workflow with WS Frappe CLI:
-
Initialize Environment:
mkdir my-frappe-project cd my-frappe-project ws-frappe-cli setup
-
Create Development Site:
source env/bin/activate ws-frappe-cli create-site --site-name dev.localhost --set-default
-
Install Required Apps:
ws-frappe-cli fetch-app --app-name erpnext ws-frappe-cli fetch-app --app-name hrms
-
Start Development Server:
bench start
Configuration
Environment Variables
FRAPPE_CLI_DEFAULT_BRANCH: Default branch for Frappe (default: v15.78.1)FRAPPE_CLI_DEFAULT_PYTHON: Default Python executable (default: python3)
Config File
You can create a .frappe-cli.yaml file in your project root:
default_frappe_version: "v15.78.1"
default_python: "python3"
default_apps:
- erpnext
- hrms
Requirements
- Python 3.8+
- Git
- MariaDB/MySQL
- Redis
- Node.js (for building assets)
Troubleshooting
Common Issues
- Permission Errors: Ensure you have proper permissions for the directory
- Database Connection: Verify MariaDB/MySQL is running and accessible
- Python Version: Ensure you're using Python 3.8 or higher
Getting Help
- Check the documentation
- Report issues on GitHub
- Use
ws-frappe-cli --helpfor command-specific help
Contributing
Contributions are welcome! Please read our Contributing Guide for details.
Development Setup
-
Clone the repository:
git clone https://github.com/whitestork-erp/ws-frappe-cli.git cd ws-frappe-cli
-
Install in development mode:
pip install -e ".[dev]"
-
Run tests:
pytest
-
Run linting:
black src tests isort src tests flake8 src tests
License
This project is licensed under the MIT License - see the LICENSE file for details.
Changelog
See CHANGELOG.md for a list of changes and releases.
Credits
- Built for the Frappe Framework
- Inspired by the official bench tool
- Uses Click for the CLI interface
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ws_frappe_cli-1.1.1.tar.gz.
File metadata
- Download URL: ws_frappe_cli-1.1.1.tar.gz
- Upload date:
- Size: 29.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a0db6f876fc0875907798dd7984be785c4ca9ae052583fd4f9b7e17d42870a7e
|
|
| MD5 |
de87c8231ed8edc375e470ebec8f8ae9
|
|
| BLAKE2b-256 |
e49bfb3281cd942f18be750bf1bde38915c0176bcf83f28127f2a6066014e4bd
|
File details
Details for the file ws_frappe_cli-1.1.1-py3-none-any.whl.
File metadata
- Download URL: ws_frappe_cli-1.1.1-py3-none-any.whl
- Upload date:
- Size: 27.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7715ab49763c05d4c82a5a9578f73a25c4878bdae2906f88a627ddf6b08457c3
|
|
| MD5 |
6a03725fb4a24e2184046e97c3ed7e41
|
|
| BLAKE2b-256 |
7d7e1c8e4f028b4efc2b7df89c2e41ee8567ccf8b99ed7d4e1a6ca176d78fefc
|