CLI tool for managing Langflow environments and resources
Project description
Langflow CLI
A command-line tool for managing Langflow environments and resources. This CLI provides an easy way to interact with the Langflow API, manage multiple environments, and work with flows and projects.
Features
- Environment Management: Register and manage multiple Langflow environments/profiles (similar to AWS CLI)
- Settings: View Langflow configuration
- Flow Management: List, create, update, and delete flows
- Project Management: List, create, update, and delete projects
- Profile Support: Switch between different environments easily
Installation
Prerequisites
- Python 3.8 or higher
- uv package manager (recommended) or pip
Installation Methods
Option 1: Install from Source (Development)
- Clone the repository:
git clone <repository-url>
cd langflow-cli
- Install dependencies and the CLI:
uv sync
uv pip install -e .
Or with pip:
pip install -e .
- Verify installation:
langflow-cli --help
Option 2: Install from Git Repository
Install directly from a git repository:
# Using uv
uv pip install git+https://github.com/yourusername/langflow-cli.git
# Using pip
pip install git+https://github.com/yourusername/langflow-cli.git
# Install from a specific branch or tag
pip install git+https://github.com/yourusername/langflow-cli.git@main
pip install git+https://github.com/yourusername/langflow-cli.git@v0.1.0
Option 3: Build and Install from Distribution Package
- Build the distribution package:
# Using uv
uv build
# Using pip
pip install build
python -m build
This creates distribution files in the dist/ directory (.whl and .tar.gz files).
- Install from the built package:
# Install from wheel (recommended)
uv pip install dist/langflow_cli-*.whl
# Or using pip
pip install dist/langflow_cli-*.whl
# Or install from source distribution
pip install dist/langflow-cli-*.tar.gz
- Distribute the package:
- Share the
dist/directory files with others - They can install using:
pip install langflow_cli-*.whl
- Share the
Option 4: Publish to PyPI (Public Distribution)
pip install build twine
- Build the package:
python -m build
- Upload to TestPyPI (for testing):
twine upload --repository testpypi dist/*
- Test installation from TestPyPI:
pip install --index-url https://test.pypi.org/simple/ langflow-cli
- Upload to PyPI (for production):
twine upload dist/*
- Install from PyPI:
pip install langflow-cli
Option 5: Install with uv tool (Global Tool)
If using uv as a tool manager:
uv tool install git+https://github.com/yourusername/langflow-cli.git
The command will be available at ~/.local/bin/langflow-cli.
Configuration
The CLI uses an AWS CLI-style configuration approach. Configuration is stored in ~/.langflow-cli/:
~/.langflow-cli/config- Non-sensitive configuration (URLs, default profile)~/.langflow-cli/credentials- Sensitive API keys
Register Your First Environment
langflow-cli env register prod --url https://api.langflow.org --api-key lf_xxxxxxxxxxxxx
This will:
- Create the profile in both config and credentials files
- Set it as the default profile (if it's the first one)
Usage
Environment Management
# Register a new environment
langflow-cli env register <name> --url <url> --api-key <key>
# List all environments
langflow-cli env list
# Select default environment
langflow-cli env select <name>
# Show current environment
langflow-cli env current
# Delete an environment
langflow-cli env delete <name>
Settings
# Get current configuration
langflow-cli settings get
# Use a specific profile
langflow-cli settings get --profile dev
Flow Management
# List all flows
langflow-cli flows list
# Get flow details
langflow-cli flows get <flow_id>
# Create a new flow with JSON data string
langflow-cli flows create --name "My Flow" --data '{"description": "A test flow"}'
# Create a new flow from a JSON file
langflow-cli flows create --name "My Flow" --file /path/to/flow-data.json
# Create a flow and associate it with a project by ID
langflow-cli flows create --name "My Flow" --project-id "123e4567-e89b-12d3-a456-426614174000"
# Create a flow and associate it with a project by name
langflow-cli flows create --name "My Flow" --project-name "My Project"
# Create a flow from file and associate with a project
langflow-cli flows create --file flow.json --project-name "My Project"
# Update a flow
langflow-cli flows update <flow_id> --data '{"name": "Updated Name"}'
# Delete a flow
langflow-cli flows delete <flow_id>
Project Management
# List all projects
langflow-cli projects list
# Get project details
langflow-cli projects get <project_id>
# Create a new project
langflow-cli projects create --name "My Project" --data '{"description": "A test project"}'
# Update a project
langflow-cli projects update <project_id> --data '{"name": "Updated Name"}'
# Delete a project
langflow-cli projects delete <project_id>
Using Different Profiles
All commands support a --profile option to override the default profile:
langflow-cli flows list --profile dev
langflow-cli projects list --profile prod
Project Structure
langflow-cli/
├── langflow_cli/
│ ├── __init__.py
│ ├── cli.py # Main CLI entry point
│ ├── config.py # Configuration management
│ ├── api_client.py # Langflow API client
│ ├── commands/
│ │ ├── __init__.py
│ │ ├── env.py # Environment management commands
│ │ ├── settings.py # Settings commands
│ │ ├── flows.py # Flow commands
│ │ └── projects.py # Project commands
│ └── utils.py # Utility functions
├── README.md
└── pyproject.toml
Development
Setup Development Environment
uv sync
uv pip install -e .
Running Tests
(Add test instructions when tests are added)
License
(Add license information)
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
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 langflow_cli-0.1.0.tar.gz.
File metadata
- Download URL: langflow_cli-0.1.0.tar.gz
- Upload date:
- Size: 27.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8915fdabaa43dff81d3c1ac8815e1f1891de6461d5743e4788c802760cc9a095
|
|
| MD5 |
4fb2ead56d06ec367fdca28e796c6aa0
|
|
| BLAKE2b-256 |
135c9412b67c33670aec46cbf7a988bbd5582678df8244675fd22e4151837cc3
|
File details
Details for the file langflow_cli-0.1.0-py3-none-any.whl.
File metadata
- Download URL: langflow_cli-0.1.0-py3-none-any.whl
- Upload date:
- Size: 14.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc48cff1af5fc0e2afa60995f9dd8349d01e83af7c1246691d88b7ff53512253
|
|
| MD5 |
80fb8b95bca6ab39ef9b7c423267bea7
|
|
| BLAKE2b-256 |
987e4d743be41c203b4d33bce21a6ed14da4d091dc987731f02b28fa58692730
|