Skip to main content

nil-xit

Python binding for nil-xit – a C++ bridge that connects backends to frontend UIs with a tiny, explicit protocol.

Define frames, values, and signals in C++; interact with them from Python. The client can be web, desktop, or any runtime that speaks the protocol.

Features

  • Frames – Group values and signals displayed by a UI component
  • Two flavors – Unique (one instance) and tagged (keyed by a tag)
  • Values – Bidirectional data binding with buffer types (bytes)
  • Signals – Events from UI to backend with byte payloads
  • Options – Key/value preprocessing hints for the frontend

Installation

pip install nil-xit

Quick Start

import nil_xit
import nil_service

# Create HTTP server on 127.0.0.1:1101
http = nil_service.create_http_server("127.0.0.1", 1101, 100 * 1024 * 1024)

# Setup server with the built-in svelte page
nil_xit.setup_svelte_server(http)

# Create websocket event service
ws = http.use_ws("/ws")

# Create core from web service and websocket event
core = nil_xit.create_core(http, ws)

# Add a frame
frame = core.add_unique_frame(
    "index",
    nil_xit.FileInfo(group="base", path="gui/Demo.svelte"),
)
frame.add_option("index_mode", "demo")

# Add a value with getter and setter (buffer type)
def encode_value() -> bytes:
    return b"hello world"

def decode_value(data: bytes) -> None:
    print(f"value changed: {data.decode('utf-8')}")

value = frame.add_value("my_value", encode_value, decode_value)

# Add a signal handler (payload is bytes; you can ignore it if unused)
def on_button_click(payload: bytes) -> None:
    print(f"Button clicked! payload size: {len(payload)}")
    value.post(b"updated value")

frame.add_signal("click", on_button_click)

# Add preprocessing options for the frontend
frame.add_option("theme", "dark")

# Main loop
while True:
    http.poll()

For a complete example, see sandbox/main.py.

Supported Types

The Python binding supports buffer types only:

  • bytes – Binary data passed as buffer_type<T> in C++
    • Values use getter/setter functions that work with bytes
    • Signals pass byte payloads (handlers may ignore the payload argument)

Frames and FileInfo

Frame creation accepts an optional FileInfo that defines the asset group and relative path used by the frontend.

frame = core.add_unique_frame(
    "index",
    nil_xit.FileInfo(group="base", path="gui/Demo.svelte"),
)

Architecture

The Python binding wraps the C API (libnil-xit-c-api.so) which provides access to:

  • unique frames – Single-instance UI components
  • tagged frames – Multi-instance UI components (keyed by tag)
  • values – Bidirectional data binding with buffer types
  • signals – Events from UI to backend with byte payloads

Documentation

For detailed API documentation and more examples, visit:

License

CC BY-NC-ND 4.0

Support

For issues, questions, or contributions, visit the GitHub repository.

Metadata

Release files for nil-xit 0.3.24

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

Built distributions (wheels)

Table of built distributions (wheels) for nil-xit 0.3.24
File Interpreter ABI Platform Actions
nil_xit-0.3.24-py3-none-manylinux_2_39_x86_64.whl Python 3 none Linux glibc 2.39+ x86-64 Details for nil_xit-0.3.24-py3-none-manylinux_2_39_x86_64.whl
nil_xit-0.3.24-py3-none-any.whl Python 3 none any Details for nil_xit-0.3.24-py3-none-any.whl

Total release size: 232.5 kB

Release files / nil_xit-0.3.24-py3-none-manylinux_2_39_x86_64.whl

Download URL nil_xit-0.3.24-py3-none-manylinux_2_39_x86_64.whl
Size 116.4 kB
Tags Linux glibc 2.39+ x86-64 Python 3
SHA-256 checksum
How to use checksums
ad608524bba50603a24245c3c9da06c54487247e86698b620663f286241897e9
BLAKE2b-256 checksum
How to use checksums
abe4308015787cf5021b9830dc36531e4cce6d84a81cf9cb667b482d19c45dba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / nil_xit-0.3.24-py3-none-any.whl

Download URL nil_xit-0.3.24-py3-none-any.whl
Size 116.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
46b7d6c8f68e06c69369f69090d6a5159b9b3cc132416aff244abd0d70c9451b
BLAKE2b-256 checksum
How to use checksums
87d429edb4227cbdaa42c04f81afdb6d6df30f3b149d3934dceeb9d5c86d9fe2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Security for nil-xit 0.3.24

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

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