~ngraves/nrepl-python

A NREPL server for Python
Update package.
dag: Fix tests after middleware logix fix

You can also use your local clone with git send-email.

#NREPL Python

This is an implementation of the [https://nrepl.org/nrepl/1.3/index.html][NREPL] protocol for the Python programming language.

For now, the built-in operations that are implemented are:

  • add-middleware ⁃ clone ⁃ describe ⁃ eval
  • interrupt
  • ls-middleware ⁃ ls-sessions ⁃ load-file
  • swap-middleware

The following built-in operations are not yet implemented:

  • stdin

The following built-in operations are not planned to be implemented:

  • complete
  • lookup

The rationale is that LSP does completion and lookup correctly for Python, and NREPL in pythonspace is here to provide an super extensible evaluation server, rather than try to replace LSP's mature features. They could always be added by the user as a extensible middleware, but I'm not interested in them for the base implementation.

Regarding the interrupt operation, I have not implement hard KeyboardInterruption-like functionality. What happens is that the threadppol running eval operations is called to stop and a new one is generated. However, it can take some time to actually stop the origin threadpool.

#Differencies with NREPL

This server tries to comply as close as possible to NREPL, but still has a few key differences. Contrary to NREPL :

  • this server implementation makes a use of external packages, in particular bencode.py, gevent and ipython.
  • Middleware are classes (and not higher-level functions) regrouping business logic. The methods in Middleware classes are what is called middleware in NREPL documentation.
  • We use a direct acyclic graph instead of a list when resolving requirements and dependencies of loaded middleware.

#Usage

python-nrepl-server or python -m nrepl_python.server

#Development

guix shell -L channel -m manifest.scm --rebuild-cache -- python -m nrepl_python.server

To test it out, I'm using [https://git.sr.ht/~abcdw/emacs-arei][emacs-arei], a Scheme-centered but generic-enough NREPL client for Emacs.