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.5.tar.gz (74.9 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.5-py3-none-any.whl (32.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lispython-0.4.5.tar.gz
  • Upload date:
  • Size: 74.9 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.5.tar.gz
Algorithm Hash digest
SHA256 a54d280340a5c7d8773d1b516d36200666db4376228f04dbddaa1d289755ffb0
MD5 2f1ac9162b6e61a299660efec22a0f1a
BLAKE2b-256 7a724c5a07732e0b659c8b13a023fdabd3ab82637a4ea05e2a1981e7761772a9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lispython-0.4.5-py3-none-any.whl
  • Upload date:
  • Size: 32.9 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 e9ff2240a4207ff7458beebdd46af6dc9d7bd5328132189eb8d9aad8d276ee05
MD5 6cb03eb3d82166dc050bb8bf6817ffa0
BLAKE2b-256 aa5fc08aa9a15f7c9c3fd1865b38043436f55778dce8e1a6cc08c0967762f5e9

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