Skip to main content

Lisp-like Syntax for Python with Lisp-like Macros

Project description

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)
  • Hover documentation for special forms
  • Document symbols
  • Go-to-definition, including across .lpy files in the workspace

Editor setup

Point your editor's LSP client at the lpy-lsp command for files with the .lpy extension. The server speaks LSP over stdio.

VSCode

Install the LisPython extension from the VSCode Marketplace.

Emacs

Use lpy-mode for syntax highlighting and LSP integration. For completion, install lpy-autocomplete.

Todo

Environment

  • Test on more python versions
  • REPL should track history and arrow key navigation
  • REPL multi-line input support
  • Better compilation error messages

Python AST

  • type_comment never considered. Later, it should be covered
  • Any missing AST nodes in the version 3.12+

Project details


Download files

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

Source Distribution

lispython-0.4.3.tar.gz (73.5 kB view details)

Uploaded Source

Built Distribution

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

lispython-0.4.3-py3-none-any.whl (32.2 kB view details)

Uploaded Python 3

File details

Details for the file lispython-0.4.3.tar.gz.

File metadata

  • Download URL: lispython-0.4.3.tar.gz
  • Upload date:
  • Size: 73.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for lispython-0.4.3.tar.gz
Algorithm Hash digest
SHA256 cd6839953439475251e6055488ca45018ac87b9bbcd26ab36d4204d3f3d95f2d
MD5 923f2628948958313b7389b953290996
BLAKE2b-256 09d190f82ef6c7daf9c42bce1a6cb5022b355d1e0c571ce0f9c9eed6b8759d31

See more details on using hashes here.

File details

Details for the file lispython-0.4.3-py3-none-any.whl.

File metadata

  • Download URL: lispython-0.4.3-py3-none-any.whl
  • Upload date:
  • Size: 32.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for lispython-0.4.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5e50916e34e881e9cb839e44f82247348fe6d6e75a9b09ea49ffd8826066a6e8
MD5 849d97a062ba34bf3105814831679137
BLAKE2b-256 23c87f0e2321e09a943ee41463cd83ac0f0d863ba0cd5c1b10b23d00fdfd78f9

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