Skip to main content

Typed Python SDK for the ForkTex Cloud platform — provision, deploy, and manage VPS-backed apps via a declarative manifest.

Project description

forktex-cloud

PyPI Python License

Standalone Python SDK for the ForkTex Cloud platform.

forktex-cloud is the typed httpx client + manifest plumbing that the forktex CLI uses to talk to the ForkTex Cloud control plane: project provisioning, server management, deployments, vault, manifest validation, and the docker-compose / Hetzner / Ansible bridge.

You can use it directly from any Python application — no forktex CLI required.

Install

pip install forktex-cloud

Requires Python ≥ 3.11.

Quick Start

Authenticated client

from forktex_cloud import ForktexCloudClient, CloudContext

ctx = CloudContext(controller="https://cloud.forktex.com", account_key="ftx-...")
with ForktexCloudClient.from_context(ctx) as client:
    projects = client.list_projects()
    servers  = client.list_servers()
    health   = client.health()

Direct auth

from forktex_cloud import ForktexCloudClient

# JWT bearer (user login)
with ForktexCloudClient("https://cloud.forktex.com", access_token="eyJ...") as client:
    me = client.me()

# Org-scoped API key (CI/CD)
with ForktexCloudClient(
    "https://cloud.forktex.com",
    account_key="ftx-...",
    org_id="00000000-0000-0000-0000-000000000001",
) as client:
    events = client.list_events(project_id="...")
    status = client.server_status("server-uuid")

Local dev (point at your make local stack)

client = ForktexCloudClient(
    base_url="http://localhost:8000",
    account_key="ftx-dev-key-2026",
    org_id="<your-org-uuid>",
)

Trigger a deploy pipeline

# Full up (provision + bootstrap + deploy + DNS + SSL)
job = client.up(project_dir=Path("./my-project"))      # reads forktex.json
print(job.job_id, job.deployment_id, job.status)

# Code push to an existing server (no re-provision)
job = client.deploy(server_id="...", service="api")    # Ansible deploy tag

# Tear down
job = client.down(keep_dns=True)                       # preserves DNS record

Manifest loading + validation

from forktex_cloud import Manifest, ManifestError

# Validates eagerly against the canonical Pydantic schema at construction
try:
    m = Manifest.load("forktex.json", env="production")
except ManifestError as e:
    print(f"Invalid manifest: {e}")
    raise

# Typed access to the cloud block (discriminated union over all 4 kinds)
print(m.cloud.kind)                     # "ProjectDeployment" | "StaticSite" | ...
print(m.cloud.metadata.name)
for svc in m.services_for_env(env="production"):
    print(svc.id, svc.type, svc.image)

# Wire format round-trips cleanly (model_dump → parse_cloud_block)
as_dict = m.cloud.model_dump(by_alias=True, exclude_none=True)

Secrets vault (server-side, org-scoped)

client.vault_set("POSTGRES_PASSWORD", "hunter2")
secret = client.vault_get("POSTGRES_PASSWORD")           # -> VaultGetResponse
keys   = client.vault_list()                             # -> list[str]
client.vault_delete("POSTGRES_PASSWORD")

What's in the package

Module Purpose
forktex_cloud.client Typed sync httpx client (ForktexCloudClient) + all OpenAPI-codegenned Pydantic models (ServerRead, ProjectRead, EventRead, VaultGetResponse, ...)
forktex_cloud.manifest Manifest loader, discriminated-union schema (v1beta2), deep-merge for env overlays, ManifestError
forktex_cloud.config CloudContext — controller URL, JWT / account-key, current org + project keys
forktex_cloud.scaffold forktex cloud init template generator (ProjectDeployment / StaticSite / SingleContainer / NativeBuild)
forktex_cloud.bridge docker-compose generator (local mode), Loki config, log formatters used by forktex cloud up --env local
forktex_cloud.secrets Fernet vault + ${vault:KEY} resolver for compile-time secret injection
forktex_cloud.paths Cross-platform .forktex/ + ~/.forktex/ filesystem spec (V1). See docs/forktex-directory-spec.md

All response models come from the OpenAPI codegen pipeline — one source of truth shared between the server and every consumer. No hand-written model drift.

Top-level re-exports

from forktex_cloud import (
    # Client
    ForktexCloudClient, CloudAPIError,
    # Config
    CloudContext,
    # Manifest
    Manifest, ManifestError,
    # Response models (from OpenAPI codegen)
    ApiKeyCreated, ApiKeyRead,
    EnvironmentRead, EventRead,
    HealthRead, JobResponse, MeResponse,
    OrgRead, ProjectRead, ServerRead, UserRead,
    StatusResponse, TokenResponse, VaultGetResponse,
    WorkspaceRead,
)

Versioning

The SDK follows SemVer. The client's response models are generated from the server's OpenAPI spec at a fixed SPEC_VERSION + SPEC_HASH (inspectable at runtime via forktex_cloud.client.generated.SPEC_VERSION). When the server OpenAPI changes, the SDK is regenerated and released with a bumped version.

Repository

This SDK lives inside the forktex/cloud monorepo alongside the API server (api/) and React Native client (client/). The SDK package is independently versioned and published to PyPI.

License

MIT — see LICENSE.

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

forktex_cloud-0.2.4.tar.gz (31.3 kB view details)

Uploaded Source

Built Distribution

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

forktex_cloud-0.2.4-py3-none-any.whl (37.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: forktex_cloud-0.2.4.tar.gz
  • Upload date:
  • Size: 31.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for forktex_cloud-0.2.4.tar.gz
Algorithm Hash digest
SHA256 e6fa8fece6710fa75c88fc03a8431416bab429ba02765ac0a07cd2c783dd08ee
MD5 6199498698a2f43e5ded62e63efbe3fb
BLAKE2b-256 5b47f025e54160f2ca928634cba4ffc891dd4dd6eab463762b9fd5390a20e5f0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: forktex_cloud-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 37.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for forktex_cloud-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 a41f94fbba88fb4bd98331f53210e06a589f2d755daa624587630776d906562f
MD5 9f3c1403cc5aec18770a6abec5763c6b
BLAKE2b-256 ed00ca74a9784389d961c834337da6683ab2e1362bcc0540bb82cdbcd3239373

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