Python runtime for the East programming language
Project description
East.py
Python runtime for the East programming language.
Overview
East.py is a Python backend that enables East IR to be compiled and executed in Python environments. It provides:
- Complete type system - Full representation of all East types (primitives, containers, structs, variants, functions)
- IR compiler - Compiles East IR nodes to executable Python functions
- 212+ builtin functions - Array, Set, Dict, String, DateTime, Blob, Integer, Float operations
- Serialization - East text format, JSON, and BEAST (Binary East) support
- DateTime formatting - Custom datetime parsing and printing with format strings
- Type analysis - IR validation and type inference
- Platform integration - Embed East functions in Python applications
Current Status
✅ Fully Implemented:
- Type system (all East types)
- IR builders and compiler
- 212 builtin functions (100% coverage)
- Serialization (East text, JSON, BEAST)
- DateTime formatting (parse/print)
- Type comparison and equality
- Container types (Array, Set, Dict)
- Platform integration API
Test Coverage: 980 tests passing, 84% code coverage
Installation
# Install from source
git clone https://github.com/elaraai/east-workspace/tree/main/libs/east-py
cd east-py
pip install -e .
Quick Start
Here's a complete example showing how to load, compile, and execute East IR with platform functions:
import asyncio
import json
from east.runtime.compiler import compile_async
from east.runtime.platform import PlatformFunction
from east.serialization.json import decode_json_for
from east.types.type_system import IntegerType, IRType, NullType, StringType
# Load IR from a file (generated by East TypeScript compiler)
# In this example, the IR represents a function that:
# 1. Logs a message
# 2. Fetches HTTP status from a URL (async)
# 3. Logs the response with timing info
with open("fetch_status.ir.json") as f:
ir_json = json.load(f)
# Decode IR from JSON to East IR nodes
decoder = decode_json_for(IRType)
ir_bytes = json.dumps(ir_json).encode("utf-8")
fetch_status_ir = decoder(ir_bytes)
# Define platform function implementations
def log_impl(message: str) -> None:
"""Sync platform function: log a message."""
print(message)
async def fetch_status_impl(url: str) -> str:
"""Async platform function: fetch HTTP status from URL."""
import urllib.request
loop = asyncio.get_event_loop()
response = await loop.run_in_executor(None, urllib.request.urlopen, url)
return f"{response.status} ({response.msg})"
def time_ns_impl() -> int:
"""Sync platform function: get current time in nanoseconds."""
import time
return time.time_ns()
# Register platform functions with type signatures
platform = [
PlatformFunction(
name="log",
inputs=[StringType],
output=NullType,
type="sync",
fn=log_impl
),
PlatformFunction(
name="fetch_status",
inputs=[StringType],
output=StringType,
type="async",
fn=fetch_status_impl
),
PlatformFunction(
name="time_ns",
inputs=[],
output=IntegerType,
type="sync",
fn=time_ns_impl
),
]
# Compile IR to Python function (handles async automatically)
compiled_fn = compile_async(fetch_status_ir, platform)
# Execute the compiled function
async def main():
await compiled_fn("https://www.google.com")
# Output:
# Fetching URL: https://www.google.com
# Response status: 200 (OK) - fetched in 123.45 ms
if __name__ == "__main__":
asyncio.run(main())
Development
# First-time setup (installs dependencies and pre-commit hooks)
make install
# Development workflow
make test # Run test suite
make lint # Run linter (ruff)
make format # Format code
make typecheck # Type check with mypy
make check # Run all checks (lint + typecheck + test)
# Other useful commands
make repl # Start Python REPL with east loaded
make coverage # Generate HTML coverage report
make lint-fix # Auto-fix linting issues
make clean # Clean build artifacts
# Run specific test suites (using uv)
uv run pytest tests/builtins/test_builtins.py -v
uv run pytest tests/serialization/test_json.py -v
uv run pytest tests/types/test_types.py -v
# Rebuild Cython extensions after modifying .pyx files
make build-cython
Cython Acceleration
Performance-critical modules (BEAST2 deserialization, CSV parsing, struct/variant construction) have optional Cython acceleration. Extensions compile automatically during pip install / uv sync when a C compiler is available. Without one, the package falls back to pure Python with no error.
Requires gcc and python3-dev (Linux) or Xcode CLI tools (macOS).
Architecture
Module Structure
-
east/types/- Type system implementationtype_system.py- Core type definitions and constructorsprimitives.py- Null, Boolean, Integer, Float, String, Blob, DateTimecontainers.py- Array, Set, Dict implementationsstructural.py- Struct, Variant, Function types
-
east/builtins/- Builtin function implementationsarray.py- Array operations (map, filter, reduce, sort, search, etc.)set_ops.py- Set operations (union, intersection, map, reduce, etc.)dict_ops.py- Dict operations (map, filter, merge, etc.)string.py- String operations (split, join, regex, JSON, etc.)datetime_ops.py- DateTime operations (add, diff, compare, etc.)comparison.py- Comparison and equality functions
-
east/serialization/- Serialization formatseast_parser.py- Parse East text formateast_printer.py- Print East text formatjson.py- JSON encoding/decodingbeast.py- Binary East format
-
east/ir/- Intermediate representationbuilders.py- Helper functions for building IR nodesanalyze.py- Type checking and validation
-
east/runtime/- Execution enginecompiler.py- Compile IR to Python functionsplatform.py- Platform integration API
-
east/datetime_format/- DateTime formattingparse.py- Parse datetime strings with formatprint.py- Print datetime with formattokenize.py- Format string tokenization
Claude Code plugin
The East ecosystem also ships a Claude Code plugin — East language skills, example search, and preemptive diagnostics for East code — installed separately from the elaraai marketplace:
# Inside Claude Code
/plugin marketplace add elaraai/east-workspace
/plugin install east@elaraai
# From a terminal
claude plugin marketplace add elaraai/east-workspace
claude plugin install east@elaraai
License
BSL 1.1 (Business Source License):
- Non-production use (evaluation, testing, development) is free
- Production use by or on behalf of for-profit entities requires a commercial license
- Code becomes AGPL-3.0 four years after each release
See LICENSE.md for full details.
Commercial licensing: support@elara.ai
Ecosystem
-
East: Statically typed, expression-based language with serializable IR. Run portable logic across TypeScript, Python, C, and other runtimes.
- @elaraai/east: Core language SDK with type system, expressions, and reference JS compiler
-
East Node: Node.js platform functions for I/O, databases, and system operations.
- @elaraai/east-node-std: Console, FileSystem, Fetch, Crypto, Time, Path, Random
- @elaraai/east-node-io: SQLite, PostgreSQL, MySQL, MongoDB, Redis, S3, FTP, SFTP, XLSX, XML, compression
- @elaraai/east-node-cli: CLI for running East IR programs in Node.js
-
East C: C11 native runtime for executing East IR. Tarballed for
linux-x64andlinux-arm64, attached to each GitHub Release.east-c: Core runtime — type system, IR interpreter, 200+ builtins, serialization (Beast2, JSON, CSV, East text)east-c-std: Console, FileSystem, Fetch, Crypto, Time, Path, Randomeast-c-cli: CLI for running East IR programs natively
-
East Python: Python runtime, standard platform, I/O, and data-science platform functions. Published to PyPI.
- east-py: Core Python runtime — type system, IR compiler, 212+ builtins, Cython-accelerated hot paths
- east-py-std: Console, FileSystem, Fetch, Crypto, Time, Path, Random
- east-py-io: SQLite, PostgreSQL, MySQL, MongoDB, Redis, S3, FTP, SFTP, XLSX, XML, compression
- east-py-cli: CLI for running East IR programs in Python
- east-py-datascience (PyPI) + @elaraai/east-py-datascience (npm): Optimization (MADS, Optuna, ALNS, GoogleOR), ML (XGBoost, LightGBM, NGBoost, PyTorch, Lightning, GP), Bayesian inference (PyMC), explainability (SHAP), conformal prediction (MAPIE)
-
East UI: Typed UI component definitions and React renderer, plus VS Code preview.
- @elaraai/east-ui: 50+ typed UI components for layouts, forms, charts, tables, dialogs
- @elaraai/east-ui-components: React renderer with Chakra UI v3 styling
- @elaraai/e3-ui: e3 + UI bridge — Data bindings,
e3.ui()task, manifest - @elaraai/e3-ui-components: React Query hooks and preview components for the e3 API
- east-ui-preview: VS Code extension for live East UI component preview
-
e3 — East Execution Engine: Durable execution engine for running East pipelines at scale. Git-like content-addressable storage, automatic memoization, reactive dataflow, real-time monitoring.
- @elaraai/e3: SDK for authoring e3 packages with typed tasks and pipelines
- @elaraai/e3-core: Object store, dataflow orchestrator, execution state
- @elaraai/e3-types: Shared type definitions for e3 packages
- @elaraai/e3-cli:
e3 repo,e3 package,e3 workspace,e3 start,e3 watch,e3 logscommands - @elaraai/e3-api-client: HTTP client for remote e3 repositories
- @elaraai/e3-api-server: REST API server for e3 repositories
- @elaraai/e3-api-tests: Shared API compliance test suites
Links
- Website: https://elaraai.com/
- East Repository: https://github.com/elaraai/east-workspace/tree/main/libs/east
- Issues: https://github.com/elaraai/east-workspace/issues
- Email: support@elara.ai
About Elara
East is developed by Elara AI Pty Ltd, an AI-powered platform that creates economic digital twins of businesses that optimize performance. Elara combines business objectives, decisions and data to help organizations make data-driven decisions across operations, purchasing, sales and customer engagement, and project and investment planning. East powers the computational layer of Elara solutions, enabling the expression of complex business logic and data in a simple, type-safe and portable language.
Developed by Elara AI Pty Ltd.
Developed by Elara AI Pty Ltd
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
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 elaraai_east_py-1.0.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: elaraai_east_py-1.0.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.13, manylinux: glibc 2.17+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7168eebca2c9a13e86eb36f1b9500db42ac964d97d5a17d0e2dfd531e68afa60
|
|
| MD5 |
ed3dd8d586721db734883286c64dfb5f
|
|
| BLAKE2b-256 |
e219347077cbd18cde5c68ea3913a644e2e871bd0408a9a51ad99ae09c53f597
|
File details
Details for the file elaraai_east_py-1.0.1-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: elaraai_east_py-1.0.1-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
76807f866cb64df61696f81481c00b7932b4e402388f436e064df9bfca193c9e
|
|
| MD5 |
833cdae0884d7ad8d3fda54267cc92a4
|
|
| BLAKE2b-256 |
5b7c29cd6f987544aefc1cbb12ead5cfd346c95bee9671c7ef3e737c0f764fc8
|
File details
Details for the file elaraai_east_py-1.0.1-cp313-cp313-macosx_10_13_x86_64.whl.
File metadata
- Download URL: elaraai_east_py-1.0.1-cp313-cp313-macosx_10_13_x86_64.whl
- Upload date:
- Size: 2.4 MB
- Tags: CPython 3.13, macOS 10.13+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3de10bfaabb39b97a6f249fad90f21a39b28fdb18fed33ea63dd3c4887b97044
|
|
| MD5 |
77dd5ff36cf5ae438759d602554e79b4
|
|
| BLAKE2b-256 |
c57cdf12c3aa9a5f2d67f66eb0d70b0219525ca250752e0009f1d0f3be38d1c4
|
File details
Details for the file elaraai_east_py-1.0.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: elaraai_east_py-1.0.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0301385fa1dffd032a09f2d57a50aca13afba21872c3a2df995d3871c0b065c7
|
|
| MD5 |
32b160a7d5d867b8225ad25947e9893f
|
|
| BLAKE2b-256 |
d5858f7bd0f66043504c40ea4f049ed5ce87ffdfc04828e8ecdf043c6946a70c
|
File details
Details for the file elaraai_east_py-1.0.1-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: elaraai_east_py-1.0.1-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6de3b3d56c542e9afab2f9943c66da8684fe6961a6f73dddc9c627f36e701480
|
|
| MD5 |
2548094471867e50aafe4e33a6e25cb7
|
|
| BLAKE2b-256 |
399aff19bab044ceda6afe0301736d9311546c475490846a1ddaac4eb972d8a6
|
File details
Details for the file elaraai_east_py-1.0.1-cp312-cp312-macosx_10_13_x86_64.whl.
File metadata
- Download URL: elaraai_east_py-1.0.1-cp312-cp312-macosx_10_13_x86_64.whl
- Upload date:
- Size: 2.4 MB
- Tags: CPython 3.12, macOS 10.13+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c3da533ebbcc533ee8e3d022c496c69a34136f8656fcf02d3312b5ea7d3207a6
|
|
| MD5 |
c9845fdf61c2815f030edc2290b4bcf8
|
|
| BLAKE2b-256 |
ffc03d6c03fc7052cfefadaef34a8ad9a1310bd208121644ddacbc8d8441137d
|
File details
Details for the file elaraai_east_py-1.0.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: elaraai_east_py-1.0.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 2.9 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
170ed67ba2cac5b7d5c6f01ca6ad56c315b78494808c03a09a61fcfbf652c2d2
|
|
| MD5 |
d725b8f933840870f5b2920965aa6a2a
|
|
| BLAKE2b-256 |
cb0bbac640a67a4dd5f3e8e741944a5ed19100e0573708d661a172b49d542874
|
File details
Details for the file elaraai_east_py-1.0.1-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: elaraai_east_py-1.0.1-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
218a7bcb3718462406ec5887f8fac2e21edf0f3bc53e8b3c2a35b66cad8b5dd3
|
|
| MD5 |
386652f2a9b02a6e735194197eaeb424
|
|
| BLAKE2b-256 |
9b87be0621e90c9f3795572d12cf1d91c6f3105c20969b6d5d5cadbe983d08f6
|
File details
Details for the file elaraai_east_py-1.0.1-cp311-cp311-macosx_10_9_x86_64.whl.
File metadata
- Download URL: elaraai_east_py-1.0.1-cp311-cp311-macosx_10_9_x86_64.whl
- Upload date:
- Size: 2.4 MB
- Tags: CPython 3.11, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e5811b415320318fe27341066b9908d3da8025e1f59e3899d61e15f58e643ee6
|
|
| MD5 |
d9d11115d09a29974182d4aaef166b86
|
|
| BLAKE2b-256 |
3611b14952a0b098720abfd8977d5dfb4d8e8aa8ff04db9d57f7b5268c8a5f14
|