diff --git a/IPython/Magic.py b/IPython/Magic.py index 49ed450..b47ef68 100644 --- a/IPython/Magic.py +++ b/IPython/Magic.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """Magic functions for InteractiveShell. -$Id: Magic.py 994 2006-01-08 08:29:44Z fperez $""" +$Id: Magic.py 1000 2006-01-10 08:06:04Z fperez $""" #***************************************************************************** # Copyright (C) 2001 Janko Hauser and @@ -250,7 +250,9 @@ license. To use profiling, please install"python2.3-profiler" from non-free.""") newline_re = re.compile(r'\\n') # Now build the string for output: - strng = cmd_name_re.sub(r'\n\\texttt{\\textsl{\\large \1}}:',strng) + #strng = cmd_name_re.sub(r'\n\\texttt{\\textsl{\\large \1}}:',strng) + strng = cmd_name_re.sub(r'\n\\bigskip\n\\texttt{\\textbf{ \1}}:', + strng) strng = cmd_re.sub(r'\\texttt{\g}',strng) strng = par_re.sub(r'\\\\',strng) strng = escape_re.sub(r'\\\1',strng) @@ -1709,6 +1711,7 @@ Currently the magic system has the following functions:\n""" temporary file and will execute the contents of this file when you close it (don't forget to save it!). + Options: -p: this will call the editor with the same data as the previous time @@ -1719,6 +1722,7 @@ Currently the magic system has the following functions:\n""" mainly useful if you are editing programs which need to be called with command line arguments, which you can then do using %run. + Arguments: If arguments are given, the following possibilites exist: @@ -1917,6 +1921,7 @@ Currently the magic system has the following functions:\n""" if use_temp: filename = self.shell.mktempfile(data) + print 'IPython will make a temporary file named:',filename # do actual editing here print 'Editing...', diff --git a/IPython/Release.py b/IPython/Release.py index 72933d8..9d2c176 100644 --- a/IPython/Release.py +++ b/IPython/Release.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """Release data for the IPython project. -$Id: Release.py 994 2006-01-08 08:29:44Z fperez $""" +$Id: Release.py 1000 2006-01-10 08:06:04Z fperez $""" #***************************************************************************** # Copyright (C) 2001-2006 Fernando Perez @@ -22,9 +22,9 @@ name = 'ipython' # because bdist_rpm does not accept dashes (an RPM) convention, and # bdist_deb does not accept underscores (a Debian convention). -version = '0.7.0.rc8' +version = '0.7.0' -revision = '$Revision: 994 $' +revision = '$Revision: 1000 $' description = "An enhanced interactive Python shell." diff --git a/IPython/iplib.py b/IPython/iplib.py index 49561d8..27f1912 100644 --- a/IPython/iplib.py +++ b/IPython/iplib.py @@ -6,7 +6,7 @@ Requires Python 2.1 or newer. This file contains all the classes and helper functions specific to IPython. -$Id: iplib.py 995 2006-01-08 16:23:20Z fperez $ +$Id: iplib.py 1000 2006-01-10 08:06:04Z fperez $ """ #***************************************************************************** @@ -2033,7 +2033,7 @@ want to merge them back into the new files.""" % locals() - data(None): if data is given, it gets written out to the temp file immediately, and the file is closed again.""" - filename = tempfile.mktemp('.py') + filename = tempfile.mktemp('.py','ipython_edit_') self.tempfiles.append(filename) if data: diff --git a/doc/ChangeLog b/doc/ChangeLog index 9348686..5b77ec2 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,13 @@ +2006-01-10 Fernando Perez + + * IPython/Release.py (revision): tag version number to 0.7.0, + ready for release. + + * IPython/Magic.py (magic_edit): Add print statement to %edit so + it informs the user of the name of the temp. file used. This can + help if you decide later to reuse that same file, so you know + where to copy the info from. + 2006-01-09 Fernando Perez * setup_bdist_egg.py: little script to build an egg. Added diff --git a/doc/manual_base.lyx b/doc/manual_base.lyx index 86fc24e..c2a00d2 100644 --- a/doc/manual_base.lyx +++ b/doc/manual_base.lyx @@ -49,7 +49,7 @@ \inputencoding latin1 \fontscheme palatino \graphics default -\paperfontsize 10 +\paperfontsize 11 \spacing single \papersize Default \paperpackage a4 @@ -58,9 +58,9 @@ \use_natbib 0 \use_numerical_citations 0 \paperorientation portrait -\leftmargin 1.1in +\leftmargin 1in \topmargin 1in -\rightmargin 1.1in +\rightmargin 1in \bottommargin 1in \secnumdepth 3 \tocdepth 3 @@ -2234,63 +2234,6 @@ Use your input history. code for your programs. \layout Itemize -Define your own macros with -\family typewriter -%macro -\family default -. - This can be useful for automating sequences of expressions when working - interactively. - You can edit a macro (they are just Python variables holding your input - as a string) by simply typing ` -\family typewriter -%edit macroname -\family default -', and macros can be stored persistently across session with ` -\family typewriter -%store macroname -\family default -' (the storage system is per-profile). - The combination of quick macros, persistent storage and editing, allows - you to easily refine quick-and-dirty interactive input into permanent utilities -, always available both in IPython and as files for general reuse. -\layout Itemize - -While -\family typewriter -%macro -\family default - saves input lines into memory for interactive re-execution, sometimes you'd - like to save your input directly to a file. - The -\family typewriter -%save -\family default - magic does this: its input sytnax is the same as -\family typewriter -%macro -\family default -, but it saves your input directly to a Python file. - Note that the -\family typewriter -%logstart -\family default - command also saves input, but it logs -\emph on -all -\emph default - input to disk (though you can temporarily suspend it and reactivate it - with -\family typewriter -%logoff/%logon -\family default -); -\family typewriter -%save -\family default - allows you to select which lines of input you need to save. -\layout Itemize - Define your own system aliases. Even though IPython gives you access to your system shell via the \family typewriter @@ -2406,16 +2349,6 @@ Use the Python profiler. calls). \layout Itemize -Use -\family typewriter -%edit -\family default - to have almost multiline editing. - While IPython doesn't support true multiline editing, this command allows - you to call an editor on the spot, and IPython will execute the code you - type in there as if it were typed interactively. -\layout Itemize - Use the IPython.demo.Demo class to load any Python script as an interactive demo. With a minimal amount of simple markup, you can control the execution of @@ -2427,13 +2360,129 @@ Use the IPython.demo.Demo class to load any Python script as an interactive \end_inset for more. +\layout Subsection + +Source code handling tips \layout Standard +IPython is a line-oriented program, without full control of the terminal. + Therefore, it doesn't support true multiline editing. + However, it has a number of useful tools to help you in dealing effectively + with more complex editing. +\layout Standard -\series bold -Effective logging: -\series default - a very useful suggestion sent in by Robert Kern follows +The +\family typewriter +%edit +\family default + command gives a reasonable approximation of multiline editing, by invoking + your favorite editor on the spot. + IPython will execute the code you type in there as if it were typed interactive +ly. + Type +\family typewriter +%edit? +\family default + for the full details on the edit command. +\layout Standard + +If you have typed various commands during a session, which you'd like to + reuse, IPython provides you with a number of tools. + Start by using +\family typewriter +%hist +\family default + to see your input history, so you can see the line numbers of all input. + Let us say that you'd like to reuse lines 10 through 20, plus lines 24 + and 28. + All the commands below can operate on these with the syntax +\layout LyX-Code + +%command 10-20 24 28 +\layout Standard + +where the command given can be: +\layout Itemize + + +\family typewriter +%macro +\family default +: this stores the lines into a variable which, when called at the prompt, + re-executes the input. + Macros can be edited later using +\family typewriter +`%edit macroname +\family default +', and they can be stored persistently across sessions with ` +\family typewriter +%store macroname +\family default +' (the storage system is per-profile). + The combination of quick macros, persistent storage and editing, allows + you to easily refine quick-and-dirty interactive input into permanent utilities +, always available both in IPython and as files for general reuse. +\layout Itemize + + +\family typewriter +%edit +\family default +: this will open a text editor with those lines pre-loaded for further modificat +ion. + It will then execute the resulting file's contents as if you had typed + it at the prompt. +\layout Itemize + + +\family typewriter +%save +\family default +: this saves the lines directly to a named file on disk. +\layout Standard + +While +\family typewriter +%macro +\family default + saves input lines into memory for interactive re-execution, sometimes you'd + like to save your input directly to a file. + The +\family typewriter +%save +\family default + magic does this: its input sytnax is the same as +\family typewriter +%macro +\family default +, but it saves your input directly to a Python file. + Note that the +\family typewriter +%logstart +\family default + command also saves input, but it logs +\emph on +all +\emph default + input to disk (though you can temporarily suspend it and reactivate it + with +\family typewriter +%logoff/%logon +\family default +); +\family typewriter +%save +\family default + allows you to select which lines of input you need to save. +\layout Standard + +And +\layout Subsection + +Effective logging +\layout Standard + +A very useful suggestion sent in by Robert Kern follows: \layout Standard I recently happened on a nifty way to keep tidy per-project log files. @@ -8524,7 +8573,17 @@ The current IPython system grew out of the following three projects: \layout List \labelwidthstring 00.00.0000 -ipython by Fernando Pérez. +ipython by Fernando P +\begin_inset ERT +status Collapsed + +\layout Standard + +\backslash +'{e} +\end_inset + +rez. I was working on adding Mathematica-type prompts and a flexible configuration system (something better than \family typewriter @@ -8576,10 +8635,10 @@ The above listed features work, and quite well for the most part. and well localized in the cleaner parts of the code). \layout Standard -IPython consists of some 12000 lines of pure python code, of which roughly - 50% are fairly clean. - The other 50% are fragile, messy code which needs a massive restructuring - before any further major work is done. +IPython consists of some 18000 lines of pure python code, of which roughly + two thirds is reasonably clean. + The rest is, messy code which needs a massive restructuring before any + further major work is done. Even the messy code is fairly well documented though, and most of the problems in the (non-existent) class design are well pointed to by a PyChecker run. So the rewriting work isn't that bad, it will just be time-consuming. @@ -8719,7 +8778,17 @@ Versions of IPython up to and including 0.6.3 were released under the GNU Credits \layout Standard -IPython is mainly developed by Fernando Pérez +IPython is mainly developed by Fernando P +\begin_inset ERT +status Collapsed + +\layout Standard + +\backslash +'{e} +\end_inset + +rez \family typewriter \family default @@ -8817,7 +8886,7 @@ Ka-Ping Yee with a much nicer syntax than formatting through the '%' operator. \layout Standard -Arnd Bäcker +Arnd Baecker \family typewriter \family default @@ -9101,7 +9170,7 @@ Drexler \labelwidthstring 00.00.0000 Gustavo\SpecialChar ~ -Córdova\SpecialChar ~ +Cordova\SpecialChar ~ Avila \family typewriter diff --git a/setup_bdist_egg.py b/setup_bdist_egg.py index f9a561a..6736e39 100755 --- a/setup_bdist_egg.py +++ b/setup_bdist_egg.py @@ -1,11 +1,19 @@ #!/usr/bin/env python -"""Simple wrapper to build IPython as an egg (setuptools format).""" +"""Wrapper to build IPython as an egg (setuptools format).""" +import os import sys -import pkg_resources -pkg_resources.require("setuptools") +# Add my local path to sys.path +home = os.environ['HOME'] +sys.path.insert(0,'%s/usr/local/lib/python%s/site-packages' % + (home,sys.version[:3])) + +# now, import setuptools and build the actual egg import setuptools sys.argv=['','bdist_egg'] execfile('setup.py') + +# clean up the junk left around by setuptools +os.system('rm -rf ipython.egg-info')