Skip to main content

takeover

Game-agnostic protocol takeover, free-threading async runtime, transactional state projection, and automation framework extracted from production multi-account game hosting.

Features

  • Pure Standard-Library FeatureRegistry: Single-point declarative registration for packet hooks (core -> domain -> reconcile), wake topics, topologically sorted ProjectionHook pipelines (project_board), lock-scoped actions, automation specs, and workers.
  • WebSocket Lifecycle & Multi-Channel Auth:
    • maintain_connection + WebSocketTransport + SessionHandshake provide login handshakes, heartbeat monitoring, kick detection (LoginRejected), and exponential reconnect backoff.
    • AuthProvider & AccountStore separate shared channel installation templates from redacted per-account credentials (0600 atomic writes) and clean up stale login drafts.
  • Transactional Field Store & Bounded Persistence:
    • FieldStateStore lazily decodes only accessed top-level fields, re-encodes dirty fields on commit, supports atomic expand_batch expansion, and rolls back partial mutations via SQLite SAVEPOINT.
    • AsyncPacketStore couples an 8 MiB in-memory live packet ring with coalesced 100ms batch writes to SQLite (packets.sqlite3), incremental auto_vacuum, and 32 MiB backpressure protection (PersistenceError).
  • Free-Threading Ready SharedRuntime & TaskLane:
    • Single shared asyncio event loop orchestrating 9 isolated BoundedPools, WakeEvent module targeting, ContextVar isolation, and a slow-call Watchdog.
    • @workflow generator coroutines drive both synchronous worker calls and native async waits without holding worker threads.
    • TaskLane enforces write/query gap separation (request_gap vs query_request_gap) and exponential failure backoff (3s/6s/12s).
  • No-Replay Automation, Timed Windows & Late Settlement: AutomationCoordinator combines FocusPolicy deferral, TimeWindow/TimedDispatcher (including overnight spans), RecoveryTracker read-only reconciliation, and delayed server settlement verifiers.
  • Turnkey Control-Plane API, Multi-User Identity & Server Factory:
    • EventHub (debounced SSE notifications), BoardUpdates (structural sharing + keyed-list diffs), build_fastapi_router, and build_system_router (/api/system/auth/*, /api/system/admin/*).
    • IdentityStore (scrypt auth, single-use invite codes, subscriptions, concurrent seat enforcement, audit log) + WorkspaceManager (user isolation, idle TTL eviction, online restoration).
    • create_fastapi_app & run_server (ServerConfig, InstanceLock flock guard, local random token auth, SPA static fallback, 12h rotating controller.log).

Installation

pip install takeover
# Optional acceleration and web extras:
pip install "takeover[fast,web]"

For local development from source:

pip install -e ".[fast,web,dev]"

Publishing to PyPI

Releases are automated via GitHub Actions Trusted Publishing (.github/workflows/publish.yml):

  1. Configure a Trusted Publisher on PyPI (Owner: JackLuguibin, Repo: takeover, Workflow: publish.yml, Environment: pypi).
  2. Tag and push a release: git tag v0.1.0 && git push origin v0.1.0.

Quick Start: Extending Fullstack for a New Game

Backend (GamePlugin)

  1. Implement GamePlugin (create_framer, create_codec, register_features).
  2. Register FeatureSpec bundles on FeatureRegistry.
  3. Boot create_fastapi_app(plugin, ServerConfig(...)) or TakeoverApp(plugin, data_dir).

See examples/demo_game/plugin.py and examples/demo_game/run_demo.py:

PYTHONPATH=src python examples/demo_game/run_demo.py

Frontend (FrontendPlugin)

  1. Copy templates/frontend/ and bind React via createReactConsoleBindings(React).
  2. Register SectionSpec, PanelSpec (with boardKeys), and DialogSpec in a FrontendPlugin.
  3. Mount useConsoleController() + ConsoleProvider + useBoardKeys(...) to subscribe to SSE deltas.

Architecture, Frontend SDK & Deployment Templates

  • Architecture: See docs/architecture.md for layered, UML class, concurrency, storage, and frontend plugin diagrams.
  • Frontend SDK (frontend-sdk/): Zero-dependency @takeover/console-sdk providing FrontendRegistry, createConsoleController, mergeBoardDelta, createConsoleStore, createInvalidationQueue, TakeoverClient, createThemeManager, and createReactConsoleBindings.
  • Frontend Template (templates/frontend/): Ready-to-use React 19 + Vite plugin console skeleton wired to @takeover/console-sdk.
  • Deploy Templates (templates/deploy/): Ready-to-use Python 3.14t multi-stage Dockerfile, compose.yaml (app + Nginx edge), nginx.conf, and publish.sh.

Testing & Quality

PYTHONPATH=src python -m unittest discover -s tests -p 'test_*.py' -v
ruff check src tests examples
ruff format --check src tests examples
npm --prefix frontend-sdk test

Metadata

Release files for takeover 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for takeover 0.1.0
File Size Uploaded Provenance Actions
takeover-0.1.0.tar.gz 77.2 kB With provenance Details for takeover-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for takeover 0.1.0
File Interpreter ABI Platform Actions
takeover-0.1.0-py3-none-any.whl Python 3 none any Details for takeover-0.1.0-py3-none-any.whl

Total release size: 150.8 kB

Release files / takeover-0.1.0.tar.gz

Download URL takeover-0.1.0.tar.gz
Size 77.2 kB
Tags Source
SHA-256 checksum
How to use checksums
4b5b6b99f1d80b43369b18ed15811a8052f8ace9a904b875edb93006efafb9da
BLAKE2b-256 checksum
How to use checksums
50e4b3ee5129bb1aaa4ad8d5672dccc9e6c578c8439775c0ffa2bc22ca93aff1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.

Transparency log

Release files / takeover-0.1.0-py3-none-any.whl

Download URL takeover-0.1.0-py3-none-any.whl
Size 73.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2fc40cdaec17fac3ff644732cdc364300ae72fd4b00846d811eca23caee414d2
BLAKE2b-256 checksum
How to use checksums
68bc8360999778ae7af77ec0f33df1777bfabd17b29b30dbf90d5f591eb0b89e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.

Transparency log

Security for takeover 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for takeover-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page