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.2.tar.gz (73.3 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.2-py3-none-any.whl (32.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lispython-0.4.2.tar.gz
  • Upload date:
  • Size: 73.3 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.2.tar.gz
Algorithm Hash digest
SHA256 1cc9986a41e01a54ec92081a227fa685931e0ba4670f94caf408906f10bb771c
MD5 6b03161508cf066e395e71407e7f3832
BLAKE2b-256 0300447015f9dc4a15e1bfa579deaa44daa9d847cd419e629d1da6d6a085142a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lispython-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 32.1 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1c8c5927eb1f9b92c2c63cb260833e55cb3a1625c8971e2018c0d0cbd89e1814
MD5 8ff0a3e4ce0edb996ea57c5d51247069
BLAKE2b-256 d898d1ad5a7e572c0ef4b19bb74e080ff3e40f9945f234fc9799814830446883

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