Skip to main content

A fully functional command-line completion module built to directly interface with libedit.

Project description

This is a package which is a replacement for GNU Readline for use as shell-completion support. It is designed to:

  • link to libedit.so on the host system (This covers most *BSD based systems and Linux if you install libedit2 package)
  • if no host libedit.so is available, libedit will be directly compiled into the extension itself

All code is released under the BSD-3 license, which makes this an alternative in cases where GNU-based readline is a problem.

Usage

After a standard, uneventful installation, you should automatically have tab-completion using editline. This is configured in a sitecustomize.py file added to your install or virtual-env.

This extension has more extensive features than readline such as:

  • tab-completion of imports by default
  • tab-completion across arrays (so you can see/pick a valid index)
  • tab-completion across dictionaries (displays available keys)
  • Right-side prompts
  • Arbitrary input/output/error streams so you can have multiple interpreters on a single Python instance which are fully independent. (‘readline’ uses C globals so you are stuck with just one instance)

The system is broken down in 3 components:

_editline.so:the C interface to libedit
editline.py:a Python subclass of _editline which implements much of the string parsing/manipulation
lineeditor.py:a general module which extends rlcompleter’s functionality and provides additional features.

Again, by default this is entirely hidden.

Installation

Handy tips for installation. 99.9% of folks will be able to use the default install (… by SDIST!). It will customize your build based on finding stuff.

In the (odd) case where you have libedit.so and you really want to have editline use the built-in version (say, your distro’s libedit.so is borked) you can adjust the installer.

Run the pip install like this:

pip install --global-option="build" --global-option="--builtin-libedit"  pyeditline

That will bypass the use of your local libedit.so. (… and if anyone has a better way to do this, I’m all ears.)

Gory Details?

Have a look at the README in the source repo or in readthedocs.io .

Project details


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
pyeditline-2.0.0.tar.gz (250.2 kB) Copy SHA256 hash SHA256 Source None May 13, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page