Skip to main content

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

Project description

aioportainer

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

pip install aioportainer

Quick Start

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

# 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

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

# Run tests
pytest

# Linting
ruff check portainer/

# Type checking
mypy portainer/

License

MIT

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

aioportainer-0.1.3.tar.gz (36.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aioportainer-0.1.3-py3-none-any.whl (23.1 kB view details)

Uploaded Python 3

File details

Details for the file aioportainer-0.1.3.tar.gz.

File metadata

  • Download URL: aioportainer-0.1.3.tar.gz
  • Upload date:
  • Size: 36.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for aioportainer-0.1.3.tar.gz
Algorithm Hash digest
SHA256 097d149ed047e991e20afaa0131591e539bc1b823a52a09a61210c4b087e86d7
MD5 d141e05149a7b188e69429a65cb3fff0
BLAKE2b-256 15ae3bdb209f65af93759e0c362af8a67e0837478f3fa05803fc9172743252b0

See more details on using hashes here.

File details

Details for the file aioportainer-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: aioportainer-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 23.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for aioportainer-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6f8f91c9a8a3cd02aa2f01aacde2fd789ca3394845c49aa6e2dcdbd7ba3bd885
MD5 6bedf5c040ccc355e9ff14b530d95433
BLAKE2b-256 938762fe49e4b11e751fd0708dca6bdb172e0c71ac202a88f8917e9178e61909

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page