Skip to main content

LisPython

PyPI version

LisPython is a Lisp-flavored syntax for Python with Lisp-style macros. Source files (.lpy) are transpiled to Python and executed on the standard CPython runtime.

Documentation

Full documentation lives at https://jetack.github.io/lispython/.

Quick Start

(import math)

(def area [r]
  (return (* math.pi (** r 2))))

(print (area 3))
lpy example.lpy

Installation

Using pip

pip install lispython

Manual Installation (for development)

uv sync # install dependencies
uv pip install -e . # for development

How to Run LisPython code

Run from source

lpy {filename}.lpy

Run REPL

lpy
# or
lpy -t # if you want to print python translation.

Show translation

l2py {filename}.lpy

Prints the translated Python to stdout. It does not execute the code.

Run Tests

# in project root directory
pytest
# or
lpy -m pytest

LSP Server

LisPython ships with a language server (lpy-lsp) that speaks LSP over stdio. It provides:

  • Diagnostics (parse / compile errors)
  • Completions (special forms, builtins, file/workspace symbols)
  • Hover documentation for special forms and builtins
  • Signature help for special forms and builtins
  • Document symbols and workspace symbol search
  • Go-to-definition, including across .lpy files in the workspace

nREPL Server

LisPython includes an nREPL server for REPL-driven development:

lpy --nrepl         # start on a random port
lpy --nrepl 7888    # start on a specific port

While running, the server writes its port to .nrepl-port in the working directory for editor auto-discovery.

The server accepts newline-delimited JSON over TCP and supports:

  • eval — evaluate LisPython code, return value/stdout/error
  • load-file — load a .lpy file into the session
  • macroexpand — expand macros and return the result
  • complete — prefix and dot-completion from the live scope, with a kinds map (class/function/variable/macro/keyword)
  • docs — signature and docstring for a symbol
  • annotate — type tag (function/class/module/macro)

Editor setup

VS Code

Install the LisPython extension. It connects to both LSP and nREPL automatically.

Emacs

Use lpy-mode. It provides nREPL integration (eval, completion, eldoc, macroexpand) and LSP via eglot.

Metadata

Release files for lispython 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lispython 0.5.0
File Size Uploaded
lispython-0.5.0.tar.gz 129.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lispython 0.5.0
File Interpreter ABI Platform
lispython-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 187.5 kB

Release files / lispython-0.5.0.tar.gz

Download URL lispython-0.5.0.tar.gz
Size 129.1 kB
Tags Source
SHA-256 checksum
How to use checksums
0e406cf3e9e42d6da3312a0cc73a784173c60146ea483311897e623bba30a2d4
BLAKE2b-256 checksum
How to use checksums
945cc6912ce16e7cbda8a93c1f5c382cd4a5b8c1ffaaa2e939d87c29a0eae60d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.0

Release files / lispython-0.5.0-py3-none-any.whl

Download URL lispython-0.5.0-py3-none-any.whl
Size 58.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
680924fd4feb66b7596376747c89fd6b71beef834af87a1ffaa006c226b30677
BLAKE2b-256 checksum
How to use checksums
ce2e00a76e8bbaf498c122a593147affa2a1d0ae0bc301355469e7422e1a40d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.0

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

0.4.7

2 release files

0.4.6

2 release files

0.4.5

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.1

2 release 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