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.5.tar.gz (50.6 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.5-py3-none-any.whl (63.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: xenfra_sdk-0.2.5.tar.gz
  • Upload date:
  • Size: 50.6 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.5.tar.gz
Algorithm Hash digest
SHA256 c9fe1e95a104a3d27bb3ad8481eba3551018a7140fe58842a58a04137699de1b
MD5 072f24327d91e4a213bb517027ce383a
BLAKE2b-256 64a85c8c158ecd9048693f601f60f94bce7114629571b9200461ab64ec42a74c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xenfra_sdk-0.2.5-py3-none-any.whl
  • Upload date:
  • Size: 63.8 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 73fe5eb86d1afbcfa7e90db6dcc84f8bdc2489c22110b5c7962ba243e32b1cd5
MD5 e82f988afa1a5a30bd26edcaffcae418
BLAKE2b-256 e49d8d2849c6a6a86e684511ed2a63fd6fc01b74f06942a2b94bc67378e37b15

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