Skip to main content

Pastebin with HMAC that accidentally became a web OS. pip install one ring.

Project description

elastik

pip install elastik — and you get a Rust web OS pretending to be a Python module.

Same trick as NumPy: the .whl ships a precompiled binary inside the package; the Python layer is a thin client. You write Python; a Rust server does the work; you never see Cargo.

import elastik

e = elastik.start(token="x")              # spawn bundled rust core
e.put("/home/note", "hello")
print(e.get("/home/note", raw=True))      # b'hello'
elastik.stop()

Module-level too — point at any running elastik via ELASTIK_URL:

import elastik
elastik.put("/home/note", "hi")
print(elastik.get("/home/note", raw=True))

Reactor (declarative event handlers):

import elastik

@elastik.listen("/home/inbox/*")
def triage(body, world, meta):
    if b"urgent" in body:
        return elastik.Reply(f"/home/alerts/{world.rsplit('/',1)[-1]}", body)
    return elastik.Archive()

elastik.serve(port=3200)

Set elastik-core to fan out to that port:

ELASTIK_LISTENERS="/home/inbox/*=http://localhost:3200/triage" \
    elastik run --port 3105 --token t

Install

pip install elastik

(For now: build from source — see "Build from source" below.)

CLI

elastik info                  # show bundled-binary path + size
elastik run --port 3105       # spawn the bundled core, block

What's bundled

  • Rust binary at elastik/_bin/elastik-core[.exe]
    • HTTP + SQLite + HMAC + auth + harvard gate + listener fanout
    • ~4.3 MB stripped
    • source: Elastik-server/Elastik-core/
  • Python SDK (elastik.sdk.Elastik)
    • atom bindings: put, get, head, delete, list, shaped
    • stdlib only (urllib + json), no requests / httpx
  • Python reactor sugar (elastik.reactor)
    • @listen(pattern) decorator
    • MoveTo, Reply, Archive, Drop action classes
    • two deployment shapes: as elastik-python plugin (finalize()), or as standalone sidecar (serve())

The PyTorch parallel

layer what who writes
L0 — Rust core bedrock atoms (HTTP/SQLite/HMAC) one human, once
L1 — Python SDK elastik.put, elastik.get, … AI, once
L1.5 — plugin runtime (in elastik-server, hot-reload) already exists
L2 — reactor sugar @elastik.listen + Action classes AI, once
L3 — agent programs composition: if/for + L1 + L2 + ai AI, daily

elastik.put() is np.array(). The frontend isn't this call — it's what you compose with these atoms. See [Elastik-core/README.md] for the full architecture.

Build from source

# 1. build the rust core
cd Elastik-core
cargo build --release

# 2. drop the binary into the python package
cp target/release/elastik-core* ../elastik-pip/src/elastik/_bin/

# 3. install the python package
cd ../elastik-pip
pip install -e .

Then:

python -c "import elastik; e = elastik.start(); print(e.put('/home/x', 'hi'))"

Status

Sketch. One platform at a time (this build is for the host you ran cargo build on). Multi-platform wheels via cibuildwheel is the next step.

License

MIT.

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

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

elastik-0.0.1-py3-none-win_amd64.whl (2.3 MB view details)

Uploaded Python 3Windows x86-64

elastik-0.0.1-py3-none-musllinux_1_2_x86_64.whl (2.5 MB view details)

Uploaded Python 3musllinux: musl 1.2+ x86-64

elastik-0.0.1-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (2.5 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

elastik-0.0.1-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl (2.3 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

elastik-0.0.1-py3-none-macosx_11_0_arm64.whl (2.2 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

elastik-0.0.1-py3-none-macosx_10_12_x86_64.whl (2.4 MB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

Details for the file elastik-0.0.1-py3-none-win_amd64.whl.

File metadata

  • Download URL: elastik-0.0.1-py3-none-win_amd64.whl
  • Upload date:
  • Size: 2.3 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.6

File hashes

Hashes for elastik-0.0.1-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 892986d782608d3871dd4d825fde7f98beabbc61258d40324831f8efcb41d48c
MD5 abc99715efcdb6d32bd1740dd0c4ff1d
BLAKE2b-256 7ed6b21bc3c0cd43a63600c2aa2a11869fc75ce6621617f4bd49b5a4e7c4436a

See more details on using hashes here.

File details

Details for the file elastik-0.0.1-py3-none-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for elastik-0.0.1-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 3c79b9a54940724577f707d85c97ca0c10e621be45675af4c38ec8b33b213bc4
MD5 880f6bfae3eb366b2e217f1e71e62d0d
BLAKE2b-256 e261b4befc4f3b58d1a4c05f04bdd58099127fcfb425679ee0e6597cd267de9c

See more details on using hashes here.

File details

Details for the file elastik-0.0.1-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for elastik-0.0.1-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 a4bea47245da1b0ab3e06b7afdc38dbee44e9478d713333a427485c74da5e43f
MD5 3ac37cabe6e1f47d09ebcbe59f428c48
BLAKE2b-256 0068ed27c68e961ae838f9f54b2aba610014247cc36357d3b403cb2d3fc4eeae

See more details on using hashes here.

File details

Details for the file elastik-0.0.1-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl.

File metadata

File hashes

Hashes for elastik-0.0.1-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 9cc0372a9ba82b982538a38b013e636ac09f1e8ea21954f6601a14a68adb2d45
MD5 be4d9cf010b39366b862d160823220c2
BLAKE2b-256 97f74ed1468edd8091e74e42e95a5b3c2afc0411333eb5f32777f71eec566278

See more details on using hashes here.

File details

Details for the file elastik-0.0.1-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for elastik-0.0.1-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 aa6d517639b34a72f56d627986d04ccc75a33f982bbd13b8363e82a1aabb581c
MD5 7f9dc69b611151d67192eff86e0395d0
BLAKE2b-256 a5eaada2f7674603e161bd02227f9ff957a6cf1b6efffb6567cf477df5ff8d80

See more details on using hashes here.

File details

Details for the file elastik-0.0.1-py3-none-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for elastik-0.0.1-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 41dd3af62e32d061ba1b84349b0f580aedf00b2cd1a8cf8abf0cf78c965fbfc3
MD5 9583fa54da79771c15fe8247b66845b0
BLAKE2b-256 a67447233b8f20c4559e7cacf92247a973a1289863029df459f417cc5f3008b5

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