Metadata-Version: 2.4
Name: aioportainer
Version: 0.1.2
Summary: Async CLI for Portainer API with Git integration, health monitoring, image watching and event listening
Author-email: Author <author@example.com>
License: MIT
Project-URL: Homepage, https://github.com/Gazdea/aioportainer
Project-URL: Repository, https://github.com/Gazdea/aioportainer
Project-URL: Issues, https://github.com/Gazdea/aioportainer/issues
Keywords: portainer,docker,api,async,cli,devops
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
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: Programming Language :: Python :: 3.13
Classifier: Topic :: System :: Systems Administration
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: aiohttp>=3.9.0
Requires-Dist: click>=8.0.0
Requires-Dist: urllib3>=2.0.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
Requires-Dist: syrupy>=4.0.0; extra == "dev"
Requires-Dist: ruff>=0.1.0; extra == "dev"
Requires-Dist: mypy>=1.0.0; extra == "dev"
Requires-Dist: pre-commit>=3.0.0; extra == "dev"
Provides-Extra: docs
Requires-Dist: mkdocs>=1.5.0; extra == "docs"
Requires-Dist: mkdocs-material>=9.0.0; extra == "docs"
Dynamic: license-file

# homelab-portainer

Async CLI for Portainer API with Git integration, health monitoring, image watching and event listening.

## Features

- **Async HTTP Client** - Full Portainer API coverage
- **Stack Management** - Git-based deploy with automatic commit/push/redeploy
- **Container Management** - Start, stop, restart, logs, stats
- **Health Monitoring** - Stack and container health checks
- **Image Watcher** - Monitor Docker images for updates
- **Event Listener** - Real-time Docker events streaming

## Installation

```bash
pip install -e .
```

## Quick Start

```python
import asyncio
from portainer import PortainerClient, StackManager

async def main():
    async with PortainerClient(
        url="https://portainer:9443",
        token="your-api-key",
    ) as client:
        sm = StackManager(client)
        stacks = await sm.list_stacks()
        for s in stacks:
            print(f"{s.name}: {s.status_text}")

asyncio.run(main())
```

## CLI Usage

```bash
# Set token
$env:PORTAINER_TOKEN="your-token"

# List stacks
portainer stack list --url "https://portainer:9443" --token $env:PORTAINER_TOKEN

# Deploy stack
portainer stack deploy mystack "update message"

# Monitor images
portainer watch images --interval 6

# Listen to events
portainer events start --duration 30
```

## Project Structure

```
portainer/
├── client.py         # HTTP client (Portainer API)
├── models.py         # Dataclass models
├── stack_manager.py  # Stack operations + git
├── container_manager.py  # Container operations
├── monitor.py        # Health monitoring
├── watcher.py        # ImageWatcher
├── listener.py       # EventListener
└── cli.py            # CLI
```

## Development

```bash
# Install with dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Linting
ruff check portainer/

# Type checking
mypy portainer/
```

## License

MIT
