Nairobi OS: Heavy Iron Data Science Infrastructure with Lagos Vision (Hardware-Accelerated Zero-Copy Rendering)
Project description
English | 简体中文 | Español | Deutsch
Nairobi Python
Overview
Nairobi Python provides the high-level bridge to the Nairobi OS infrastructure. It enables data scientists to harness the power of Rust-based, hardware-accelerated analytics through a familiar, Pythonic interface. The package handles daemon management, IPC coordination, and memory-mapping, allowing users to focus on data analysis.
Key Features
- SovereignFrame: A fluent, Pandas-like interface for managing remote data handles.
- Lazy Ignition: Automatically starts and configures the refinery daemon upon first data access.
- Jupyter Integration: First-class support for interactive visualizations using the Lagos Vision widget.
- Zero-Copy Bridge: Directly consumes
memfdhandles from the Rust refinery with sub-millisecond overhead.
Installation
From PyPI
pip install nairobi-os
From Source
cd crates/nairobi-python
pip install -e .
Note: Building from source requires the Rust toolchain and maturin to be installed.
Usage
Quick Start
import nairobi_os
# Connect to the refinery (automatically handles D-Bus and daemon startup)
nairobi_os.connect()
# Ingest a CSV file
df = nairobi_os.read_csv("data.csv")
# Fluent API for statistics
mean_val = df.column_name.mean()
p99_val = df.column_name.p99()
# Run SQL queries directly on the engine
tall_players = df.query("SELECT * FROM dataset WHERE height > 80")
# Plot using Lagos Vision
tall_players.plot()
API Reference
nairobi_os.connect()
Initializes the environment, starts the D-Bus session if necessary, and ignites the refinery daemon.
nairobi_os.read_csv(path, delimiter=",", encoding="utf-8")
Ingests a CSV file using the refinery's zero-copy pipeline. Returns a SovereignFrame.
SovereignFrame Methods
df.column.mean(): Compute the arithmetic mean.df.column.std_dev(): Compute the standard deviation.df.column.p95(),df.column.p99(): Compute percentiles.df.column.skewness(),df.column.kurtosis(): Compute statistical moments.df.query(sql_string): Execute Polars-SQL on the dataset.df.correlate("col1,col2"): Compute Pearson and Spearman correlation.df.plot(width, height): Display an interactiveanywidgetvisualization.
Development
Adding New Python Bindings
Nairobi Python uses PyO3 to interface with Rust. New core functions should be added to crates/nairobi-python/src/lib.rs and exposed through the nairobi_os._core.data module.
Testing
Integration tests for the Python package can be run using pytest (if configured) or the provided test script:
python3 test_nairobi.py
To test in isolation without the full refinery, you can mock the _core.data module or use the SovereignFrame with pre-existing handles.
Troubleshooting
- Refinery Failed to Register on D-Bus: This often happens in headless environments. Ensure
dbus-launchis available or callnairobi_os.connect()which attempts to fix the environment. - Handle Not Found: Data handles are session-bound. If the refinery restarts, previous
SovereignFramehandles will become invalid.
License
This project is licensed under the Apache License 2.0.
© 2026 Kevin Chege. All Rights Reserved.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nairobi_os-0.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: nairobi_os-0.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 19.5 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1312758c9b7a6357f7b2b35235c7ab365847caf872a26dd9fbaf6abec308b779
|
|
| MD5 |
d0fd1cbb524e253f445134c53c5b2f90
|
|
| BLAKE2b-256 |
2adcc69a71d166c08b64b7363429c2a72a94ec3f8fadeb61d808fe610c635c9c
|