Skip to main content

Xenfra SDK: Core engine and utilities for the Xenfra platform.

Project description

Xenfra SDK (The Engine) 📦

PyPI License: MIT Python

The core infrastructure automation engine behind Xenfra (The Sovereign Cloud OS). This SDK provides the primitives for deploying, managing, and diagnosing applications on DigitalOcean with "Zen Mode" auto-healing.

🚀 Features

  • InfraEngine: A robust 9-phase deployment pipeline (Setup -> Asset Gen -> Droplet -> Code -> Build -> Health).
  • Dockerizer: Deterministic Dockerfile and Compose generation using Jinja2 templates.
  • Zen Mode: Utilities to automatically heal common failures (e.g., locked dpkg, exhausted ports).
  • Privacy-First: Built-in PII scrubbing for logs before they touch any AI services.
  • Security: Fernet encryption for tokens and RS256 JWT validation helpers.

📦 Installation

pip install xenfra-sdk
# or with uv
uv add xenfra-sdk

🛠️ Usage

1. Initialize the Engine

from xenfra_sdk import XenfraClient, InfraEngine

# Authenticate (Token usually comes from the CLI)
client = XenfraClient(token="xenfra_...")
engine = InfraEngine(client)

2. Deploy a Project

project_path = "/path/to/my-fastapi-app"

# The engine handles detection (Python/Node), dockerization, and provisioning
deployment = await engine.deploy(
    path=project_path,
    project_id="proj_123",
    env_vars={"DATABASE_URL": "..."}
)

print(f"🚀 Deployed successfully to: http://{deployment.ip_address}")

3. Diagnose a Failure

from xenfra_sdk.intelligence import diagnose_failure

logs = client.deployments.get_logs(deployment.id)
analysis = await diagnose_failure(logs)

print(f"Diagnosis: {analysis.root_cause}")
print(f"Suggested Fix: {analysis.suggestion}")

🔗 The Xenfra Ecosystem

This SDK is the "Body" of the Xenfra Open Core architecture:

  • xenfra-cli: The Terminal Interface (Uses this SDK).
  • xenfra-mcp: The AI Agent Interface (Uses this SDK).
  • xenfra-platform: The Private SaaS Backend (Uses this SDK).

🤝 Contributing

We welcome contributions! Please see CONTRIBUTING.md for details.

  1. Clone: git clone https://github.com/xenfracloud/xenfra-sdk
  2. Install: uv sync
  3. Test: pytest

📄 License

MIT © Xenfra Cloud

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

xenfra_sdk-0.2.4.tar.gz (50.3 kB view details)

Uploaded Source

Built Distribution

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

xenfra_sdk-0.2.4-py3-none-any.whl (63.5 kB view details)

Uploaded Python 3

File details

Details for the file xenfra_sdk-0.2.4.tar.gz.

File metadata

  • Download URL: xenfra_sdk-0.2.4.tar.gz
  • Upload date:
  • Size: 50.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for xenfra_sdk-0.2.4.tar.gz
Algorithm Hash digest
SHA256 28f457898bdc0189a27f38c0691674c1a5b85c3599e7f0d8e5662a5b840a5611
MD5 b898ca68e70d67cd75f77991139012a0
BLAKE2b-256 5bbb419375b5681253fb1b027b19ac99a3545d5ebb293989f9475b1bfef27d50

See more details on using hashes here.

File details

Details for the file xenfra_sdk-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: xenfra_sdk-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 63.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for xenfra_sdk-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 363c83f1584e90c431a527c0b4211237f457ae32e3e8660920c589a4409654e0
MD5 baee2edb522e32796b2ed4edbe485da9
BLAKE2b-256 af6f9515f5f357a3b15598ec8467868b68c860df02e7b350ec00d0ee755b414a

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