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.3.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.3-py3-none-any.whl (63.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: xenfra_sdk-0.2.3.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.3.tar.gz
Algorithm Hash digest
SHA256 fdda2d09a3d6860d3195250dcf47469edeb4ae9f228be8fd71c601d5a52f0a5f
MD5 cf5a925982e8966fc3735222eb0ab56e
BLAKE2b-256 7f4666496e43ca4d78c380b51824ffdc807cfc59c00b8433738b36cb2d4b6d1c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xenfra_sdk-0.2.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f3a5e44228a2614dd2d74251027ef60745db1465f0695da42b07df5d9d196e31
MD5 ee99627c1e27d7b5d385d2241d720f8f
BLAKE2b-256 0172219cca887720b758fd9cc7dd71e88f1c6d0c3e205b9019d13f176e824db0

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