Skip to main content

ball-lang — the Ball language, Python toolchain

Ball is a programming language where every program is a Protocol Buffer message. This distribution bundles the whole Python toolchain: the Ball → Python compiler, the Python → Ball encoder, the self-hosted engine, the zero-dependency runtime, and the ball CLI.

pip install ball-lang

Usage

ball --version                       # the installed toolchain version
ball check    program.ball.json      # validate without running
ball compile  program.ball.json      # Ball -> Python source        [-o out.py]
ball encode   source.py              # Python -> Ball program       [-o out.ball.json]
ball run      program.ball.json      # execute via the self-hosted engine

Programs are read as proto3 JSON (.ball.json / .json), optionally wrapped in a google.protobuf.Any @type envelope.

Exit codes: 0 success · 1 runtime error · 2 invalid program / usage · 3 I/O error.

First ball run compiles the engine

The Ball engine is itself a Ball program. Rather than ship a generated ~690 KB Python module, this wheel carries the engine's Ball source and compiles it with the bundled Ball → Python compiler the first time you run ball run, caching the result. That takes well under a second; every later run reuses the cache.

The cache lives in %LOCALAPPDATA%\ball-lang\engine on Windows and $XDG_CACHE_HOME/ball-lang/engine (default ~/.cache/ball-lang/engine) elsewhere. Set BALL_CACHE_DIR to override it — useful in containers, CI, and read-only-HOME environments. The cache key covers the installed version and a hash of the bundled source, so an upgrade recompiles rather than reusing a stale engine.

Python API

from ball_compiler.compiler import compile as compile_program
from ball_compiler.loader import load_program
from ball_encoder.encoder import encode

src = compile_program(load_program("program.ball.json"))

License

MIT — see the repository.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ball_lang-0.1.0.tar.gz (621.1 kB view details)

Uploaded Source

Built Distribution

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

ball_lang-0.1.0-py3-none-any.whl (631.3 kB view details)

Uploaded Python 3

File details

Details for the file ball_lang-0.1.0.tar.gz.

File metadata

  • Download URL: ball_lang-0.1.0.tar.gz
  • Upload date:
  • Size: 621.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for ball_lang-0.1.0.tar.gz
Algorithm Hash digest
SHA256 11653de4c2b3c3828ae54c366e021851d783bd76bdea2bc1927cb27688f14367
MD5 45743f1f56d599f8fd1df2cdcabff691
BLAKE2b-256 93c228ca436f0caa9fa02bc1cf9e2feb685dad5ad09d54a384ba56a3d96715b7

See more details on using hashes here.

Provenance

The following attestation bundles were made for ball_lang-0.1.0.tar.gz:

Publisher: publish-pypi.yml on Ball-Lang/ball

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ball_lang-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ball_lang-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 631.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for ball_lang-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 446b9471ee003db81f080104062053567090db8a26e22dc2b74371e8a600b9dc
MD5 9e57a7f27ce853307120f4ebaab57606
BLAKE2b-256 ee88096c6c66bc92f1cbb1cda07980614f6534a9543811fb3988e0b68da3d53a

See more details on using hashes here.

Provenance

The following attestation bundles were made for ball_lang-0.1.0-py3-none-any.whl:

Publisher: publish-pypi.yml on Ball-Lang/ball

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

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