# BlackAnt SDK

Python SDK for Docker operations with automatic authentication through the BlackAnt platform.

## Features

- Automatic authentication with BlackAnt platform
- Build Docker images on remote daemon
- Push images to private registry
- Service management (list, status, delete)
- Both Python API and CLI interface

## Installation

```bash
pip install blackant-sdk
```

## Quick Start

### Python API

```python
from blackant import BlackAntClient

# Initialize client
client = BlackAntClient(
    user="your-username",
    password="your-password",
    base_url="https://your-blackant-instance.com"
)

# Authenticate
if client.authenticate():
    print("Connected to BlackAnt!")

# Build and push a service
result = client.build_service(
    service_name="my-calculation",
    impl_path="./src/calculation/impl",
    tag="v1.0.0",
    push=True
)

print(f"Image: {result['full_image']}")

# List services
services = client.list_services()
for svc in services:
    print(f"  - {svc['name']}: {svc['status']}")
```

### Command Line Interface (CLI)

```bash
# Set credentials via environment variables
export BLACKANT_USER=your-username
export BLACKANT_PASSWORD=your-password
export BLACKANT_URL=https://your-blackant-instance.com

# Test connection
blackant login

# Build and push
blackant build --name my-calculation --path ./src/calculation/impl --tag v1.0.0

# List services
blackant list

# Get service status
blackant status my-calculation

# Delete service
blackant delete my-calculation
```

## Environment Variables

| Variable | Description | Default |
|----------|-------------|---------|
| `BLACKANT_USER` | Username for authentication | - |
| `BLACKANT_PASSWORD` | Password for authentication | - |
| `BLACKANT_URL` | BlackAnt platform base URL | `https://dev.blackant.app` |

## API Reference

### BlackAntClient

The main client class providing all SDK functionality.

#### Methods

| Method | Description |
|--------|-------------|
| `authenticate()` | Authenticate with BlackAnt platform |
| `test_connection()` | Test if connection is working |
| `build_service(...)` | Build Docker image and optionally push |
| `list_services()` | List all registered services |
| `get_service(name)` | Get service details |
| `get_service_status(name)` | Get service status |
| `delete_service(name)` | Delete a service |

### CLI Commands

| Command | Description |
|---------|-------------|
| `blackant login` | Test connection and authenticate |
| `blackant build` | Build Docker image and push to registry |
| `blackant list` | List all registered services |
| `blackant status <name>` | Get status of a service |
| `blackant info <name>` | Get detailed service information |
| `blackant delete <name>` | Delete a service |

Use `blackant <command> --help` for detailed options.

## Requirements

- Python 3.11+
- Access to a BlackAnt platform instance
- Valid BlackAnt credentials

## License

Proprietary - Obuda University, John von Neumann Faculty of Informatics

---

## About

<p align="center">
  <img src="https://nik.uni-obuda.hu/wp-content/uploads/2025/10/NIK_logo_header.png" alt="NIK Logo" width="300"/>
</p>

This SDK is developed and maintained by the **BlackAnt Development Team** at:

**Obuda University - John von Neumann Faculty of Informatics**
*(Óbudai Egyetem - Neumann János Informatikai Kar)*

| | |
|---|---|
| Address | 1034 Budapest, Bécsi út 96/B, Hungary |
| Phone | +36 1 666 5520 |
| Email | titkarsag@nik.uni-obuda.hu |
| Web | [nik.uni-obuda.hu](https://nik.uni-obuda.hu) |

## Support

For SDK issues and questions, contact the BlackAnt Development Team at dev@blackant.app
