Skip to main content

MinerAI Python Library for DigitalOcean Spaces Integration

Project description

MinerAI Client Library

PyPI version Python Version License: MIT Downloads

Python client library for MinerAI platform - Seamless integration with DigitalOcean Spaces for mine detection AI workflows.

Features

  • 🔐 Secure Authentication - API key-based authentication with HMAC signatures
  • 📦 DigitalOcean Spaces Integration - Upload/download images directly to/from Spaces
  • 🎯 User Isolation - Each user gets their own folder structure
  • 🚀 Pre-signed URLs - Temporary, scoped access to Spaces
  • 🔄 Backward Compatible - Works with existing minerai import patterns
  • 🧪 Type Hints - Full type annotations for better IDE support

Installation

pip install minerai


git clone https://github.com/minerai/minerai.git
cd minerai
pip install -e ".[dev]"


#Quick Start

from minerai import get_client

# Initialize with your API credentials
client = get_client(
    api_key="your_api_key",
    api_secret="your_api_secret",
    base_url="https://api.minerai.com"  # optional
)

# Get user info
user_info = client.get_user_info()
print(f"Connected as: {user_info['email']}")

# Set up folders
input_folder = client.find_or_create_user_folder(user_info['user_id'], "input")
output_folder = client.find_or_create_user_folder(user_info['user_id'], "output")

# Download images
import tempfile
with tempfile.TemporaryDirectory() as temp_dir:
    images = client.download_user_images(input_folder, temp_dir)
    print(f"Downloaded {len(images)} images")

# Upload a mask
from PIL import Image
import numpy as np

# Create a sample mask
mask = Image.fromarray(np.zeros((512, 512), dtype=np.uint8))
client.upload_mask(mask, "sample_mask.png", output_folder)

# List all job folders
jobs = client.get_job_folders()
print(f"Job folders: {jobs}")


#.env

MINERAI_API_KEY=your_api_key_here
MINERAI_API_SECRET=your_api_secret_here
MINERAI_API_URL=https://api.minerai.com  # optional




## 3. License File

### `LICENSE`
```text
MIT License

Copyright (c) 2024 MinerAI

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

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

minerai-1.0.2.tar.gz (15.7 kB view details)

Uploaded Source

Built Distribution

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

minerai-1.0.2-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file minerai-1.0.2.tar.gz.

File metadata

  • Download URL: minerai-1.0.2.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for minerai-1.0.2.tar.gz
Algorithm Hash digest
SHA256 816dca358c363ac7748e12c0e4aa54cf26b7db2efa2e72ed742783b58b061391
MD5 156244c3c0afa8988ba89752d14732b4
BLAKE2b-256 3fb2a35a0beea89bce66649f74748d1535f1d40f659933ddee0b70805d4698c7

See more details on using hashes here.

File details

Details for the file minerai-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: minerai-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for minerai-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 55369a2cf14da623ee3868f9e368e91ef2fd4c2f8fcb7cdff33a45729f81b521
MD5 adf42ae4420dbfc69cf51404e1803b78
BLAKE2b-256 6a727d3b464f14fdc3031e09a1b3dd08a6c7cd6e97462e7ea313d82aedbb6c54

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