New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

rl

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rl - pypi Package Compare versions

Comparing version
3.0
to
3.1
+64
DEVELOP.rst
==========
Develop rl
==========
Repository
==========
Clone from GitHub::
git clone git@github.com:stefanholek/rl
Development
===========
Create a virtualenv::
cd rl
python3.10 -m venv .venv
source .venv/bin/activate
Build in place::
pip install -e . -v
Run tests::
python -m unittest
Run tests with tox::
tox -e py27 -e py310
Documentation
=============
Build Spinx documentation locally::
tox -e docs [-r]
View documentation::
open docs/_build/html/index.html
Pushing to main triggers readthedocs.io latest build::
git push origin
Debugging
=========
Start with a clean slate::
rm -rf build
rm -rf rl.egg-info
rm rl/*.so
Temporarily remove pyproject.toml for the raw setuptools experience::
rm pyproject.toml
Get it back with::
git restore pyproject.toml
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"

Sorry, the diff of this file is not supported yet

READLINE PATCH REPORT
=====================
Readline-Release: 8.2
Patch-ID: readline82-001
Bug-Reported-by: Kan-Ru Chen <koster@debian.org>
Bug-Reference-ID:
Bug-Reference-URL: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1021109
Bug-Description:
Starting a readline application with an invalid locale specification for
LC_ALL/LANG/LC_CTYPE can cause it crash on the first call to readline.
Patch (apply with `patch -p0'):
*** ../readline-8.2-patched/nls.c 2022-08-15 09:38:51.000000000 -0400
--- nls.c 2022-10-05 09:23:22.000000000 -0400
***************
*** 142,145 ****
--- 142,149 ----
lspec = "";
ret = setlocale (LC_CTYPE, lspec); /* ok, since it does not change locale */
+ if (ret == 0 || *ret == 0)
+ ret = setlocale (LC_CTYPE, (char *)NULL);
+ if (ret == 0 || *ret == 0)
+ ret = RL_DEFAULT_LOCALE;
#else
ret = (lspec == 0 || *lspec == 0) ? RL_DEFAULT_LOCALE : lspec;
*** ../readline-8.2/patchlevel 2013-11-15 08:11:11.000000000 -0500
--- patchlevel 2014-03-21 08:28:40.000000000 -0400
***************
*** 1,3 ****
# Do not edit -- exists only for use by patch
! 0
--- 1,3 ----
# Do not edit -- exists only for use by patch
! 1
diff --git a/complete.c b/complete.c
index e5d224e..138c8d3 100644
--- a/complete.c
+++ b/complete.c
@@ -2551,6 +2551,14 @@ rl_filename_completion_function (const char *text, int state)
xfree (dirname);
dirname = savestring (users_dirname);
}
+ else if (tilde_dirname == 1 && rl_completion_found_quote && rl_filename_dequoting_function)
+ {
+ /* So far we have dequoted users_dirname and tilde expanded dirname.
+ In this branch we must do both. */
+ temp = tilde_expand (users_dirname);
+ xfree (dirname);
+ dirname = temp;
+ }
directory = opendir (dirname);
/* Now dequote a non-null filename. FILENAME will not be NULL, but may
diff --git a/complete.c b/complete.c
index e5d224e..7f0d765 100644
--- a/complete.c
+++ b/complete.c
@@ -2526,7 +2526,9 @@ rl_filename_completion_function (const char *text, int state)
temp = tilde_expand (dirname);
xfree (dirname);
dirname = temp;
- tilde_dirname = 1;
+ /* Set flag if the expansion was successful. */
+ if (*dirname != '~')
+ tilde_dirname = 1;
}
/* We have saved the possibly-dequoted version of the directory name
+38
-0
Changelog
=========
3.1 - 2022-10-31
----------------
- Include GNU Readline 8.2.
[stefan]
- Improve documentation and example code. Promote using ``generator`` as a
decorator.
[stefan]
- Document how ``directory_completion_hook`` interacts with new hooks added
in version 3.0.
[stefan]
- Implement Python 3.6 ``readline.set_auto_history`` and the corresponding
``history.auto``.
[stefan]
- Fall back to ncurses if termcap auto-detection fails. This at least produces
a linker error instead of silently borking the extension.
[stefan]
- Replace deprecated ``python setup.py test`` in tox.ini.
[stefan]
- Remove deprecated ``test_suite`` from setup.py.
[stefan]
- Remove setuptools from ``install_requires``.
[stefan]
- Add a pyproject.toml file.
[stefan]
- Include tests in sdist but not in wheel.
[stefan]
3.0 - 2019-03-20

@@ -5,0 +43,0 @@ ----------------

+2
-1
include LICENSE tox.ini *.rst
include readline-8.0.tar.gz
include readline-8.2.tar.gz *.patch
recursive-include rl *.c *.h *.rst
recursive-include rl/tests *.py
+592
-552

@@ -1,4 +0,4 @@

Metadata-Version: 1.1
Metadata-Version: 2.1
Name: rl
Version: 3.0
Version: 3.1
Summary: Alternative Python bindings for GNU Readline

@@ -9,547 +9,4 @@ Home-page: https://github.com/stefanholek/rl

License: GPLv3
Description: ==
rl
==
--------------------------------------------
Alternative Python bindings for GNU Readline
--------------------------------------------
Overview
============
The `GNU Readline Library`_ is the canonical implementation of command line
editing, tab completion, and history for console-based applications.
It is developed as part of Bash and available on virtually any platform.
While Python ships with readline bindings in its standard library, they
only implement a subset of readline's features, just enough to perform
identifier completion at the Python interpreter prompt.
The **rl** package aims to provide full implementations of GNU Readline's
`Custom Completer`_ and `History`_ interfaces.
It also contains high-level APIs to better organize the namespace and
shield applications from low-level verbosity.
.. _`GNU Readline Library`: https://tiswww.case.edu/php/chet/readline/rltop.html
.. _`Custom Completer`: https://tiswww.case.edu/php/chet/readline/readline.html#SEC45
.. _`History`: https://tiswww.case.edu/php/chet/readline/history.html#SEC6
Package Contents
================
rl exports these components:
completer
Interface to the readline completer. Used to configure the completion
aspects of readline.
completion
Interface to the active readline completion. Used to interact
with readline when a completion is in progress.
history
Interface to the readline history. Used to read and write history files
and to manipulate history entries.
readline
The readline bindings module. Contains everything known from the standard
library plus extensions specific to the rl package. The *completer*,
*completion*, and *history* interfaces make use of this module, and you
should rarely need to interact with it directly.
generator
A factory turning any callable into a *completion entry function* that
can be handed to readline.
print_exc
A decorator printing exceptions to stderr. Useful when writing Python
completions and hooks, as exceptions occurring there are usually
swallowed by the in-between C code.
Documentation
=============
For further details please refer to the `API Documentation`_.
.. _`API Documentation`: https://rl.readthedocs.io/en/stable/
Development
===========
rl development is hosted on GitHub_ where it also has an `issue tracker`_.
.. _GitHub: https://github.com/stefanholek/rl
.. _`issue tracker`: https://github.com/stefanholek/rl/issues
Installation
============
rl requires Python 2.7 or higher. The installer builds GNU Readline 8.0
and a Python extension module.
On Mac OS X make sure you have Xcode Tools installed. Open a Terminal
window and type::
gcc --version
You either see some output (good) or an installer window pops up. Click
the "Install" button to install the command line developer tools.
A more detailed tutorial is available from `RailsApps`_.
On Linux and BSD systems you probably already have a C compiler, but you may
need to verify the development environment is complete.
For example, Ubuntu lacks the Python headers by default and base Fedora is
missing some compiler configuration. Lastly, readline needs a termcap library
to link to.
.. _`RailsApps`: https://railsapps.github.io/xcode-command-line-tools.html
Ubuntu/Debian::
sudo apt install build-essential
sudo apt install python3-dev
sudo apt install libtinfo-dev
Redhat/Fedora::
sudo dnf install gcc
sudo dnf install redhat-rpm-config
sudo dnf install ncurses-devel
Then type::
pip install rl
Related
=======
`kmd.Kmd`_ is an rl-enabled version of `cmd.Cmd`_.
.. _`kmd.Kmd`: https://github.com/stefanholek/kmd
.. _`cmd.Cmd`: https://docs.python.org/3/library/cmd.html
Changelog
=========
3.0 - 2019-03-20
----------------
- rl is now GPLv3 because it statically links to GNU Readline.
[stefan]
- Include GNU Readline 8.0.
[stefan]
- Support Python 3.6 os.PathLike objects for filenames.
[stefan]
- Handle new GIL checks in Python 3.6. See `PYTHONMALLOC`_.
[stefan]
- Add ``history.max_file`` and ``history.append_file``.
[stefan]
- Add ``directory_rewrite_hook``, ``filename_rewrite_hook``, and
``filename_stat_hook``.
[stefan]
- Catch up with bug fixes applied to the standard library readline module.
[stefan]
- Stop using 2to3.
[stefan]
- Remove ``reset`` APIs from the documentation. They override
``~/.inputrc`` and should only be used in tests.
[stefan]
.. _`PYTHONMALLOC`: https://docs.python.org/3/whatsnew/3.6.html
2.4 - 2012-10-05
----------------
- Update to Python 3.3 Unicode C-API.
[stefan]
2.3 - 2012-07-18
----------------
- Implement history iterators in C instead of relying on
intermediate lists.
[stefan]
- Raise a more informative error when history slicing is attempted.
[stefan]
2.2 - 2012-05-10
----------------
- Restore support for gcc < 4.2.
[stefan]
- Switch to a happier looking Sphinx theme.
[stefan]
2.1 - 2012-04-27
----------------
- Force a static build if the RL_BUILD_STATIC_READLINE environment
variable is set.
[stefan]
- Include readline 6.2 patches in static builds.
[stefan]
- Suppress compiler warnings on more platforms.
[stefan]
2.0.1 - 2011-10-06
------------------
- Fix a C compiler issue under Python 3 on Linux.
[stefan]
2.0 - 2011-10-06
----------------
- Drop support for cmd.Cmd. You now must derive your command
interpreters from `kmd.Kmd`_ to use rl features.
[stefan]
- Accept None as argument to file operations under Python 3.
[stefan]
- Switch to pretty Sphinx-based docs.
[stefan]
1.16 - 2011-07-28
-----------------
- Tilde-expand filenames in ``read_history_file`` and ``write_history_file``.
[stefan]
1.15.2 - 2011-07-03
-------------------
- Silence a second C compiler warning in function ``get_y_or_n``.
[stefan]
1.15.1 - 2011-07-03
-------------------
- Silence a C compiler warning in function ``get_y_or_n``.
[stefan]
1.15 - 2011-06-04
-----------------
- Fix memory leaks in ``py_remove_history``, ``py_replace_history``, and
``py_clear_history`` which can occur when history entries are edited.
See Python `issue 12186`_.
[stefan]
- Add a default ``display_matches_hook`` that behaves exactly like readline
behaves in Bash.
[stefan]
- Add ``reset`` functions to completer, completion, and history.
[stefan]
.. _`issue 12186`: https://bugs.python.org/issue12186
1.14 - 2011-05-05
-----------------
- Add xfree.c to sources when building GNU Readline 6.2.
[stefan]
- Allow history indexes of type long.
[stefan]
1.13 - 2011-03-11
-----------------
- Use a custom build_ext command to find the best termcap library.
[stefan]
- Update static builds to GNU Readline 6.2.
[stefan]
1.12 - 2010-08-04
-----------------
- Fix memory leaks in ``py_remove_history`` and ``py_replace_history``.
See Python `issue 9450`_.
[stefan]
.. _`issue 9450`: https://bugs.python.org/issue9450
1.11 - 2010-05-21
-----------------
- Update README, API documentation, and examples.
[stefan]
- MacPython detection caught other framework builds as well.
[stefan]
1.10 - 2010-05-05
-----------------
- Rework the history interface: Implement iteration and remove redundant APIs.
[stefan]
- History stifling could cause duplicate history entries.
[stefan]
- Make sure ``begidx`` and ``endidx`` completion variables are reset to 0.
[stefan]
1.9 - 2010-04-02
----------------
- Remove unused defines; we don't support libedit or readline < 5.0.
[stefan]
- Improve performance of ``get_current_history_length``.
[stefan]
1.8 - 2010-03-14
----------------
- Make ``get_history_item`` zero-based and remove ``get_history_base``.
[stefan]
1.7 - 2010-03-09
----------------
- Support installation into MacPython for Mac OS X.
[stefan]
1.6 - 2010-03-07
----------------
- The history size can now be limited ("stifled") by setting
``history.max_entries``. This supersedes ``history.length`` which has been
removed.
[stefan]
- Close a memory leak in ``get_current_history_length``. Also see Python
`issue 8065`_.
[stefan]
.. _`issue 8065`: https://bugs.python.org/issue8065
1.5.4 - 2010-03-01
------------------
- Avoid segfaults during codec lookup by calling ``PyGILState_Ensure`` in all
the right places. Fixes rl `issue/5`_. Removes the workaround introduced in
1.5.2.
[stefan]
1.5.3 - 2010-02-26
------------------
- Re-release with link to the correct issue.
[stefan]
1.5.2 - 2010-02-26
------------------
- Work around segfaults under Python 3 on Linux, which are caused by bad or
missing codecs. This restricts Linux to UTF-8 and Latin-1 locales only.
Also see rl `issue/5`_.
[stefan]
.. _`issue/5`: https://github.com/stefanholek/rl/issues#issue/5
1.5.1 - 2010-02-25
------------------
- Switch readline download location to ftp.gnu.org for speed.
[stefan]
1.5 - 2010-02-25
----------------
- In Python 3, convert to and from Unicode using filesystem encoding
and "surrogateescape" error handler. See `PEP 383`_ for the low-down.
[stefan]
.. _`PEP 383`: https://www.python.org/dev/peps/pep-0383/
1.4.1 - 2010-02-13
------------------
- Fix GPL trove classifier.
[stefan]
1.4 - 2010-02-13
----------------
- rl can now be installed into the system Python on Mac OS X, the only
dependency being Xcode Tools.
[stefan]
- Change license to PSF or GPL.
[stefan]
1.3 - 2010-01-03
----------------
- Fix header detection under Fink on Mac OS X.
[stefan]
- Add ``readline_version`` API.
[stefan]
1.2 - 2009-11-24
----------------
- Improve API documentation and examples.
[stefan]
1.1 - 2009-11-16
----------------
- Remove all occurrences of old-style function typedefs to silence
compiler warnings.
[stefan]
- Make the ``display_matches_hook`` work in Python 2.5. Fixes rl `issue/1`_.
[stefan]
- No longer auto-refresh the prompt at the end of ``display_match_list``.
Applications should call ``redisplay(force=True)`` to restore the prompt.
[stefan]
.. _`issue/1`: https://github.com/stefanholek/rl/issues#issue/1
1.0 - 2009-11-08
----------------
- No changes since 1.0a8.
1.0a8 - 2009-11-07
------------------
- Close a memory leak in ``word_break_hook``. Three cheers for Xcode's
``leaks`` tool.
[stefan]
1.0a7 - 2009-11-05
------------------
- Rename ``_readline`` module to ``readline`` since it's not private.
[stefan]
- Remove ``dump`` and ``read_key`` APIs from public interfaces.
[stefan]
1.0a6 - 2009-10-30
------------------
- Unclutter the ``completer`` interface by removing settings that can
just as well be made with ``parse_and_bind``.
[stefan]
- Fix a memory leak in ``username_completion_function`` and
``filename_completion_function``.
[stefan]
- Add a custom epydoc stylesheet to make its reST rendering more pleasant.
[stefan]
1.0a5 - 2009-10-29
------------------
- Make all ``completion`` properties writable. While not useful in
production, this allows us to write better tests.
[stefan]
- Improve API documentation and add a call graph for the completion
process. This goes a long way in explaining how readline completion
works.
[stefan]
1.0a4 - 2009-10-27
------------------
- Implement the ``generator`` factory using an iterator instead of a list.
[stefan]
- Remove ``find_completion_word`` so people don't get ideas.
[stefan]
- Don't list distribute as dependency, setuptools will do the
right thing.
[stefan]
1.0a3 - 2009-10-22
------------------
- Add ``__slots__`` to interface objects to make them immutable.
[stefan]
- Support Python 2.5, 2.6, and 3.1 (thanks to distribute).
[stefan]
- Approach something like test coverage.
[stefan]
1.0a2 - 2009-10-08
------------------
- Make the ``generator`` factory work for all types of callables.
[stefan]
- Improve examples.
[stefan]
1.0a1 - 2009-10-04
------------------
- Initial release.
Keywords: gnu readline bindings gnureadline
Project-URL: Documentation, https://rl.readthedocs.io/en/stable/
Keywords: gnu,readline,bindings,gnureadline,completion,tab completion
Platform: UNKNOWN

@@ -562,9 +19,592 @@ Classifier: Development Status :: 5 - Production/Stable

Classifier: Programming Language :: C
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: Implementation :: CPython
Requires-Python: >=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*
Provides-Extra: docs
License-File: LICENSE
==
rl
==
--------------------------------------------
Alternative Python bindings for GNU Readline
--------------------------------------------
Overview
============
The `GNU Readline Library`_ is the canonical implementation of command line
editing, tab completion, and history for console-based applications.
It is developed as part of Bash and available on virtually any platform.
While Python ships with readline bindings in its standard library, they
only implement a subset of readline's features, just enough to perform
identifier completion at the Python interpreter prompt.
The **rl** package aims to provide full implementations of GNU Readline's
`Custom Completer`_ and `History`_ interfaces.
It also contains high-level APIs to better organize the namespace and
shield applications from low-level verbosity.
.. _`GNU Readline Library`: https://tiswww.case.edu/php/chet/readline/rltop.html
.. _`Custom Completer`: https://tiswww.case.edu/php/chet/readline/readline.html#Custom-Completers
.. _`History`: https://tiswww.case.edu/php/chet/readline/history.html#History-Functions
Package Contents
================
rl exports these components:
completer
Interface to the readline completer. Used to configure the completion
aspects of readline.
completion
Interface to the active readline completion. Used to interact
with readline when a completion is in progress.
history
Interface to the readline history. Used to read and write history files
and to manipulate history entries.
readline
The readline bindings module. Contains everything known from the standard
library plus extensions specific to the rl package. The *completer*,
*completion*, and *history* interfaces make use of this module, and you
should rarely need to interact with it directly.
generator
A decorator turning any callable into a *completion entry function* that
can be handed to readline.
print_exc
A decorator printing exceptions to stderr. Useful when writing Python
completions and hooks, as exceptions occurring there are usually
swallowed by the in-between C code.
Documentation
=============
For further details please refer to the `API Documentation`_.
.. _`API Documentation`: https://rl.readthedocs.io/en/stable/
Development
===========
rl development is hosted on GitHub_ where it also has an `issue tracker`_.
.. _GitHub: https://github.com/stefanholek/rl
.. _`issue tracker`: https://github.com/stefanholek/rl/issues
Installation
============
rl requires Python 2.7 or higher. The installer builds GNU Readline 8.2
and a Python extension module.
On Mac OS X make sure you have Xcode Tools installed. Open a Terminal
window and type::
gcc --version
You either see some output (good) or an installer window pops up. Click
the "Install" button to install the command line developer tools.
A more detailed tutorial is available from the `Mac Install Guide`_.
.. _`Mac Install Guide`: https://mac.install.guide/commandlinetools/index.html
On Linux and BSD systems you probably already have a C compiler, but you may
need to verify the development environment is complete.
For example, Ubuntu lacks the Python headers by default and Fedora is
missing some compiler configuration. Lastly, readline needs a termcap library
to link to.
Ubuntu/Debian::
sudo apt install build-essential
sudo apt install python3-dev
sudo apt install libncurses-dev
Redhat/Fedora::
sudo dnf install gcc
sudo dnf install redhat-rpm-config
sudo dnf install ncurses-devel
Then type::
pip install rl
Related
=======
`kmd.Kmd`_ is an rl-enabled version of `cmd.Cmd`_.
.. _`kmd.Kmd`: https://github.com/stefanholek/kmd
.. _`cmd.Cmd`: https://docs.python.org/3/library/cmd.html
Changelog
=========
3.1 - 2022-10-31
----------------
- Include GNU Readline 8.2.
[stefan]
- Improve documentation and example code. Promote using ``generator`` as a
decorator.
[stefan]
- Document how ``directory_completion_hook`` interacts with new hooks added
in version 3.0.
[stefan]
- Implement Python 3.6 ``readline.set_auto_history`` and the corresponding
``history.auto``.
[stefan]
- Fall back to ncurses if termcap auto-detection fails. This at least produces
a linker error instead of silently borking the extension.
[stefan]
- Replace deprecated ``python setup.py test`` in tox.ini.
[stefan]
- Remove deprecated ``test_suite`` from setup.py.
[stefan]
- Remove setuptools from ``install_requires``.
[stefan]
- Add a pyproject.toml file.
[stefan]
- Include tests in sdist but not in wheel.
[stefan]
3.0 - 2019-03-20
----------------
- rl is now GPLv3 because it statically links to GNU Readline.
[stefan]
- Include GNU Readline 8.0.
[stefan]
- Support Python 3.6 os.PathLike objects for filenames.
[stefan]
- Handle new GIL checks in Python 3.6. See `PYTHONMALLOC`_.
[stefan]
- Add ``history.max_file`` and ``history.append_file``.
[stefan]
- Add ``directory_rewrite_hook``, ``filename_rewrite_hook``, and
``filename_stat_hook``.
[stefan]
- Catch up with bug fixes applied to the standard library readline module.
[stefan]
- Stop using 2to3.
[stefan]
- Remove ``reset`` APIs from the documentation. They override
``~/.inputrc`` and should only be used in tests.
[stefan]
.. _`PYTHONMALLOC`: https://docs.python.org/3/whatsnew/3.6.html
2.4 - 2012-10-05
----------------
- Update to Python 3.3 Unicode C-API.
[stefan]
2.3 - 2012-07-18
----------------
- Implement history iterators in C instead of relying on
intermediate lists.
[stefan]
- Raise a more informative error when history slicing is attempted.
[stefan]
2.2 - 2012-05-10
----------------
- Restore support for gcc < 4.2.
[stefan]
- Switch to a happier looking Sphinx theme.
[stefan]
2.1 - 2012-04-27
----------------
- Force a static build if the RL_BUILD_STATIC_READLINE environment
variable is set.
[stefan]
- Include readline 6.2 patches in static builds.
[stefan]
- Suppress compiler warnings on more platforms.
[stefan]
2.0.1 - 2011-10-06
------------------
- Fix a C compiler issue under Python 3 on Linux.
[stefan]
2.0 - 2011-10-06
----------------
- Drop support for cmd.Cmd. You now must derive your command
interpreters from `kmd.Kmd`_ to use rl features.
[stefan]
- Accept None as argument to file operations under Python 3.
[stefan]
- Switch to pretty Sphinx-based docs.
[stefan]
1.16 - 2011-07-28
-----------------
- Tilde-expand filenames in ``read_history_file`` and ``write_history_file``.
[stefan]
1.15.2 - 2011-07-03
-------------------
- Silence a second C compiler warning in function ``get_y_or_n``.
[stefan]
1.15.1 - 2011-07-03
-------------------
- Silence a C compiler warning in function ``get_y_or_n``.
[stefan]
1.15 - 2011-06-04
-----------------
- Fix memory leaks in ``py_remove_history``, ``py_replace_history``, and
``py_clear_history`` which can occur when history entries are edited.
See Python `issue 12186`_.
[stefan]
- Add a default ``display_matches_hook`` that behaves exactly like readline
behaves in Bash.
[stefan]
- Add ``reset`` functions to completer, completion, and history.
[stefan]
.. _`issue 12186`: https://bugs.python.org/issue12186
1.14 - 2011-05-05
-----------------
- Add xfree.c to sources when building GNU Readline 6.2.
[stefan]
- Allow history indexes of type long.
[stefan]
1.13 - 2011-03-11
-----------------
- Use a custom build_ext command to find the best termcap library.
[stefan]
- Update static builds to GNU Readline 6.2.
[stefan]
1.12 - 2010-08-04
-----------------
- Fix memory leaks in ``py_remove_history`` and ``py_replace_history``.
See Python `issue 9450`_.
[stefan]
.. _`issue 9450`: https://bugs.python.org/issue9450
1.11 - 2010-05-21
-----------------
- Update README, API documentation, and examples.
[stefan]
- MacPython detection caught other framework builds as well.
[stefan]
1.10 - 2010-05-05
-----------------
- Rework the history interface: Implement iteration and remove redundant APIs.
[stefan]
- History stifling could cause duplicate history entries.
[stefan]
- Make sure ``begidx`` and ``endidx`` completion variables are reset to 0.
[stefan]
1.9 - 2010-04-02
----------------
- Remove unused defines; we don't support libedit or readline < 5.0.
[stefan]
- Improve performance of ``get_current_history_length``.
[stefan]
1.8 - 2010-03-14
----------------
- Make ``get_history_item`` zero-based and remove ``get_history_base``.
[stefan]
1.7 - 2010-03-09
----------------
- Support installation into MacPython for Mac OS X.
[stefan]
1.6 - 2010-03-07
----------------
- The history size can now be limited ("stifled") by setting
``history.max_entries``. This supersedes ``history.length`` which has been
removed.
[stefan]
- Close a memory leak in ``get_current_history_length``. Also see Python
`issue 8065`_.
[stefan]
.. _`issue 8065`: https://bugs.python.org/issue8065
1.5.4 - 2010-03-01
------------------
- Avoid segfaults during codec lookup by calling ``PyGILState_Ensure`` in all
the right places. Fixes rl `issue/5`_. Removes the workaround introduced in
1.5.2.
[stefan]
1.5.3 - 2010-02-26
------------------
- Re-release with link to the correct issue.
[stefan]
1.5.2 - 2010-02-26
------------------
- Work around segfaults under Python 3 on Linux, which are caused by bad or
missing codecs. This restricts Linux to UTF-8 and Latin-1 locales only.
Also see rl `issue/5`_.
[stefan]
.. _`issue/5`: https://github.com/stefanholek/rl/issues#issue/5
1.5.1 - 2010-02-25
------------------
- Switch readline download location to ftp.gnu.org for speed.
[stefan]
1.5 - 2010-02-25
----------------
- In Python 3, convert to and from Unicode using filesystem encoding
and "surrogateescape" error handler. See `PEP 383`_ for the low-down.
[stefan]
.. _`PEP 383`: https://www.python.org/dev/peps/pep-0383/
1.4.1 - 2010-02-13
------------------
- Fix GPL trove classifier.
[stefan]
1.4 - 2010-02-13
----------------
- rl can now be installed into the system Python on Mac OS X, the only
dependency being Xcode Tools.
[stefan]
- Change license to PSF or GPL.
[stefan]
1.3 - 2010-01-03
----------------
- Fix header detection under Fink on Mac OS X.
[stefan]
- Add ``readline_version`` API.
[stefan]
1.2 - 2009-11-24
----------------
- Improve API documentation and examples.
[stefan]
1.1 - 2009-11-16
----------------
- Remove all occurrences of old-style function typedefs to silence
compiler warnings.
[stefan]
- Make the ``display_matches_hook`` work in Python 2.5. Fixes rl `issue/1`_.
[stefan]
- No longer auto-refresh the prompt at the end of ``display_match_list``.
Applications should call ``redisplay(force=True)`` to restore the prompt.
[stefan]
.. _`issue/1`: https://github.com/stefanholek/rl/issues#issue/1
1.0 - 2009-11-08
----------------
- No changes since 1.0a8.
1.0a8 - 2009-11-07
------------------
- Close a memory leak in ``word_break_hook``. Three cheers for Xcode's
``leaks`` tool.
[stefan]
1.0a7 - 2009-11-05
------------------
- Rename ``_readline`` module to ``readline`` since it's not private.
[stefan]
- Remove ``dump`` and ``read_key`` APIs from public interfaces.
[stefan]
1.0a6 - 2009-10-30
------------------
- Unclutter the ``completer`` interface by removing settings that can
just as well be made with ``parse_and_bind``.
[stefan]
- Fix a memory leak in ``username_completion_function`` and
``filename_completion_function``.
[stefan]
- Add a custom epydoc stylesheet to make its reST rendering more pleasant.
[stefan]
1.0a5 - 2009-10-29
------------------
- Make all ``completion`` properties writable. While not useful in
production, this allows us to write better tests.
[stefan]
- Improve API documentation and add a call graph for the completion
process. This goes a long way in explaining how readline completion
works.
[stefan]
1.0a4 - 2009-10-27
------------------
- Implement the ``generator`` factory using an iterator instead of a list.
[stefan]
- Remove ``find_completion_word`` so people don't get ideas.
[stefan]
- Don't list distribute as dependency, setuptools will do the
right thing.
[stefan]
1.0a3 - 2009-10-22
------------------
- Add ``__slots__`` to interface objects to make them immutable.
[stefan]
- Support Python 2.5, 2.6, and 3.1 (thanks to distribute).
[stefan]
- Approach something like test coverage.
[stefan]
1.0a2 - 2009-10-08
------------------
- Make the ``generator`` factory work for all types of callables.
[stefan]
- Improve examples.
[stefan]
1.0a1 - 2009-10-04
------------------
- Initial release.

@@ -25,4 +25,4 @@ ==

.. _`GNU Readline Library`: https://tiswww.case.edu/php/chet/readline/rltop.html
.. _`Custom Completer`: https://tiswww.case.edu/php/chet/readline/readline.html#SEC45
.. _`History`: https://tiswww.case.edu/php/chet/readline/history.html#SEC6
.. _`Custom Completer`: https://tiswww.case.edu/php/chet/readline/readline.html#Custom-Completers
.. _`History`: https://tiswww.case.edu/php/chet/readline/history.html#History-Functions

@@ -53,3 +53,3 @@ Package Contents

generator
A factory turning any callable into a *completion entry function* that
A decorator turning any callable into a *completion entry function* that
can be handed to readline.

@@ -80,3 +80,3 @@

rl requires Python 2.7 or higher. The installer builds GNU Readline 8.0
rl requires Python 2.7 or higher. The installer builds GNU Readline 8.2
and a Python extension module.

@@ -91,12 +91,12 @@

the "Install" button to install the command line developer tools.
A more detailed tutorial is available from `RailsApps`_.
A more detailed tutorial is available from the `Mac Install Guide`_.
.. _`Mac Install Guide`: https://mac.install.guide/commandlinetools/index.html
On Linux and BSD systems you probably already have a C compiler, but you may
need to verify the development environment is complete.
For example, Ubuntu lacks the Python headers by default and base Fedora is
For example, Ubuntu lacks the Python headers by default and Fedora is
missing some compiler configuration. Lastly, readline needs a termcap library
to link to.
.. _`RailsApps`: https://railsapps.github.io/xcode-command-line-tools.html
Ubuntu/Debian::

@@ -106,3 +106,3 @@

sudo apt install python3-dev
sudo apt install libtinfo-dev
sudo apt install libncurses-dev

@@ -109,0 +109,0 @@ Redhat/Fedora::

@@ -1,4 +0,4 @@

Metadata-Version: 1.1
Metadata-Version: 2.1
Name: rl
Version: 3.0
Version: 3.1
Summary: Alternative Python bindings for GNU Readline

@@ -9,547 +9,4 @@ Home-page: https://github.com/stefanholek/rl

License: GPLv3
Description: ==
rl
==
--------------------------------------------
Alternative Python bindings for GNU Readline
--------------------------------------------
Overview
============
The `GNU Readline Library`_ is the canonical implementation of command line
editing, tab completion, and history for console-based applications.
It is developed as part of Bash and available on virtually any platform.
While Python ships with readline bindings in its standard library, they
only implement a subset of readline's features, just enough to perform
identifier completion at the Python interpreter prompt.
The **rl** package aims to provide full implementations of GNU Readline's
`Custom Completer`_ and `History`_ interfaces.
It also contains high-level APIs to better organize the namespace and
shield applications from low-level verbosity.
.. _`GNU Readline Library`: https://tiswww.case.edu/php/chet/readline/rltop.html
.. _`Custom Completer`: https://tiswww.case.edu/php/chet/readline/readline.html#SEC45
.. _`History`: https://tiswww.case.edu/php/chet/readline/history.html#SEC6
Package Contents
================
rl exports these components:
completer
Interface to the readline completer. Used to configure the completion
aspects of readline.
completion
Interface to the active readline completion. Used to interact
with readline when a completion is in progress.
history
Interface to the readline history. Used to read and write history files
and to manipulate history entries.
readline
The readline bindings module. Contains everything known from the standard
library plus extensions specific to the rl package. The *completer*,
*completion*, and *history* interfaces make use of this module, and you
should rarely need to interact with it directly.
generator
A factory turning any callable into a *completion entry function* that
can be handed to readline.
print_exc
A decorator printing exceptions to stderr. Useful when writing Python
completions and hooks, as exceptions occurring there are usually
swallowed by the in-between C code.
Documentation
=============
For further details please refer to the `API Documentation`_.
.. _`API Documentation`: https://rl.readthedocs.io/en/stable/
Development
===========
rl development is hosted on GitHub_ where it also has an `issue tracker`_.
.. _GitHub: https://github.com/stefanholek/rl
.. _`issue tracker`: https://github.com/stefanholek/rl/issues
Installation
============
rl requires Python 2.7 or higher. The installer builds GNU Readline 8.0
and a Python extension module.
On Mac OS X make sure you have Xcode Tools installed. Open a Terminal
window and type::
gcc --version
You either see some output (good) or an installer window pops up. Click
the "Install" button to install the command line developer tools.
A more detailed tutorial is available from `RailsApps`_.
On Linux and BSD systems you probably already have a C compiler, but you may
need to verify the development environment is complete.
For example, Ubuntu lacks the Python headers by default and base Fedora is
missing some compiler configuration. Lastly, readline needs a termcap library
to link to.
.. _`RailsApps`: https://railsapps.github.io/xcode-command-line-tools.html
Ubuntu/Debian::
sudo apt install build-essential
sudo apt install python3-dev
sudo apt install libtinfo-dev
Redhat/Fedora::
sudo dnf install gcc
sudo dnf install redhat-rpm-config
sudo dnf install ncurses-devel
Then type::
pip install rl
Related
=======
`kmd.Kmd`_ is an rl-enabled version of `cmd.Cmd`_.
.. _`kmd.Kmd`: https://github.com/stefanholek/kmd
.. _`cmd.Cmd`: https://docs.python.org/3/library/cmd.html
Changelog
=========
3.0 - 2019-03-20
----------------
- rl is now GPLv3 because it statically links to GNU Readline.
[stefan]
- Include GNU Readline 8.0.
[stefan]
- Support Python 3.6 os.PathLike objects for filenames.
[stefan]
- Handle new GIL checks in Python 3.6. See `PYTHONMALLOC`_.
[stefan]
- Add ``history.max_file`` and ``history.append_file``.
[stefan]
- Add ``directory_rewrite_hook``, ``filename_rewrite_hook``, and
``filename_stat_hook``.
[stefan]
- Catch up with bug fixes applied to the standard library readline module.
[stefan]
- Stop using 2to3.
[stefan]
- Remove ``reset`` APIs from the documentation. They override
``~/.inputrc`` and should only be used in tests.
[stefan]
.. _`PYTHONMALLOC`: https://docs.python.org/3/whatsnew/3.6.html
2.4 - 2012-10-05
----------------
- Update to Python 3.3 Unicode C-API.
[stefan]
2.3 - 2012-07-18
----------------
- Implement history iterators in C instead of relying on
intermediate lists.
[stefan]
- Raise a more informative error when history slicing is attempted.
[stefan]
2.2 - 2012-05-10
----------------
- Restore support for gcc < 4.2.
[stefan]
- Switch to a happier looking Sphinx theme.
[stefan]
2.1 - 2012-04-27
----------------
- Force a static build if the RL_BUILD_STATIC_READLINE environment
variable is set.
[stefan]
- Include readline 6.2 patches in static builds.
[stefan]
- Suppress compiler warnings on more platforms.
[stefan]
2.0.1 - 2011-10-06
------------------
- Fix a C compiler issue under Python 3 on Linux.
[stefan]
2.0 - 2011-10-06
----------------
- Drop support for cmd.Cmd. You now must derive your command
interpreters from `kmd.Kmd`_ to use rl features.
[stefan]
- Accept None as argument to file operations under Python 3.
[stefan]
- Switch to pretty Sphinx-based docs.
[stefan]
1.16 - 2011-07-28
-----------------
- Tilde-expand filenames in ``read_history_file`` and ``write_history_file``.
[stefan]
1.15.2 - 2011-07-03
-------------------
- Silence a second C compiler warning in function ``get_y_or_n``.
[stefan]
1.15.1 - 2011-07-03
-------------------
- Silence a C compiler warning in function ``get_y_or_n``.
[stefan]
1.15 - 2011-06-04
-----------------
- Fix memory leaks in ``py_remove_history``, ``py_replace_history``, and
``py_clear_history`` which can occur when history entries are edited.
See Python `issue 12186`_.
[stefan]
- Add a default ``display_matches_hook`` that behaves exactly like readline
behaves in Bash.
[stefan]
- Add ``reset`` functions to completer, completion, and history.
[stefan]
.. _`issue 12186`: https://bugs.python.org/issue12186
1.14 - 2011-05-05
-----------------
- Add xfree.c to sources when building GNU Readline 6.2.
[stefan]
- Allow history indexes of type long.
[stefan]
1.13 - 2011-03-11
-----------------
- Use a custom build_ext command to find the best termcap library.
[stefan]
- Update static builds to GNU Readline 6.2.
[stefan]
1.12 - 2010-08-04
-----------------
- Fix memory leaks in ``py_remove_history`` and ``py_replace_history``.
See Python `issue 9450`_.
[stefan]
.. _`issue 9450`: https://bugs.python.org/issue9450
1.11 - 2010-05-21
-----------------
- Update README, API documentation, and examples.
[stefan]
- MacPython detection caught other framework builds as well.
[stefan]
1.10 - 2010-05-05
-----------------
- Rework the history interface: Implement iteration and remove redundant APIs.
[stefan]
- History stifling could cause duplicate history entries.
[stefan]
- Make sure ``begidx`` and ``endidx`` completion variables are reset to 0.
[stefan]
1.9 - 2010-04-02
----------------
- Remove unused defines; we don't support libedit or readline < 5.0.
[stefan]
- Improve performance of ``get_current_history_length``.
[stefan]
1.8 - 2010-03-14
----------------
- Make ``get_history_item`` zero-based and remove ``get_history_base``.
[stefan]
1.7 - 2010-03-09
----------------
- Support installation into MacPython for Mac OS X.
[stefan]
1.6 - 2010-03-07
----------------
- The history size can now be limited ("stifled") by setting
``history.max_entries``. This supersedes ``history.length`` which has been
removed.
[stefan]
- Close a memory leak in ``get_current_history_length``. Also see Python
`issue 8065`_.
[stefan]
.. _`issue 8065`: https://bugs.python.org/issue8065
1.5.4 - 2010-03-01
------------------
- Avoid segfaults during codec lookup by calling ``PyGILState_Ensure`` in all
the right places. Fixes rl `issue/5`_. Removes the workaround introduced in
1.5.2.
[stefan]
1.5.3 - 2010-02-26
------------------
- Re-release with link to the correct issue.
[stefan]
1.5.2 - 2010-02-26
------------------
- Work around segfaults under Python 3 on Linux, which are caused by bad or
missing codecs. This restricts Linux to UTF-8 and Latin-1 locales only.
Also see rl `issue/5`_.
[stefan]
.. _`issue/5`: https://github.com/stefanholek/rl/issues#issue/5
1.5.1 - 2010-02-25
------------------
- Switch readline download location to ftp.gnu.org for speed.
[stefan]
1.5 - 2010-02-25
----------------
- In Python 3, convert to and from Unicode using filesystem encoding
and "surrogateescape" error handler. See `PEP 383`_ for the low-down.
[stefan]
.. _`PEP 383`: https://www.python.org/dev/peps/pep-0383/
1.4.1 - 2010-02-13
------------------
- Fix GPL trove classifier.
[stefan]
1.4 - 2010-02-13
----------------
- rl can now be installed into the system Python on Mac OS X, the only
dependency being Xcode Tools.
[stefan]
- Change license to PSF or GPL.
[stefan]
1.3 - 2010-01-03
----------------
- Fix header detection under Fink on Mac OS X.
[stefan]
- Add ``readline_version`` API.
[stefan]
1.2 - 2009-11-24
----------------
- Improve API documentation and examples.
[stefan]
1.1 - 2009-11-16
----------------
- Remove all occurrences of old-style function typedefs to silence
compiler warnings.
[stefan]
- Make the ``display_matches_hook`` work in Python 2.5. Fixes rl `issue/1`_.
[stefan]
- No longer auto-refresh the prompt at the end of ``display_match_list``.
Applications should call ``redisplay(force=True)`` to restore the prompt.
[stefan]
.. _`issue/1`: https://github.com/stefanholek/rl/issues#issue/1
1.0 - 2009-11-08
----------------
- No changes since 1.0a8.
1.0a8 - 2009-11-07
------------------
- Close a memory leak in ``word_break_hook``. Three cheers for Xcode's
``leaks`` tool.
[stefan]
1.0a7 - 2009-11-05
------------------
- Rename ``_readline`` module to ``readline`` since it's not private.
[stefan]
- Remove ``dump`` and ``read_key`` APIs from public interfaces.
[stefan]
1.0a6 - 2009-10-30
------------------
- Unclutter the ``completer`` interface by removing settings that can
just as well be made with ``parse_and_bind``.
[stefan]
- Fix a memory leak in ``username_completion_function`` and
``filename_completion_function``.
[stefan]
- Add a custom epydoc stylesheet to make its reST rendering more pleasant.
[stefan]
1.0a5 - 2009-10-29
------------------
- Make all ``completion`` properties writable. While not useful in
production, this allows us to write better tests.
[stefan]
- Improve API documentation and add a call graph for the completion
process. This goes a long way in explaining how readline completion
works.
[stefan]
1.0a4 - 2009-10-27
------------------
- Implement the ``generator`` factory using an iterator instead of a list.
[stefan]
- Remove ``find_completion_word`` so people don't get ideas.
[stefan]
- Don't list distribute as dependency, setuptools will do the
right thing.
[stefan]
1.0a3 - 2009-10-22
------------------
- Add ``__slots__`` to interface objects to make them immutable.
[stefan]
- Support Python 2.5, 2.6, and 3.1 (thanks to distribute).
[stefan]
- Approach something like test coverage.
[stefan]
1.0a2 - 2009-10-08
------------------
- Make the ``generator`` factory work for all types of callables.
[stefan]
- Improve examples.
[stefan]
1.0a1 - 2009-10-04
------------------
- Initial release.
Keywords: gnu readline bindings gnureadline
Project-URL: Documentation, https://rl.readthedocs.io/en/stable/
Keywords: gnu,readline,bindings,gnureadline,completion,tab completion
Platform: UNKNOWN

@@ -562,9 +19,592 @@ Classifier: Development Status :: 5 - Production/Stable

Classifier: Programming Language :: C
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: Implementation :: CPython
Requires-Python: >=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*
Provides-Extra: docs
License-File: LICENSE
==
rl
==
--------------------------------------------
Alternative Python bindings for GNU Readline
--------------------------------------------
Overview
============
The `GNU Readline Library`_ is the canonical implementation of command line
editing, tab completion, and history for console-based applications.
It is developed as part of Bash and available on virtually any platform.
While Python ships with readline bindings in its standard library, they
only implement a subset of readline's features, just enough to perform
identifier completion at the Python interpreter prompt.
The **rl** package aims to provide full implementations of GNU Readline's
`Custom Completer`_ and `History`_ interfaces.
It also contains high-level APIs to better organize the namespace and
shield applications from low-level verbosity.
.. _`GNU Readline Library`: https://tiswww.case.edu/php/chet/readline/rltop.html
.. _`Custom Completer`: https://tiswww.case.edu/php/chet/readline/readline.html#Custom-Completers
.. _`History`: https://tiswww.case.edu/php/chet/readline/history.html#History-Functions
Package Contents
================
rl exports these components:
completer
Interface to the readline completer. Used to configure the completion
aspects of readline.
completion
Interface to the active readline completion. Used to interact
with readline when a completion is in progress.
history
Interface to the readline history. Used to read and write history files
and to manipulate history entries.
readline
The readline bindings module. Contains everything known from the standard
library plus extensions specific to the rl package. The *completer*,
*completion*, and *history* interfaces make use of this module, and you
should rarely need to interact with it directly.
generator
A decorator turning any callable into a *completion entry function* that
can be handed to readline.
print_exc
A decorator printing exceptions to stderr. Useful when writing Python
completions and hooks, as exceptions occurring there are usually
swallowed by the in-between C code.
Documentation
=============
For further details please refer to the `API Documentation`_.
.. _`API Documentation`: https://rl.readthedocs.io/en/stable/
Development
===========
rl development is hosted on GitHub_ where it also has an `issue tracker`_.
.. _GitHub: https://github.com/stefanholek/rl
.. _`issue tracker`: https://github.com/stefanholek/rl/issues
Installation
============
rl requires Python 2.7 or higher. The installer builds GNU Readline 8.2
and a Python extension module.
On Mac OS X make sure you have Xcode Tools installed. Open a Terminal
window and type::
gcc --version
You either see some output (good) or an installer window pops up. Click
the "Install" button to install the command line developer tools.
A more detailed tutorial is available from the `Mac Install Guide`_.
.. _`Mac Install Guide`: https://mac.install.guide/commandlinetools/index.html
On Linux and BSD systems you probably already have a C compiler, but you may
need to verify the development environment is complete.
For example, Ubuntu lacks the Python headers by default and Fedora is
missing some compiler configuration. Lastly, readline needs a termcap library
to link to.
Ubuntu/Debian::
sudo apt install build-essential
sudo apt install python3-dev
sudo apt install libncurses-dev
Redhat/Fedora::
sudo dnf install gcc
sudo dnf install redhat-rpm-config
sudo dnf install ncurses-devel
Then type::
pip install rl
Related
=======
`kmd.Kmd`_ is an rl-enabled version of `cmd.Cmd`_.
.. _`kmd.Kmd`: https://github.com/stefanholek/kmd
.. _`cmd.Cmd`: https://docs.python.org/3/library/cmd.html
Changelog
=========
3.1 - 2022-10-31
----------------
- Include GNU Readline 8.2.
[stefan]
- Improve documentation and example code. Promote using ``generator`` as a
decorator.
[stefan]
- Document how ``directory_completion_hook`` interacts with new hooks added
in version 3.0.
[stefan]
- Implement Python 3.6 ``readline.set_auto_history`` and the corresponding
``history.auto``.
[stefan]
- Fall back to ncurses if termcap auto-detection fails. This at least produces
a linker error instead of silently borking the extension.
[stefan]
- Replace deprecated ``python setup.py test`` in tox.ini.
[stefan]
- Remove deprecated ``test_suite`` from setup.py.
[stefan]
- Remove setuptools from ``install_requires``.
[stefan]
- Add a pyproject.toml file.
[stefan]
- Include tests in sdist but not in wheel.
[stefan]
3.0 - 2019-03-20
----------------
- rl is now GPLv3 because it statically links to GNU Readline.
[stefan]
- Include GNU Readline 8.0.
[stefan]
- Support Python 3.6 os.PathLike objects for filenames.
[stefan]
- Handle new GIL checks in Python 3.6. See `PYTHONMALLOC`_.
[stefan]
- Add ``history.max_file`` and ``history.append_file``.
[stefan]
- Add ``directory_rewrite_hook``, ``filename_rewrite_hook``, and
``filename_stat_hook``.
[stefan]
- Catch up with bug fixes applied to the standard library readline module.
[stefan]
- Stop using 2to3.
[stefan]
- Remove ``reset`` APIs from the documentation. They override
``~/.inputrc`` and should only be used in tests.
[stefan]
.. _`PYTHONMALLOC`: https://docs.python.org/3/whatsnew/3.6.html
2.4 - 2012-10-05
----------------
- Update to Python 3.3 Unicode C-API.
[stefan]
2.3 - 2012-07-18
----------------
- Implement history iterators in C instead of relying on
intermediate lists.
[stefan]
- Raise a more informative error when history slicing is attempted.
[stefan]
2.2 - 2012-05-10
----------------
- Restore support for gcc < 4.2.
[stefan]
- Switch to a happier looking Sphinx theme.
[stefan]
2.1 - 2012-04-27
----------------
- Force a static build if the RL_BUILD_STATIC_READLINE environment
variable is set.
[stefan]
- Include readline 6.2 patches in static builds.
[stefan]
- Suppress compiler warnings on more platforms.
[stefan]
2.0.1 - 2011-10-06
------------------
- Fix a C compiler issue under Python 3 on Linux.
[stefan]
2.0 - 2011-10-06
----------------
- Drop support for cmd.Cmd. You now must derive your command
interpreters from `kmd.Kmd`_ to use rl features.
[stefan]
- Accept None as argument to file operations under Python 3.
[stefan]
- Switch to pretty Sphinx-based docs.
[stefan]
1.16 - 2011-07-28
-----------------
- Tilde-expand filenames in ``read_history_file`` and ``write_history_file``.
[stefan]
1.15.2 - 2011-07-03
-------------------
- Silence a second C compiler warning in function ``get_y_or_n``.
[stefan]
1.15.1 - 2011-07-03
-------------------
- Silence a C compiler warning in function ``get_y_or_n``.
[stefan]
1.15 - 2011-06-04
-----------------
- Fix memory leaks in ``py_remove_history``, ``py_replace_history``, and
``py_clear_history`` which can occur when history entries are edited.
See Python `issue 12186`_.
[stefan]
- Add a default ``display_matches_hook`` that behaves exactly like readline
behaves in Bash.
[stefan]
- Add ``reset`` functions to completer, completion, and history.
[stefan]
.. _`issue 12186`: https://bugs.python.org/issue12186
1.14 - 2011-05-05
-----------------
- Add xfree.c to sources when building GNU Readline 6.2.
[stefan]
- Allow history indexes of type long.
[stefan]
1.13 - 2011-03-11
-----------------
- Use a custom build_ext command to find the best termcap library.
[stefan]
- Update static builds to GNU Readline 6.2.
[stefan]
1.12 - 2010-08-04
-----------------
- Fix memory leaks in ``py_remove_history`` and ``py_replace_history``.
See Python `issue 9450`_.
[stefan]
.. _`issue 9450`: https://bugs.python.org/issue9450
1.11 - 2010-05-21
-----------------
- Update README, API documentation, and examples.
[stefan]
- MacPython detection caught other framework builds as well.
[stefan]
1.10 - 2010-05-05
-----------------
- Rework the history interface: Implement iteration and remove redundant APIs.
[stefan]
- History stifling could cause duplicate history entries.
[stefan]
- Make sure ``begidx`` and ``endidx`` completion variables are reset to 0.
[stefan]
1.9 - 2010-04-02
----------------
- Remove unused defines; we don't support libedit or readline < 5.0.
[stefan]
- Improve performance of ``get_current_history_length``.
[stefan]
1.8 - 2010-03-14
----------------
- Make ``get_history_item`` zero-based and remove ``get_history_base``.
[stefan]
1.7 - 2010-03-09
----------------
- Support installation into MacPython for Mac OS X.
[stefan]
1.6 - 2010-03-07
----------------
- The history size can now be limited ("stifled") by setting
``history.max_entries``. This supersedes ``history.length`` which has been
removed.
[stefan]
- Close a memory leak in ``get_current_history_length``. Also see Python
`issue 8065`_.
[stefan]
.. _`issue 8065`: https://bugs.python.org/issue8065
1.5.4 - 2010-03-01
------------------
- Avoid segfaults during codec lookup by calling ``PyGILState_Ensure`` in all
the right places. Fixes rl `issue/5`_. Removes the workaround introduced in
1.5.2.
[stefan]
1.5.3 - 2010-02-26
------------------
- Re-release with link to the correct issue.
[stefan]
1.5.2 - 2010-02-26
------------------
- Work around segfaults under Python 3 on Linux, which are caused by bad or
missing codecs. This restricts Linux to UTF-8 and Latin-1 locales only.
Also see rl `issue/5`_.
[stefan]
.. _`issue/5`: https://github.com/stefanholek/rl/issues#issue/5
1.5.1 - 2010-02-25
------------------
- Switch readline download location to ftp.gnu.org for speed.
[stefan]
1.5 - 2010-02-25
----------------
- In Python 3, convert to and from Unicode using filesystem encoding
and "surrogateescape" error handler. See `PEP 383`_ for the low-down.
[stefan]
.. _`PEP 383`: https://www.python.org/dev/peps/pep-0383/
1.4.1 - 2010-02-13
------------------
- Fix GPL trove classifier.
[stefan]
1.4 - 2010-02-13
----------------
- rl can now be installed into the system Python on Mac OS X, the only
dependency being Xcode Tools.
[stefan]
- Change license to PSF or GPL.
[stefan]
1.3 - 2010-01-03
----------------
- Fix header detection under Fink on Mac OS X.
[stefan]
- Add ``readline_version`` API.
[stefan]
1.2 - 2009-11-24
----------------
- Improve API documentation and examples.
[stefan]
1.1 - 2009-11-16
----------------
- Remove all occurrences of old-style function typedefs to silence
compiler warnings.
[stefan]
- Make the ``display_matches_hook`` work in Python 2.5. Fixes rl `issue/1`_.
[stefan]
- No longer auto-refresh the prompt at the end of ``display_match_list``.
Applications should call ``redisplay(force=True)`` to restore the prompt.
[stefan]
.. _`issue/1`: https://github.com/stefanholek/rl/issues#issue/1
1.0 - 2009-11-08
----------------
- No changes since 1.0a8.
1.0a8 - 2009-11-07
------------------
- Close a memory leak in ``word_break_hook``. Three cheers for Xcode's
``leaks`` tool.
[stefan]
1.0a7 - 2009-11-05
------------------
- Rename ``_readline`` module to ``readline`` since it's not private.
[stefan]
- Remove ``dump`` and ``read_key`` APIs from public interfaces.
[stefan]
1.0a6 - 2009-10-30
------------------
- Unclutter the ``completer`` interface by removing settings that can
just as well be made with ``parse_and_bind``.
[stefan]
- Fix a memory leak in ``username_completion_function`` and
``filename_completion_function``.
[stefan]
- Add a custom epydoc stylesheet to make its reST rendering more pleasant.
[stefan]
1.0a5 - 2009-10-29
------------------
- Make all ``completion`` properties writable. While not useful in
production, this allows us to write better tests.
[stefan]
- Improve API documentation and add a call graph for the completion
process. This goes a long way in explaining how readline completion
works.
[stefan]
1.0a4 - 2009-10-27
------------------
- Implement the ``generator`` factory using an iterator instead of a list.
[stefan]
- Remove ``find_completion_word`` so people don't get ideas.
[stefan]
- Don't list distribute as dependency, setuptools will do the
right thing.
[stefan]
1.0a3 - 2009-10-22
------------------
- Add ``__slots__`` to interface objects to make them immutable.
[stefan]
- Support Python 2.5, 2.6, and 3.1 (thanks to distribute).
[stefan]
- Approach something like test coverage.
[stefan]
1.0a2 - 2009-10-08
------------------
- Make the ``generator`` factory work for all types of callables.
[stefan]
- Improve examples.
[stefan]
1.0a1 - 2009-10-04
------------------
- Initial release.

@@ -1,1 +0,4 @@

setuptools
[docs]
sphinx==5.3.0
sphinx-rtd-theme==1.0.0
CHANGES.rst
DEVELOP.rst
LICENSE
MANIFEST.in
README.rst
readline-8.0.tar.gz
pyproject.toml
readline-8.2.tar.gz
readline82-001.patch
readline82-00X.patch
readline82-00Y.patch
setup.cfg
setup.py
tox.ini
docs/Makefile
docs/completion.rst
docs/conf.py
docs/examples.rst
docs/history.rst
docs/index.rst
docs/overview.rst
docs/readline.rst
docs/_build/.placeholder
docs/_static/.placeholder
docs/_static/theme-plus.css
docs/_templates/.placeholder
rl/__init__.py

@@ -22,0 +15,0 @@ rl/_completion.py

@@ -1,109 +0,6 @@

"""Alternative Python bindings for GNU Readline.
"""Alternative Python bindings for GNU Readline."""
Package Contents
================
__all__ = ['completer', 'completion', 'history', 'readline',
'generator', 'print_exc']
rl exports the following components:
:obj:`rl.completer <rl.Completer>`
Interface to the readline completer. Used to configure the completion
aspects of readline.
:obj:`rl.completion <rl.Completion>`
Interface to the active readline completion. Used to interact
with readline when a completion is in progress.
:obj:`rl.history <rl.History>`
Interface to the readline history. Used to read and write history files
and to manipulate history entries.
:mod:`rl.readline`
The readline bindings module. Contains everything known from the standard
library plus extensions specific to the rl package. The :obj:`completer <rl.Completer>`,
:obj:`completion <rl.Completion>`, and :obj:`history <rl.History>`
interfaces make use of this module, and you should rarely need to interact
with it directly.
:func:`rl.generator`
A factory turning any callable into a *completion entry function* that
can be handed to readline.
:func:`rl.print_exc`
A decorator printing exceptions to stderr. Useful when writing Python
completions and hooks, as exceptions occurring there are usually
swallowed by the in-between C code.
Readline Completion
===================
Completion is the process initiated when the user presses the TAB key.
It has three phases: Word breaking, match generation, and
match insertion/display.
For each phase, readline provides configuration settings and hooks that
allow applications to control the way the library behaves. See the
:class:`completer <rl.Completer>` and :class:`completion <rl.Completion>`
objects for detailed descriptions of available properties.
.. _call-graph:
Call Graph
----------
A calling sequence for filename completion may look like this:
* :func:`complete_internal`
* :func:`find_completion_word`
* :attr:`~rl.Completer.word_break_hook`
* :attr:`~rl.Completer.char_is_quoted_function`
* :func:`gen_completion_matches`
* :attr:`~rl.Completer.completer`
* :meth:`~rl.Completion.complete_filename`
* :attr:`~rl.Completer.directory_completion_hook` or
* :attr:`~rl.Completer.directory_rewrite_hook`
* :attr:`~rl.Completer.filename_dequoting_function`
* :attr:`~rl.Completer.filename_rewrite_hook`
* :attr:`~rl.Completer.ignore_some_completions_function`
* :func:`insert_match`
* :attr:`~rl.Completer.filename_quoting_function`
* :attr:`~rl.Completer.filename_stat_hook`
* :func:`display_matches`
* :attr:`~rl.Completer.display_matches_hook`
* :meth:`~rl.Completion.display_match_list`
* :attr:`~rl.Completer.filename_stat_hook`
Readline History
================
History allows readline to save and later recall lines the user has entered.
The :obj:`history <rl.History>` object provides a list-like interface to the
history buffer as well as functions to persist the history between sessions.
Upstream Documentation
======================
The `GNU Readline Library`_ and the `GNU History Library`_.
.. _`GNU Readline Library`: https://tiswww.case.edu/php/chet/readline/readline.html#SEC45
.. _`GNU History Library`: https://tiswww.case.edu/php/chet/readline/history.html#SEC6
"""
# Grab the PyOS_ReadlineFunctionPointer

@@ -110,0 +7,0 @@ from rl import _init

@@ -97,3 +97,3 @@ """Readline completion support."""

doc="""The completion entry function.
The function is called as ``function(text, state)`` for state
The function is called as ``function(text, state)`` for ``state``
in 0, 1, 2, ... until it returns None. It should return the

@@ -148,2 +148,4 @@ next possible completion for ``text``.

def directory_rewrite_hook():
# New in readline 4.2
# Pre-empts directory_completion_hook since readline 6.2
doc="""The directory rewrite hook function.

@@ -155,8 +157,4 @@ This hook is used to prepare the directory name passed

At the least, the function must perform all necessary
dequoting.
dequoting. New in readline 6.2.
New in readline 4.2.
Overrides :attr:`~rl.Completer.directory_completion_hook` since
readline 6.2.
Under Python 3 this hook returns filesystem encoding to readline."""

@@ -186,2 +184,3 @@ def get(self):

def filename_rewrite_hook():
# New in readline 6.1
doc="""The filename rewrite hook function.

@@ -191,6 +190,4 @@ This hook is called for every filename before it is compared

``function(filename)`` and should return a new filename
or None to indicate no change.
or None to indicate no change. New in readline 6.1.
New in readline 6.1.
Under Python 3 this hook returns preferred encoding to readline."""

@@ -205,2 +202,3 @@ def get(self):

def filename_stat_hook():
# New in readline 6.3
doc="""The filename stat hook function.

@@ -211,3 +209,2 @@ This hook is used to prepare the filename passed

return a new filename or None to indicate no change.
New in readline 6.3.

@@ -214,0 +211,0 @@

@@ -35,7 +35,17 @@ """Readline history support."""

@apply
def auto():
doc="""Controls whether readline automatically adds lines to
the history. Defaults to True. Set to False if you want to call
:meth:`~rl.History.append` yourself."""
def get(self):
return readline.get_auto_history()
def set(self, bool):
readline.set_auto_history(bool)
return property(get, set, doc=doc)
@apply
def max_entries():
doc="""The maximum number of history entries kept. Beyond this
point the history list is truncated by removing the oldest entry.
A negative value means no limit. A value of 0 disables
history collection. Defaults to -1."""
A negative value means no limit. Defaults to -1."""
def get(self):

@@ -134,2 +144,3 @@ if readline.history_is_stifled():

self.clear()
self.auto = True
self.max_entries = -1

@@ -136,0 +147,0 @@ self.max_file = -1

@@ -1,1 +0,1 @@

# 23
"""Example code."""

@@ -24,2 +24,3 @@ # Complete email addresses

@print_exc
@generator
def complete_email(text):

@@ -42,3 +43,3 @@ # Dispatch to username or hostname completion

# Set the completion entry function
completer.completer = generator(complete_email)
completer.completer = complete_email

@@ -45,0 +46,0 @@ # Enable TAB completion

@@ -11,6 +11,6 @@ # Complete system commands

@print_exc
@generator
def complete_command(text):
# Return executables matching 'text'
for dir in os.environ.get('PATH').split(':'):
dir = os.path.expanduser(dir)
if os.path.isdir(dir):

@@ -25,3 +25,3 @@ for name in os.listdir(dir):

# Set the completion entry function
completer.completer = generator(complete_command)
completer.completer = complete_command

@@ -28,0 +28,0 @@ # Enable TAB completion

@@ -20,4 +20,3 @@ # Complete filenames

def quote_filename(text, single_match, quote_char):
# Backslash-quote characters in text. Honor quote-characters
# if the user has typed them.
# Backslash-quote characters in text
if quote_char == "'":

@@ -34,5 +33,5 @@ pass

@print_exc
def dequote_filename(text, quote_char):
# Backslash-dequote characters in text. Honor quote-characters
# if the user has typed them.
# Backslash-dequote characters in text
if quote_char == "'":

@@ -56,8 +55,5 @@ pass

@print_exc
@generator
def complete_filename(text):
matches = []
# Dequote immediately to avoid a tilde-expansion bug. This
# also simplifies subsequent hooks.
if completion.found_quote:
text = dequote_filename(text, completion.quote_character)
# Complete usernames

@@ -81,3 +77,3 @@ if text.startswith('~') and '/' not in text:

completer.filename_quoting_function = quote_filename
completer.filename_dequoting_function = None
completer.filename_dequoting_function = dequote_filename

@@ -89,3 +85,3 @@ # Configure Unicode converter on Mac OS X

# Set the completion entry function
completer.completer = generator(complete_filename)
completer.completer = complete_filename

@@ -92,0 +88,0 @@ # Enable TAB completion

@@ -6,10 +6,8 @@ # Complete system commands

from rl import completer
from rl import print_exc
class CompleteCommand:
class CommandCompleter:
# A completion entry function implementing readline's
# generator protocol
@print_exc
def __call__(self, text, state):

@@ -26,3 +24,2 @@ if state == 0:

for dir in os.environ.get('PATH').split(':'):
dir = os.path.expanduser(dir)
if os.path.isdir(dir):

@@ -37,3 +34,3 @@ for name in os.listdir(dir):

# Set the completion entry function
completer.completer = CompleteCommand()
completer.completer = CommandCompleter()

@@ -40,0 +37,0 @@ # Enable TAB completion

@@ -12,2 +12,3 @@ # Complete from a static list of strings

@print_exc
@generator
def complete_string(text):

@@ -20,3 +21,3 @@ completion.suppress_append = True

# Set the completion entry function
completer.completer = generator(complete_string)
completer.completer = complete_string

@@ -23,0 +24,0 @@ # Enable TAB completion

@@ -19,2 +19,6 @@ """Test helpers."""

history.reset()
# Disable colors if enabled in ~/.inputrc
completer.parse_and_bind('set colored-stats off')
completer.parse_and_bind('set colored-completion-prefix off')
completer.parse_and_bind('set enable-active-region off')

@@ -21,0 +25,0 @@

@@ -190,7 +190,6 @@ import unittest

# FIXME: Prints to rl_outstream
def DISABLED_test_default_display_matches_hook(self):
def test_default_display_matches_hook(self):
self.mkfile('fred.txt', 'fred.gif')
completer.completer = filecomplete
readline.complete_internal('?')
self.assertEqual(called, [])

@@ -377,3 +376,32 @@

# FIXME: Prints to rl_outstream
def test_called_by_display_match_list(self):
def func(dirname):
called.append(dirname)
return dirname.replace('\\', '')
self.mkdir('flint stone')
self.mkfile('flint stone/fred.txt')
if readline.readline_version() >= 0x0801:
# Reset last_completion_failed
readline.complete_internal(TAB)
completer.directory_completion_hook = func
completion.line_buffer = 'flint\\ stone/fr'
readline.complete_internal('?')
self.assertEqual(called, ['flint\\ stone/', 'flint stone'])
self.assertEqual(completion.line_buffer, "flint\\ stone/fr")
def test_preempted_by_directory_rewrite_hook(self):
def func(dirname):
called.append(dirname)
return dirname.replace('\\', '')
self.mkdir('flint stone')
self.mkfile('flint stone/fred.txt')
completer.directory_rewrite_hook = lambda x: x
completer.directory_completion_hook = func
completion.line_buffer = 'flint\\ stone/fr'
readline.complete_internal(TAB)
self.assertEqual(called, []) # Not called
self.assertEqual(completion.line_buffer, "flint\\ stone/fr")
class FilenameDequotingFunctionTests(JailSetup):

@@ -423,3 +451,6 @@

readline.complete_internal(TAB)
self.assertEqual(called, [('.', ''), ('fr\\ ', '')])
if readline.readline_version() >= 0x0801:
self.assertEqual(called, [('.', ''), ('fr\\ ', ''), ('fr\\ ', '')])
else:
self.assertEqual(called, [('.', ''), ('fr\\ ', '')])
self.assertEqual(completion.line_buffer, "'fr ed.txt' ")

@@ -446,3 +477,6 @@

readline.complete_internal(TAB)
self.assertEqual(called, [('.', "'"), ('fr ', "'")])
if readline.readline_version() >= 0x0801:
self.assertEqual(called, [('.', "'"), ('fr ', "'"), ('fr ', "'")])
else:
self.assertEqual(called, [('.', "'"), ('fr ', "'")])
self.assertEqual(completion.line_buffer, "'fr ed.txt' ")

@@ -808,1 +842,28 @@

# FIXME: Prints to rl_outstream
def test_called_by_display_match_list(self):
def func(filename):
called.append(filename)
return filename
self.mkdir('flintstone')
self.mkfile('flintstone/fred.txt')
completer.filename_stat_hook = func
completion.line_buffer = 'flintstone/fr'
readline.complete_internal('?')
self.assertEqual(called, ['flintstone/fred.txt'])
self.assertEqual(completion.line_buffer, "flintstone/fr")
# FIXME: Prints to rl_outstream
def test_preempted_by_directory_completion_hook(self):
def func(filename):
called.append(filename)
return filename
self.mkdir('flintstone')
self.mkfile('flintstone/fred.txt')
completer.directory_completion_hook = lambda x: x
completer.filename_stat_hook = func
completion.line_buffer = 'flintstone/fr'
readline.complete_internal('?')
self.assertEqual(called, []) # Not called
self.assertEqual(completion.line_buffer, "flintstone/fr")

@@ -198,3 +198,10 @@ import unittest

def test_auto_history(self):
self.assertEqual(history.auto, True)
history.auto = False
self.assertEqual(history.auto, False)
history.auto = True
self.assertEqual(history.auto, True)
class HistoryStiflingTests(unittest.TestCase):

@@ -201,0 +208,0 @@

@@ -97,5 +97,14 @@ import unittest

def test_auto_history_default(self):
self.assertEqual(readline.get_auto_history(), True)
def test_auto_history(self):
readline.set_auto_history(False)
self.assertEqual(readline.get_auto_history(), False)
readline.set_auto_history(True)
self.assertEqual(readline.get_auto_history(), True)
def test_suite():
return unittest.defaultTestLoader.loadTestsFromName(__name__)

@@ -12,6 +12,13 @@ import unittest

def test_sort_attr(self):
l = ['foo.so.6.3', 'foo.so.6', 'foo.so']
l.sort(key=operator.attrgetter('__len__'))
self.assertEqual(l, ['foo.so', 'foo.so.6', 'foo.so.6.3'])
# Stopped working in Python 3.8
#
# Traceback (most recent call last):
# File "/Users/stefan/sandbox/rl/rl/tests/test_setup.py", line 14, in test_sort_attr
# l.sort(key=operator.attrgetter('__len__'))
# TypeError: '<' not supported between instances of 'method-wrapper' and 'method-wrapper'
#
#def test_sort_attr(self):
# l = ['foo.so.6.3', 'foo.so.6', 'foo.so']
# l.sort(key=operator.attrgetter('__len__'))
# self.assertEqual(l, ['foo.so', 'foo.so.6', 'foo.so.6.3'])

@@ -256,3 +256,6 @@ # -*- coding: utf-8 -*-

readline.complete_internal(TAB)
self.assertEqual(called, [('.', ''), ('Mä\\ ', '')])
if readline.readline_version() >= 0x0801:
self.assertEqual(called, [('.', ''), ('Mä\\ ', ''), ('Mä\\ ', '')])
else:
self.assertEqual(called, [('.', ''), ('Mä\\ ', '')])
self.assertEqual(completion.line_buffer, "'Mä dchen.txt' ")

@@ -259,0 +262,0 @@

@@ -62,7 +62,5 @@ #include "Python.h"

/* Prevent excessive micro allocations */
char buffer[256];
size_t buffer_size = Py_ARRAY_LENGTH(buffer);
char *s = buffer;
/* Cast away const */
char *s = (char*)text;
char saved;
size_t l;

@@ -77,12 +75,6 @@

index = l;
if (index >= buffer_size) {
s = PyMem_RawMalloc(index+1);
if (s == NULL)
return -1;
}
strncpy(s, text, index);
saved = s[index];
s[index] = '\0';
u = PyUnicode_DECODE(s);
if (s != buffer)
PyMem_RawFree(s);
s[index] = saved;
if (u == NULL)

@@ -89,0 +81,0 @@ return -1;

@@ -1,4 +0,1 @@

[metadata]
license_file = LICENSE
[egg_info]

@@ -13,4 +10,1 @@ tag_build =

[bdist_wheel]
universal = false
+49
-64

@@ -11,3 +11,2 @@ import sys

from distutils.sysconfig import get_config_vars
from distutils.spawn import find_executable
from distutils import log

@@ -17,6 +16,8 @@

version = '3.0'
readline_version = '8.0'
version = '3.1'
readline_version = '8.2'
readline_version_info = tuple(map(int, readline_version.split('.')))
def get_config_var(name, default=''):

@@ -130,7 +131,15 @@ return get_config_vars().get(name) or default

'build/readline/xmalloc.c',
'build/readline/xfree.c',
'build/readline/colors.c',
'build/readline/parse-colors.c',
])
if readline_version_info >= (6, 2):
self.sources.extend([
'build/readline/xfree.c',
])
if readline_version_info >= (6, 3):
self.sources.extend([
'build/readline/colors.c',
'build/readline/parse-colors.c',
])
self.define_macros.extend([

@@ -141,2 +150,8 @@ ('HAVE_CONFIG_H', None),

if sys.platform == "darwin" and readline_version_info < (7,):
# Fix conditional include in rltty.c
self.define_macros.extend([
('GWINSZ_IN_SYS_IOCTL', None),
])
self.include_dirs = ['build', 'build/readline'] + self.include_dirs

@@ -157,3 +172,5 @@

else:
log.warn('WARNING: Failed to find a termcap library')
# Take a good guess and produce a linker error at least
log.warn('WARNING: Failed to detect a termcap library; falling back to ncurses')
ext.libraries.append('ncurses')

@@ -166,3 +183,4 @@ # Prepare the source tree

def find_termcap(self, ext):
lib_dirs = []
lib_dirs = ext.library_dirs + self.compiler.library_dirs
termcap = ''

@@ -174,51 +192,12 @@ # Debian/Ubuntu multiarch

# Standard locations
lib_dirs.extend(['/lib64', '/usr/lib64', '/lib', '/usr/lib', '/usr/local/lib'])
lib_dirs = ext.library_dirs + self.compiler.library_dirs + lib_dirs
lib_dynload = join(sys.exec_prefix, 'lib', 'python%d.%d' % sys.version_info[:2], 'lib-dynload')
ext_suffix = get_config_var('EXT_SUFFIX', '.so')
for name in ['tinfo', 'ncursesw', 'ncurses', 'cursesw', 'curses', 'termcap']:
if self.compiler.find_library_file(lib_dirs, name):
termcap = name
break
termcap = ''
if self.can_inspect_libraries():
if not termcap:
pyreadline = join(lib_dynload, 'readline' + ext_suffix)
termcap = self.get_termcap_from(pyreadline)
if not termcap:
pycurses = join(lib_dynload, '_curses' + ext_suffix)
termcap = self.get_termcap_from(pycurses)
if termcap and not self.compiler.find_library_file(lib_dirs, termcap):
termcap = ''
if not termcap:
for name in ['tinfo', 'ncursesw', 'ncurses', 'cursesw', 'curses', 'termcap']:
if self.compiler.find_library_file(lib_dirs, name):
termcap = name
break
return termcap
def can_inspect_libraries(self):
if sys.platform == 'darwin':
cmd = 'otool'
else:
cmd = 'ldd'
if not find_executable(cmd):
log.warn('WARNING: Command not found: %s' % cmd)
return False
return True
def get_termcap_from(self, module):
if module and exists(module):
if sys.platform == 'darwin':
cmd = 'otool -L "%s"' % module
else:
cmd = 'ldd "%s"' % module
with os.popen(cmd) as fp:
libraries = fp.read()
for name in ['tinfo', 'ncursesw', 'ncurses', 'cursesw', 'curses', 'termcap']:
if 'lib%s.' % name in libraries:
return name
return ''
def configure_static_readline(self):

@@ -258,12 +237,8 @@ srcdir = os.getcwd()

'Programming Language :: C',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: Implementation :: CPython',
],
keywords='gnu readline bindings gnureadline',
keywords='gnu, readline, bindings, gnureadline, completion, tab completion',
author='Stefan H. Holek',

@@ -273,6 +248,9 @@ author_email='stefan@epy.co.at',

license='GPLv3',
packages=find_packages(),
include_package_data=True,
packages=find_packages(
exclude=[
'rl.tests',
],
),
include_package_data=False,
zip_safe=False,
test_suite='rl.tests',
ext_modules=[

@@ -284,6 +262,13 @@ readline_ext('rl.readline'),

},
install_requires=[
'setuptools',
],
python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*',
project_urls={
'Documentation': 'https://rl.readthedocs.io/en/stable/',
},
extras_require={
'docs': [
'sphinx == 5.3.0',
'sphinx-rtd-theme == 1.0.0',
],
},
)
+21
-5

@@ -1,11 +0,27 @@

# Tox (http://tox.testrun.org/) is a tool for running tests
# Tox (https://tox.readthedocs.io/) is a tool for running tests
# in multiple virtualenvs. This configuration file will run the
# test suite on all supported python versions. To use it, "pip install tox"
# and then run "tox" from this directory.
# test suite on all supported Python versions. To use it,
# "pip install tox" and then run "tox" from this directory.
[tox]
envlist = py27, py34, py35, py36, py37
envlist = py27, py36, py37, py38, py39, py310, py311
[testenv]
usedevelop = true
commands = {envpython} setup.py -q test {posargs}
recreate = true
passenv =
LOGNAME
HOME
commands =
python -m unittest discover {posargs}
[testenv:docs]
usedevelop = true
recreate = false
extras =
docs
commands =
python setup.py build_sphinx {posargs}
[pytest]
testpaths = rl/tests

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

@import url('css/theme.css');
/* Use link color for xrefs */
.rst-content a code.xref {
color: #2980B9;
}
.rst-content a code.xref:hover {
color: #3091d1;
}
/* Use text color for non-xref literals */
.rst-content code.literal {
color: #404040;
}
/* Call graph */
.rst-content div#call-graph ul ul {
border-left: 1px dotted #ddd;
padding-left: 1em;
}

Sorry, the diff of this file is not supported yet

==================
Completion Support
==================
.. automodule:: rl._completion
Completer Interface
===================
.. autoclass:: rl.Completer
.. autoattribute:: rl.Completer.quote_characters
.. autoattribute:: rl.Completer.word_break_characters
.. autoattribute:: rl.Completer.special_prefixes
.. autoattribute:: rl.Completer.filename_quote_characters
.. autoattribute:: rl.Completer.inhibit_completion
.. autoattribute:: rl.Completer.query_items
.. autoattribute:: rl.Completer.completer
.. autoattribute:: rl.Completer.startup_hook
.. autoattribute:: rl.Completer.pre_input_hook
.. autoattribute:: rl.Completer.word_break_hook
.. autoattribute:: rl.Completer.char_is_quoted_function
.. autoattribute:: rl.Completer.filename_quoting_function
.. autoattribute:: rl.Completer.filename_dequoting_function
.. autoattribute:: rl.Completer.directory_completion_hook
.. autoattribute:: rl.Completer.ignore_some_completions_function
.. autoattribute:: rl.Completer.display_matches_hook
.. automethod:: rl.Completer.read_init_file
.. automethod:: rl.Completer.parse_and_bind
Additional hooks for when the filesystem representation differs from the representation in the terminal
-------------------------------------------------------------------------------------------------------
.. autoattribute:: rl.Completer.directory_rewrite_hook
.. autoattribute:: rl.Completer.filename_rewrite_hook
.. autoattribute:: rl.Completer.filename_stat_hook
Completion Interface
====================
.. autoclass:: rl.Completion
.. autoattribute:: rl.Completion.line_buffer
.. autoattribute:: rl.Completion.completion_type
.. autoattribute:: rl.Completion.begidx
.. autoattribute:: rl.Completion.endidx
.. autoattribute:: rl.Completion.found_quote
.. autoattribute:: rl.Completion.quote_character
.. autoattribute:: rl.Completion.suppress_quote
.. autoattribute:: rl.Completion.append_character
.. autoattribute:: rl.Completion.suppress_append
.. autoattribute:: rl.Completion.filename_completion_desired
.. autoattribute:: rl.Completion.filename_quoting_desired
.. automethod:: rl.Completion.complete_filename
.. automethod:: rl.Completion.complete_username
.. automethod:: rl.Completion.expand_tilde
.. automethod:: rl.Completion.display_match_list
.. automethod:: rl.Completion.redisplay
Functions
========================
.. autofunction:: rl.generator
.. autofunction:: rl.print_exc
# -*- coding: utf-8 -*-
#
# rl documentation build configuration file, created by
# sphinx-quickstart on Sun Sep 4 23:31:47 2011.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys, os, time
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
# -- General configuration -----------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix of source filenames.
source_suffix = '.rst'
# The encoding of source files.
#source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'rl'
copyright = u'2009-%s, Stefan H. Holek' % time.strftime('%Y')
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The full version, including alpha/beta/rc tags.
release = '3.0'
# The short X.Y version.
version = '3.0'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build']
# The reST default role (used for this markup: `text`) to use for all documents.
#default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
# -- Options for HTML output ---------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#html_theme = 'nature'
#html_style = 'nature-plus.css'
#html_theme = 'classic'
#html_style = 'classic-plus.css'
#html_theme_options = {'sidebarwidth': 250}
try:
import sphinx_rtd_theme
except ImportError:
pass
else:
html_theme = 'sphinx_rtd_theme'
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
html_style = 'theme-plus.css'
if os.environ.get('READTHEDOCS', '') == 'True':
html_style = 'theme-plus.css'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
#html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# If false, no module index is generated.
#html_domain_indices = True
# If false, no index is generated.
#html_use_index = True
# If true, the index is split into individual pages for each letter.
#html_split_index = False
# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True
html_show_sourcelink = False
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None
# Output file base name for HTML help builder.
htmlhelp_basename = 'rldoc'
# -- Options for LaTeX output --------------------------------------------------
# The paper size ('letter' or 'a4').
#latex_paper_size = 'letter'
# The font size ('10pt', '11pt' or '12pt').
#latex_font_size = '10pt'
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'rl.tex', u'rl Documentation',
u'Stefan H. Holek', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False
# If true, show page references after internal links.
#latex_show_pagerefs = False
# If true, show URL addresses after external links.
#latex_show_urls = False
# Additional stuff for the LaTeX preamble.
#latex_preamble = ''
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# If false, no module index is generated.
#latex_domain_indices = True
# -- Options for manual page output --------------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'rl', u'rl Documentation',
[u'Stefan H. Holek'], 1)
]
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {
'py': ('https://docs.python.org/2', 'https://docs.python.org/2/objects.inv'),
'py3k': ('https://docs.python.org/3', 'https://docs.python.org/3/objects.inv'),
}
===================
Examples
===================
.. module:: rl.examples
Example code.
Completion Entry Function
============================
The completion entry function is called as ``function(text, state)`` for
state in 0, 1, 2, ... until it returns None. It should return the next
possible completion for ``text``:
.. literalinclude:: ../rl/examples/raw_input.py
Generator Factory
====================
The :func:`~rl.generator` factory provides a simpler way to support this
protocol:
.. literalinclude:: ../rl/examples/factory.py
Multiple Completions
=======================
The completion entry function is often a dispatcher,
forwarding calls to more specific completion functions depending on
position and format of the completion word:
.. literalinclude:: ../rl/examples/email.py
Filename Completion
======================
Filename completion is readline's party trick. It is also the most complex
feature, requiring various parts of readline to be set up:
.. literalinclude:: ../rl/examples/filename.py
Display Matches Hook
=======================
The :attr:`~rl.Completer.display_matches_hook` is called whenever matches need
to be displayed:
.. literalinclude:: ../rl/examples/display_matches_hook.py
===============
History Support
===============
.. automodule:: rl._history
History Interface
=================
.. autoclass:: rl.History
.. autoattribute:: rl.History.max_entries
.. autoattribute:: rl.History.max_file
.. automethod:: rl.History.append
.. automethod:: rl.History.__getitem__
.. automethod:: rl.History.__setitem__
.. automethod:: rl.History.__delitem__
.. automethod:: rl.History.__len__
.. automethod:: rl.History.__iter__
.. automethod:: rl.History.__reversed__
.. automethod:: rl.History.clear
.. automethod:: rl.History.read_file
.. automethod:: rl.History.write_file
.. automethod:: rl.History.append_file
===================================================================
rl |version| -- GNU Readline Bindings
===================================================================
.. module:: rl
Alternative Python bindings for GNU Readline.
.. toctree::
:maxdepth: 2
overview
completion
history
readline
examples
Indices and Tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
# Makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = ../bin/sphinx-build
PAPER =
BUILDDIR = _build
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
clean:
-rm -rf $(BUILDDIR)/*
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
singlehtml:
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."
json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."
htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."
qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/rl.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/rl.qhc"
devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/rl"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/rl"
@echo "# devhelp"
epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."
latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
make -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in $(BUILDDIR)/text."
man:
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."
===================================================================
Overview
===================================================================
.. automodule:: rl
=================
Readline Bindings
=================
.. automodule:: rl.readline
:members:

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display