CLI for interacting with Plotly Cloud to deploy Dash apps
Project description
Plotly Cloud CLI
A command-line interface for interacting with Plotly Cloud to publish and manage Dash applications.
Features
- 🔐 Authentication: Login/logout with Plotly Cloud using OAuth
- 🚀 Local Development: Run Dash applications locally with comprehensive dev tools
- 📦 Publish: Publish Dash applications to Plotly Cloud with metadata management
- ⚙️ Environment Configuration: Centralized cloud configuration with staging/production support
Installation
pip install plotly-cloud
Quick Start
1. Login to Plotly Cloud
plotly login
This will open your browser for OAuth authentication.
2. Run a Dash Application
plotly run app:app
This runs your Dash app from the app module, using the app variable.
3. Publish to Plotly Cloud
# For new applications (first publish)
plotly publish --name "My App" --description "My application description"
# For existing applications (with default polling)
plotly publish
# Publish without polling status
plotly publish --poll-status=false
4. Logout
plotly logout
Environment Configuration
The CLI uses a cloud-env.toml file for environment-specific configuration (OAuth client IDs, API URLs). This file is gitignored and should be created during development or at packaging time.
Usage
Authentication Commands
Login
plotly login [--browser | --no-browser]
Options:
--browser: Open browser for authentication (default)--no-browser: Don't open browser automatically
Logout
plotly logout
Check Current User
plotly whoami
Show current user information if logged in with a valid token. If the token is invalid, it will automatically clear the credentials.
Running Applications
Basic Usage
plotly run <module:variable>
Examples:
plotly run app:app # Run app from app.py
plotly run myapp:dashboard # Run dashboard from myapp.py
plotly run main # Run from main.py (looks for first Dash app)
Advanced Options
plotly run app:app --host 0.0.0.0 --port 8080 --debug
Server Options:
--host: Host IP address (default: 127.0.0.1)--port, -p: Port number (default: 8050)--proxy: Proxy configuration--debug, -d: Enable debug mode
Development Tools:
--dev-tools-ui: Enable dev tools UI--dev-tools-props-check: Enable component prop validation--dev-tools-serve-dev-bundles: Enable serving dev bundles--dev-tools-hot-reload: Enable hot reloading--dev-tools-hot-reload-interval: Hot reload polling interval (default: 3.0s)--dev-tools-hot-reload-watch-interval: File watch interval (default: 0.5s)--dev-tools-hot-reload-max-retry: Max failed reload attempts (default: 8)--dev-tools-silence-routes-logging: Silence Werkzeug route logging--dev-tools-disable-version-check: Disable Dash version upgrade check--dev-tools-prune-errors: Prune tracebacks to user code only
Publishing Commands
Publish Application
plotly publish [OPTIONS]
Publish your Dash application to Plotly Cloud with automatic status polling.
Options:
--project-path: Path to project directory (default: current directory)--config: Path to configuration file (default: plotly-cloud.toml)--name: Application name (required for first publish)--description: Application description (optional)--output: Output path for publish zip file (default: temporary file)--keep-zip: Keep the publish zip file after upload--poll-status: Poll publish status until completion (default: true)--poll-interval: Polling interval in seconds (default: 1.0)--poll-timeout: Polling timeout in seconds (default: 180 = 3 minutes)
Examples:
# Publish with default settings (includes status polling)
plotly publish
# Publish new app with custom name and description
plotly publish --name "My Dashboard" --description "Sales analytics dashboard"
# Publish without status polling
plotly publish --poll-status=false
# Publish with custom polling settings
plotly publish --poll-interval=2.0 --poll-timeout=300
# Publish and keep the zip file
plotly publish --output=my-app.zip --keep-zip
Check Application Status
plotly status [OPTIONS]
Get current status and details of your published application.
Options:
--project-path: Path to project directory (default: current directory)--config: Path to configuration file (default: plotly-cloud.toml)
Example:
plotly status
Requirements
- Python 3.9+
Python Dependencies
httpx>=0.24.0- HTTP client for API requestsdash>=2.0.0- Dash frameworkrich>=10.0.0- Rich terminal formatting
Development Dependencies
pytest>=6.0- Testing frameworkruff>=0.1.0- Code linting and formattingpyright>=1.1.0- Type checking
Development
Setup
We use uv to manage dependencies and Just is used for task automation. Install them and use our Justfile for common development tasks:
- Clone the repository
- Install uv:
curl -LsSf https://astral.sh/uv/install.sh | shor on windows:powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" - Install Just:
cargo install justor see installation docs - Setup the development environment:
# Install dependencies just install # Setup cloud environment configuration just setup-cloud-env "your-staging-client-id" "your-production-client-id" # Install CLI in development mode just install-cli
Development Commands
Run just or just --list to see all available commands:
# Testing
just test # Run all tests
just test-cov # Run tests with coverage
just test-file tests/test_commands.py # Run specific test file
# Code Quality
just lint # Run linting
just lint-fix # Run linting with auto-fix
just format # Format code
just quality # Run all quality checks (lint + typecheck + test)
# Cloud Configuration
just setup-cloud-env <staging_id> [production_id] # Setup cloud config
just show-cloud-config # Display current configuration
# Publishing
just publish [path] # Publish to cloud (default: current directory)
# Development
just install-cli # Install CLI in development mode
just test-cli # Test CLI after installation
just run-example app:app # Run example Dash app
# Maintenance
just clean # Clean build artifacts
just build # Build package
Alternative Setup (without Just)
If you prefer not to use Just:
- Create a virtual environment:
python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate
- Install in development mode:
pip install -e ".[dev]"
Project Structure
plotly-cloud-cli/
├── plotly_cloud/
│ ├── __init__.py # Package initialization
│ ├── cli.py # Main CLI entry point
│ └── _commands.py # Command implementations
├── pyproject.toml # Project configuration
├── uv.lock # Dependency lock file
├── .gitignore # Git ignore rules
└── README.md # This file
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
For issues and questions, please open an issue on the GitHub repository.
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 plotly_cloud-0.1.0rc2.tar.gz.
File metadata
- Download URL: plotly_cloud-0.1.0rc2.tar.gz
- Upload date:
- Size: 36.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e429d2afefb9f7473fe6aefda9e3579c86087d6b62a06e691eec782d2e6fc1e
|
|
| MD5 |
3487de2f37894ef92e1527776ec47afa
|
|
| BLAKE2b-256 |
b0cee077b89ab0d9ee46382b541660cb8a00ebe5016d9804e45d6a15e7b9c3de
|
File details
Details for the file plotly_cloud-0.1.0rc2-py3-none-any.whl.
File metadata
- Download URL: plotly_cloud-0.1.0rc2-py3-none-any.whl
- Upload date:
- Size: 41.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f2feb132074640fb931ae1b760de9610630a974ae29db22b46e2b623bdb7826a
|
|
| MD5 |
89b08b5a8423119669306925c8dcfcae
|
|
| BLAKE2b-256 |
3586473e74fea7c49d53d6b9560f5a73bddf01ec02b076ef652cafef6b2de83e
|