Metadata-Version: 2.4
Name: langflow-cli
Version: 0.1.0
Summary: CLI tool for managing Langflow environments and resources
Project-URL: Homepage, https://github.com/smatiolids/langflow-cli
Project-URL: Documentation, https://github.com/smatiolids/langflow-cli#readme
Project-URL: Repository, https://github.com/smatiolids/langflow-cli
Project-URL: Issues, https://github.com/smatiolids/langflow-cli/issues
Author-email: Samuel Matioli <smatioli@gmail.com>
License: MIT
License-File: LICENSE
Keywords: api,automation,cli,langchain,langflow,workflow
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: System :: Systems Administration
Classifier: Topic :: Utilities
Requires-Python: >=3.8
Requires-Dist: click>=8.0.0
Requires-Dist: requests>=2.28.0
Requires-Dist: rich>=13.0.0
Description-Content-Type: text/markdown

# 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](https://github.com/astral-sh/uv) package manager (recommended) or pip

### Installation Methods

#### Option 1: Install from Source (Development)

1. Clone the repository:
```bash
git clone <repository-url>
cd langflow-cli
```

2. Install dependencies and the CLI:
```bash
uv sync
uv pip install -e .
```

Or with pip:
```bash
pip install -e .
```

3. Verify installation:
```bash
langflow-cli --help
```

#### Option 2: Install from Git Repository

Install directly from a git repository:
```bash
# 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

1. Build the distribution package:
```bash
# 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).

2. Install from the built package:
```bash
# 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
```

3. Distribute the package:
   - Share the `dist/` directory files with others
   - They can install using: `pip install langflow_cli-*.whl`

#### Option 4: Publish to PyPI (Public Distribution)

1. Create accounts:
   - [PyPI](https://pypi.org/account/register/) (for production)
   - [TestPyPI](https://test.pypi.org/account/register/) (for testing)

2. Install build tools:
```bash
pip install build twine
```

3. Build the package:
```bash
python -m build
```

4. Upload to TestPyPI (for testing):
```bash
twine upload --repository testpypi dist/*
```

5. Test installation from TestPyPI:
```bash
pip install --index-url https://test.pypi.org/simple/ langflow-cli
```

6. Upload to PyPI (for production):
```bash
twine upload dist/*
```

7. Install from PyPI:
```bash
pip install langflow-cli
```

#### Option 5: Install with uv tool (Global Tool)

If using `uv` as a tool manager:
```bash
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

```bash
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

```bash
# 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

```bash
# Get current configuration
langflow-cli settings get

# Use a specific profile
langflow-cli settings get --profile dev
```

### Flow Management

```bash
# 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

```bash
# 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:

```bash
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

```bash
uv sync
uv pip install -e .
```

### Running Tests

(Add test instructions when tests are added)

## License

(Add license information)

