mirror of
https://github.com/wassname/pyreadline.git
synced 2026-06-27 16:10:38 +08:00
pyreadline: Added latex manual and COPYING.
This commit is contained in:
+53
@@ -0,0 +1,53 @@
|
||||
pyreadline copyright and licensing notes
|
||||
========================================
|
||||
|
||||
Unless indicated otherwise, files in this project are covered by a BSD-type
|
||||
license, included below.
|
||||
|
||||
Individual authors are the holders of the copyright for their code and are
|
||||
listed in each file.
|
||||
|
||||
Some files may be licensed under different conditions. Ultimately each file
|
||||
indicates clearly the conditions under which its author/authors have
|
||||
decided to publish the code.
|
||||
|
||||
|
||||
pyreadline license
|
||||
------------------
|
||||
|
||||
pyreadline is released under a BSD-type license.
|
||||
|
||||
Copyright (c) 2006 Jörgen Stenarson <jorgen.stenarson@bostream.nu>.
|
||||
|
||||
Copyright (c) 2003-2006 Gary Bishop
|
||||
|
||||
Copyright (c) 2003-2006 Jack Trainor
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
a. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
b. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
c. Neither the name of the copyright holders nor the names of any
|
||||
contributors to this software may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGE.
|
||||
@@ -0,0 +1,169 @@
|
||||
\documentclass[11pt,twoside,english]{article}
|
||||
\usepackage{palatino}
|
||||
\usepackage[T1]{fontenc}
|
||||
\usepackage[latin1]{inputenc}
|
||||
\usepackage{geometry}
|
||||
\geometry{verbose,a4paper,tmargin=1in,bmargin=1in,lmargin=1in,rmargin=1in}
|
||||
\usepackage{fancyhdr}
|
||||
\pagestyle{fancy}
|
||||
\setlength\parskip{\medskipamount}
|
||||
\setlength\parindent{0pt}
|
||||
\usepackage{color}
|
||||
\IfFileExists{url.sty}{\usepackage{url}}
|
||||
{\newcommand{\url}{\texttt}}
|
||||
|
||||
|
||||
\usepackage{color}
|
||||
|
||||
% A few colors to replace the defaults for certain link types
|
||||
\definecolor{orange}{cmyk}{0,0.4,0.8,0.2}
|
||||
\definecolor{darkorange}{rgb}{.71,0.21,0.01}
|
||||
\definecolor{darkred}{rgb}{.52,0.08,0.01}
|
||||
\definecolor{darkgreen}{rgb}{.12,.54,.11}
|
||||
|
||||
% Use and configure listings package for nicely formatted code
|
||||
\usepackage{listings}
|
||||
\lstset{
|
||||
language=Python,
|
||||
basicstyle=\small\ttfamily,
|
||||
commentstyle=\ttfamily\color{blue},
|
||||
stringstyle=\ttfamily\color{darkorange},
|
||||
showstringspaces=false,
|
||||
breaklines=true,
|
||||
postbreak = \space\dots
|
||||
}
|
||||
|
||||
\usepackage[%pdftex, % needed for pdflatex
|
||||
breaklinks=true, % so long urls are correctly broken across lines
|
||||
colorlinks=true,
|
||||
urlcolor=blue,
|
||||
linkcolor=darkred,
|
||||
citecolor=darkgreen,
|
||||
]{hyperref}
|
||||
|
||||
\usepackage{html}
|
||||
|
||||
% This helps prevent overly long lines that stretch beyond the margins
|
||||
\sloppy
|
||||
|
||||
% Define a \codelist command which either uses listings for latex, or
|
||||
% plain verbatim for html (since latex2html doesn't understand the
|
||||
% listings package).
|
||||
\usepackage{verbatim}
|
||||
\newcommand{\codelist}[1] {
|
||||
\latex{\lstinputlisting{#1}}
|
||||
\html{\verbatiminput{#1}}
|
||||
}
|
||||
|
||||
\usepackage{babel}
|
||||
|
||||
\begin{document}
|
||||
|
||||
\title{pyreadline\\
|
||||
{\Large a python implementation of GNU readline}{\large }\\
|
||||
{\large User Manual, v. --version--}}
|
||||
|
||||
\author{Jörgen Stenarson}
|
||||
|
||||
\maketitle
|
||||
\latex{\tableofcontents{}}
|
||||
|
||||
\html{\bodytext{bgcolor=#ffffff}}
|
||||
|
||||
|
||||
\newpage
|
||||
\section{Overview}
|
||||
The pyreadline package is a python implementation of GNU readline. At the moment it is only available for the windows platform. The package is based on the readline package by Gary Bishop. The goal is to provide the functionality of the readline package. New features:
|
||||
\begin{itemize}
|
||||
\item International characters
|
||||
\item Cut and paste from clipboard
|
||||
\begin{description}
|
||||
\item[paste] Will paste first line from clipboard (multiple lines doesn't paste well).
|
||||
\item[ipython\_paste] Smart paste paths, smart paste tab delimited data as list or array.
|
||||
\item[multiline\_paste] Will assume text on clipobard is python code, removes all empty lines.
|
||||
\end{description}
|
||||
\item Bell is disabled by default
|
||||
\end{itemize}
|
||||
|
||||
\subsection{dependencies}
|
||||
\begin{itemize}
|
||||
\item ctypes
|
||||
\item win32all
|
||||
\end{itemize}
|
||||
|
||||
\section{Installation}
|
||||
\subsection{Development version}
|
||||
Use {\ttfamily easy\_install pyreadline==dev} to get development version.
|
||||
|
||||
\subsection{Current release version}
|
||||
Currently no release version available but will be:
|
||||
Use {\ttfamily easy\_install pyreadline} to get development version.
|
||||
|
||||
\section{Usage}
|
||||
The purpose of readline is to improve the interactive experience with the python interpreter by improving the line editing facilities. The most important being tab completion and copy and paste.
|
||||
|
||||
\subsection{Configuration file}
|
||||
The configuration file is read from the users home directory and is named pyreadlineconfig.ini. The files syntax is not the same as for GNU readline but a python syntax is used instead. The available commands are:
|
||||
\begin{description}
|
||||
\item[bind\_exit\_key] is used to bind the keys that are used to exit the interpreter. (Ctrl-d, ctrl-z)
|
||||
\item[bind\_key] is used to bind keys to editor functions
|
||||
\item[un\_bind\_key] is used to unbind keys can be useful to unbind default bindings the user does not like
|
||||
\item[bell\_style] is used to set bell style. (none|visible|audible)
|
||||
\item[show\_all\_if\_ambiguous] is used to enable the showing of a list of all alternative for tab completion (on|off)
|
||||
\item[mark\_directories] show directories (on|off)
|
||||
\item[completer\_delims] Which delimeters should be used to separate words for tab completion
|
||||
\item[debug\_output] Turn on debug output (on|off). Not implemented yet.
|
||||
\end{description}
|
||||
|
||||
Here is the example config file shipped with pyreadline:
|
||||
\lstinputlisting{pyreadlineconfig.ini}
|
||||
|
||||
\subsection{pyreadline with python interpreter}
|
||||
In your startup file add:
|
||||
\lstinputlisting{startup.py}
|
||||
|
||||
This file is included in the doc directory of the distribution.
|
||||
|
||||
\subsection{pyreadline with IPython}
|
||||
In IPython pyreadline is automatically used if available.
|
||||
|
||||
\subsection{International characters}
|
||||
The pyreadline package now supports international characters. However using international characters in the interactive prompt can be annoying on windows since the default codepage for the terminal is an ascii codepage (850 on swedish systems) but the filesystem often uses some other codepage (1252 on swedish systems). This means the filenames containing internationl characters entered on interactive prompt will not work. The workaround here is to change the codepage of your terminal to a more suitable one using the {\ttfamily chcp} command. For swedish systems {\ttfamily chcp 1252} does the trick but you also have to change the terminal font to ``lucida console'' using the properties dialog for the console.
|
||||
|
||||
|
||||
\section{Known issues}
|
||||
\begin{itemize}
|
||||
\item Ctrl-s can not be used as a bound key. It seems ctrl-s does not generate key-up events in the console. This is an issue with cygwin as well.
|
||||
\item No vi mode is implemented
|
||||
\end{itemize}
|
||||
|
||||
|
||||
\section{Future work}
|
||||
\subsection{Near term}
|
||||
\begin{itemize}
|
||||
\item install scripts for easyinstall and distutils
|
||||
\item Manual
|
||||
\end{itemize}
|
||||
|
||||
\subsection{Middle term}
|
||||
\begin{itemize}
|
||||
\item Refactor code
|
||||
\item Add missing functionality
|
||||
\item Make console layer pluggable to allow more platforms
|
||||
\end{itemize}
|
||||
|
||||
\subsection{Long term}
|
||||
\begin{itemize}
|
||||
\item Add more platforms
|
||||
\item Add vi mode
|
||||
\end{itemize}
|
||||
|
||||
|
||||
\newpage
|
||||
\appendix
|
||||
|
||||
\section{Bindable commands}
|
||||
This appendix will contain descriptions of all bindable commands. For now you have to look in the sourcecode check the readline class of the file rlmain.py
|
||||
|
||||
|
||||
\end{document}
|
||||
@@ -0,0 +1,13 @@
|
||||
# -*- coding: UTF-8 -*-
|
||||
# Example snippet to use in a PYTHONSTARTUP file
|
||||
#
|
||||
|
||||
try:
|
||||
import pyreadline
|
||||
except ImportError:
|
||||
print "Module pyreadline not available."
|
||||
else:
|
||||
import rlcompleter
|
||||
pyreadline.parse_and_bind("tab: complete")
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
# Must be launched with the build version of pyreadline on path
|
||||
#
|
||||
import re
|
||||
import pyreadline.release as release
|
||||
|
||||
|
||||
fil=open("manual_base.tex")
|
||||
txt=fil.read()
|
||||
fil.close()
|
||||
|
||||
manualtext=re.sub("--version--",release.version,txt)
|
||||
fil=open("manual.tex","w")
|
||||
fil.write(manualtext)
|
||||
fil.close()
|
||||
print "Manual (magic.tex, manual.lyx) succesfully updated, exiting..."
|
||||
|
||||
|
||||
Reference in New Issue
Block a user