Skip to main content

Spork

Tests PyPI version

Spork is a Lisp hosted on CPython. It compiles to Python AST, interoperates directly with Python libraries, and adds macros, expression-oriented syntax, immutable collections, and project tooling.

Highlights

  • Direct access to Python modules and objects—no FFI layer or separate VM.
  • Lisp macros and homoiconic syntax.
  • A compiler-independent runtime and Python standard library from spork-runtime.
  • Persistent vectors, maps, sets, and related types from spork-pds.
  • Pattern matching, destructuring, async/await, protocols, decorators, and Python type annotations.
  • Source-mapped tracebacks that point back to .spork files.
  • A REPL, nREPL server, LSP server, and project commands in one CLI.

Spork supports CPython 3.10 through 3.14, including free-threaded CPython 3.14.

Installation

Install the CLI in an isolated environment with pipx:

pipx install spork-lang

Use pip when adding Spork to an existing Python environment:

python -m pip install spork-lang

On Linux, macOS, or WSL, the installer script is also available:

curl https://raw.githubusercontent.com/spork-it/spork-lang/refs/heads/main/install.sh | sh

Quick start

Start the REPL:

$ spork
Spork REPL - A Lisp for Python
user> (+ 1 2 3)
6
user> (doall (map inc [1 2 3]))
[2 3 4]

Or create hello.spork:

(defn greet [name]
  (fmt "Hello, {}!" name))

(print (greet "Spork"))

Run it with:

$ spork hello.spork
Hello, Spork!

Spork collections are immutable and structurally shared:

(def original {:name "Spork" :version 1})
(def updated (assoc original :version 2))

(print original) ; {:name 'Spork' :version 1}
(print updated)  ; {:name 'Spork' :version 2}

Python interoperability

Import Python modules and call them directly:

(ns example
  (:require [std.json :as json])
  (:import [pathlib :refer [Path]]))

(def path (Path "data.json"))
(print (json.dumps {:path (str path)}))

To import .spork modules from Python, import spork once to install its import hook:

import spork
from my_spork_module import greet

print(greet("Python"))

Spork exposes the separately distributed persistent collections under the spork.pds namespace:

from spork.pds import vec

original = vec(1, 2, 3)
updated = original.conj(4)

The compiler-independent runtime, generated-code helpers, prelude macros, and Python-backed std.* namespaces are distributed by spork-runtime. See the spork-pds documentation for the persistent collection Python API, design, and benchmarks.

Projects

Create and run a project:

spork new my-project
cd my-project
spork sync
spork check
spork run

A spork.it manifest defines metadata, dependencies, source paths, the compatible spork-lang range, and the entry point. spork sync installs a compatible toolchain into .venv; later project commands automatically delegate to that project-local version. Libraries can also declare a unified :api; Spork then generates idiomatic package-level Spork and Python APIs, version metadata, generic .pyi stubs, and py.typed from one annotated implementation namespace.

Common commands include:

Command Purpose
spork repl Start a project-aware REPL
spork add / spork remove Edit dependencies in the nearest spork.it
spork sync Install dependencies and a compatible project toolchain
spork run Run the configured entry point
spork test Discover and run Spork tests
spork check Validate project namespaces, imports, exports, and compilation
spork build Compile sources to Python in .spork-out/
spork dist Build a wheel and source distribution
spork lsp Start the language server

Run spork --help for the complete CLI reference.

Documentation

Development

git clone https://github.com/spork-it/spork-lang.git
cd spork-lang
make venv
make test
.venv/bin/python -m pytest

Use make help for development, packaging, and cleanup targets.

License

MIT

Download files

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

Source Distribution

spork_lang-0.5.3.tar.gz (234.0 kB view details)

Uploaded Source

Built Distribution

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

spork_lang-0.5.3-py3-none-any.whl (173.5 kB view details)

Uploaded Python 3

File details

Details for the file spork_lang-0.5.3.tar.gz.

File metadata

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

File hashes

Hashes for spork_lang-0.5.3.tar.gz
Algorithm Hash digest
SHA256 1482c4655e802bfa8fe0718b1941a35e91b6553eab520b118f6c3e6f6b301eaf
MD5 6d8aeb0ce93a06e1fdcdf39fd9e4c6ee
BLAKE2b-256 75a39cb550e5c9acbec9d9a0877b7ae6507d963e2784faf1fa4687a8d418e442

See more details on using hashes here.

Provenance

The following attestation bundles were made for spork_lang-0.5.3.tar.gz:

Publisher: build.yml on spork-it/spork-lang

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

File details

Details for the file spork_lang-0.5.3-py3-none-any.whl.

File metadata

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

File hashes

Hashes for spork_lang-0.5.3-py3-none-any.whl
Algorithm Hash digest
SHA256 fcf25d9a2c9acff8944329a5b74b6f1e2a0e3e9054aabd825c3de500765de464
MD5 ec495a2d848bab9c58615c087979e829
BLAKE2b-256 195d59c32bd085c755d19649a9251f397ab0ada201f877756fa850cb0409323e

See more details on using hashes here.

Provenance

The following attestation bundles were made for spork_lang-0.5.3-py3-none-any.whl:

Publisher: build.yml on spork-it/spork-lang

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

Release history Release notifications | RSS feed

0.6.0

2 files

This release

0.5.3 This release

2 files

0.5.2

2 files

0.5.1

2 files

0.5.0

2 files

0.4.4

2 files

0.4.3

2 files

0.4.2

2 files

0.4.1

2 files

0.4.0

2 files

0.3.8

2 files

0.3.7

2 files

0.3.6

2 files

0.3.5

2 files

0.3.4

2 files

0.3.3

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

0.2.1

43 files

0.2.0

31 files

0.1.8

25 files

0.1.7

25 files

0.1.6

25 files

0.1.5

25 files

0.1.4

25 files

0.1.3

25 files

0.1.2

25 files

0.1.1

25 files

0.1.0

25 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