changes by Barry, e.g. font lock & email addresses
[python/dscho.git] / README
blobbdbaae2ff04e01bc28c2056b5e1f0ffec97cef16
1 This is Python release 1.3b1
2 ============================
4 I.e., the first beta release of Python 1.3.
7 What's new in this release?
8 ---------------------------
10 - Keyword parameters (see the last chapter of the tutorial).
11 - Third argument to raise (the stacktrace to provide).
12 - Faster function and method calls.
13 - Jim Fulton's abstract object interface (Include/abstract.h).
14 - Support for Tk 4.0 in Tkinter (Tkinter now supports keywords!).
15 - Rewritten htmllib.py (HTML parser), with new formatter.py.
16 - Rewritten rexec.py (restricted execution).
17 - New modules ni.py and ihooks.py (package support and more).
18 - And lots more that you'll have to discover on your own.
21 Why is it called a beta release?
22 --------------------------------
24 Because it is.  There's no documentation except the source.  A few
25 things are broken by the changes for keyword parameters (the access
26 statement, the profiler, half of newmodule.c).  It has only been tested
27 on two Unix platforms (IRIX 5.3 and Solaris 2.4).  The Mac and Windows
28 sopport has not been fully re-integrated.
31 Why do I release it anyway?
32 ---------------------------
34 Because I'm also releasing a prototype of Grail, an extensible web
35 browser that is its answer to Java and could become Python's "Killer
36 App".  Grail depends heavily on some features of Python 1.3 (such as
37 keyword parameters).  The release date for Grail is determined by other
38 factors and I don't want to release it without full source.
40 Oh, and I'm going on a two week holiday as well :-)
43 What is Python anyway?
44 ----------------------
46 Python is an interpreted object-oriented programming language, and is
47 often compared to Tcl, Perl or Scheme.  For a quick summary of what
48 Python can mean for a UNIX/C programmer, read Misc/BLURB.LUTZ.
51 If you don't read instructions
52 ------------------------------
54 Congratulations on getting this far. :-)
56 To start building right away (on UNIX): type "./configure" in the
57 current directory and when it finishes, type "make".  The section
58 Build Instructions below is still recommended reading. :-)
61 Copyright issues
62 ----------------
64 Python is COPYRIGHTED but free to use for all.  See the full copyright
65 notice at the end of this file.
67 The Python distribution is *not* affected by the GNU Public Licence
68 (GPL).  There are interfaces to some GNU code but these are entirely
69 optional and no GNU code is distributed with Python.  For all these
70 packages, GPL-free public domain versions also exist.
74 Build instructions
75 ==================
77 Before you start building Python, you must first configure it.  This
78 entails (at least) running the script "./configure", which figures out
79 your system configuration and creates several Makefiles.  (It takes a
80 minute or two -- please be patient!)  When it's done, you are ready to
81 run make.  Typing "make" in the toplevel directory will recursively
82 run make in each of the subdirectories Parser, Objects, Python and
83 Modules, creating a library file in each one.  The executable of the
84 interpreter is built in the Modules subdirectory and moved up here
85 when it is built.  If you want or need to, you can also chdir into
86 each subdirectory in turn and run make there manually (do the Modules
87 subdirectory last!).
89 NOTE: if you rerun the configure script with different options, remove
90 all object files by running "make clean" before rebuilding.  Believe
91 it or not, "make clean" sometimes helps to clean up other inexplicable
92 problems as well.  Try it before sending in a bug report!
95 Troubleshooting
96 ---------------
98 If you run into trouble, see section 3 of the FAQ (file Misc/FAQ) for
99 hints on what can go wrong, and how to fix it.
102 Platform specific notes
103 -----------------------
105 Linux:  It is possible that "makesetup" fails with an obscure sed
106         error.  This is a bug in bash.  Replace /bin/sh with /bin/ash
107         in both makesetup and Makefile.pre.in.  This has been observed
108         in Slackware version 2.2, bash 1.14.3; Slackware 2.1 did not
109         have the problem.
111 AIX:    Read the file Misc/AIX-NOTES before trying to build.
113 HP-UX:  Read the file Misc/HPUX-NOTES if you want to be able to
114         use shared libraries for dynamically loaded modules.
116 Minix:  When using ack, use "CC=cc AR=aal RANLIB=: ./configure"!
118 SCO:    1) Everything works much better if you add -U__STDC__ to the
119         defs.  This is because all the SCO header files are broken.
120         Anything that isn't mentioned in the C standard it's
121         conditionally excluded when __STDC__ is defined.
123         2) Due to the U.S. export restrictions, SCO broke the crypt
124         stuff out into a separate library, libcrypt_i.a so the LIBS
125         needed be set to:
127                 LIBS=' -lsocket -lcrypt_i'
130 Configuring the set of built-in modules
131 ---------------------------------------
133 You can configure the interpreter to contain fewer or more built-in
134 modules by editing the file Modules/Setup.  This file is initially
135 copied (when the toplevel Makefile makes Modules/Makefile for the
136 first time) from Setup.in; if it does not exist yet, make a copy
137 yourself.  Never edit Setup.in -- always edit Setup.  Read the
138 comments in the file for information on what kind of edits you can
139 make.  When you have edited Setup, Makefile and config.c in Modules
140 will automatically be rebuilt the next time you run make in the
141 toplevel directory.
143 Especially on SGI IRIX, there are modules that interface to many SGI
144 specific system libraries, e.g. the GL library and the audio hardware.
147 Setting the optimization/debugging options
148 ------------------------------------------
150 If you want to change the optimization/debugging options for the C
151 compiler, assign to the OPT variable on the toplevel make command;
152 e.g. "make OPT=-g" will build a debugging version of Python on most
153 platforms.  The default is OPT=-O; a value for OPT in the environment
154 when the configure script is run overrides this default (likewise for
155 CC; and the initial value for LIBS is used as the base set of
156 libraries to link with).
159 Testing
160 -------
162 To test the interpreter that you have just built, type "make test".
163 This runs the test set silently, twice (once with no compiled files,
164 once with the compiled files left by the previous test run).  Each
165 test run should print "All tests OK." and nothing more.  (The test set
166 does not test the built-in modules, but will find most other problems
167 with the interpreter.)
169 IMPORTANT: If the tests fail and you decide to mail a bug report,
170 *don't* include the output of "make test".  It is useless.  Run the
171 following command instead:
173         PYTHONPATH=../Lib:../Lib/test:./Modules ./python -c 'import testall'
175 (substituting the top of the source tree for .. if you built in a
176 different directory).  This gives the output of the tests and shows
177 which test failed.
180 Installing
181 ----------
183 To install the interpreter as /usr/local/bin/python, type "make
184 install".  To install the library as /usr/local/lib/python, type "make
185 libinstall".  To install the manual page as
186 /usr/local/man/man1/python.1, type "make maninstall".  To install the
187 Emacs editing mode for python, manually copy the file
188 Misc/python-mode.el to your local Emacs lisp directory.  The directory
189 /usr/local can be overridden at configuration time by passing
190 --prefix=DIRECTORY to the configure script, or at make time by passing
191 "prefix=DIRECTORY" to make.  See below for more information on --prefix.
193 If you plan to do development of extension modules or to embed Python
194 in another application and don't want to reference the original source
195 tree, you can type "make inclinstall" and "make libainstall" to
196 install the include files and lib*.a files, respectively, as
197 /usr/local/include/Py/*.h and /usr/local/lib/python/lib/lib*.a.  The
198 make libainstall target also installs copies of several other files
199 used or produced during the build process which are needed to build
200 extensions or to generate their Makefiles.
203 Configuration options and variables
204 -----------------------------------
206 Some special cases are handled by passing environment variables or
207 options to the configure script.
209 NOTE: if you rerun the configure script with different options, remove
210 all object files by running "make clean" before rebuilding.
212 --with(out)-gcc: The configure script uses gcc (the GNU C compiler) if
213         it finds it.  If you don't want this, or if this compiler is
214         installed but broken on your platform, pass the option
215         --without-gcc.  You can also pass "CC=cc" (or whatever the
216         name of the proper C compiler is) in the environment, but the
217         advantage of using --without-gcc is that this option is
218         remembered by the config.status script for its --recheck
219         option.
221 --prefix, --exec-prefix: If you want to install the binaries and the
222         Python library somewhere else than in /usr/local/{bin,lib},
223         you can pass the option --prefix=DIRECTORY; the interpreter
224         binary will be installed as DIRECTORY/bin/python and the
225         library files as DIRECTORY/lib/python/*.  If you pass
226         --exec-prefix=DIRECTORY (as well) this overrides the
227         installation prefix for architecture-dependent files (like the
228         interpreter binary).  Note that --prefix=DIRECTORY also
229         affects the default module search path (sys.path), when
230         Modules/config.c is compiled.  Passing make the option
231         prefix=DIRECTORY (and/or exec_prefix=DIRECTORY) overrides the
232         prefix set at configuration time; this may be more convenient
233         than re-running the configure script if you change your mind
234         about the install prefix...
236 --with-readline: You can use the GNU readline library to improve the
237         interactive user interface: this gives you line editing and
238         command history when calling python interactively.  You need
239         to configure build the GNU readline library before running the
240         configure script.  Its sources are not distributed with
241         Python; you can ftp them from any GNU mirror site, or from its
242         home site:
243         <URL:ftp://slc2.ins.cwru.edu/pub/dist/readline-2.0.tar.gz> (or
244         a higher version number -- using version 1.x is not
245         recommended).
247         A GPL-free version was posted to comp.sources.misc in volume
248         31 and is widely available from FTP archive sites, e.g.
249         <URL:ftp://gatekeeper.dec.com/.b/usenet/comp.sources.misc/
250         volume31/editline/part01.Z>
252         Pass the Python configure script the option
253         --with-readline=DIRECTORY where DIRECTORY is the absolute
254         pathname of the directory where you've built the readline
255         library.  Some hints on building and using the readline
256         library are in the FAQ (file Misc/FAQ).
258 --with-thread: On SGI IRIX, and on Sun SOLARIS 2, you can use multiple
259         threads.  To enable this, pass --with-thread.  In the
260         Modules/Setup file, enable the thread module.  (Threads aren't
261         enabled automatically because there are run-time penalties
262         when support for them is compiled in even if you don't use
263         them.)
265 --with-sgi-dl: On SGI IRIX 4, dynamic loading of extension modules is
266         supported by the "dl" library by Jack Jansen, which is
267         ftp'able from <URL:ftp://ftp.cwi.nl/pub/dynload/dl-1.6.tar.Z>.
268         This is enabled (after you've ftp'ed and compiled the dl
269         library!) by passing --with-sgi-dl=DIRECTORY where DIRECTORY
270         is the absolute pathname of the dl library.  (Don't bother on
271         IRIX 5, it already has dynamic linking using SunOS style
272         shared libraries.)  Support for this feature is deprecated.
274 --with-dl-dld: Dynamic loading of modules is rumoured to be supported
275         on some other systems: VAX (Ultrix), Sun3 (SunOS 3.4), Sequent
276         Symmetry (Dynix), and Atari ST.  This is done using a
277         combination of the GNU dynamic loading package
278         (<URL:ftp://ftp.cwi.nl/pub/dynload/dl-dld-1.1.tar.Z>) and an
279         emulation of the SGI dl library mentioned above (the emulation
280         can be found at
281         <URL:ftp://ftp.cwi.nl/pub/dynload/dld-3.2.3.tar.Z>).  To
282         enable this, ftp and compile both libraries, then call the
283         configure passing it the option
284         --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY where DL_DIRECTORY is
285         the absolute pathname of the dl emulation library and
286         DLD_DIRECTORY is the absolute pathname of the GNU dld library.
287         (Don't bother on SunOS 4 or 5, they already have dynamic
288         linking using shared libraries.)  Support for this feature is
289         deprecated.
291 --with-libm, --with-libc: It is possible to specify alternative
292         versions for the Math library (default -lm) and the C library
293         (default the empty string) using the options
294         --with-libm=STRING and --with-libc=STRING, respectively.  E.g.
295         if your system requires that you pass -lc_s to the C compiler
296         to use the shared C library, you can pass --with-libc=-lc_s.
297         These libraries are passed after all other libraries, the C
298         library last.
301 Extensions
302 ----------
304 You can also build an "extended" interpreter, using modules that are
305 not contained in the Modules directory.  Extensions are distributed as
306 a separate tar file (currently extensions.tar.gz).  See the README
307 file there.
310 Building for multiple architectures (using the VPATH feature)
311 -------------------------------------------------------------
313 If your file system is shared between multiple architectures, it
314 usually is not necessary to make copies of the sources for each
315 architecture you want to support.  If the make program supports the
316 VPATH feature, you can create an empty build directory for each
317 architecture, and in each directory run the configure script (on the
318 appropriate machine with the appropriate options).  This creates the
319 necessary subdirectories and the Makefiles therein.  The Makefiles
320 contain a line VPATH=... which points to directory containing the
321 actual sources.  (On SGI systems, use "smake" instead of "make" if you
322 use VPATH -- don't try gnumake.)
324 For example, the following is all you need to build a minimal Python
325 in /usr/tmp/python (assuming ~guido/src/python is the toplevel
326 directory and you want to build in /usr/tmp/python):
328         $ mkdir /usr/tmp/python
329         $ cd /usr/tmp/python
330         $ ~guido/src/python/configure
331         [...]
332         $ make
333         [...]
334         $
336 Note that Modules/Makefile copies the original Setup file to the build
337 directory if it finds no Setup file there.  This means that you can
338 edit the Setup file for each architecture independently.  For this
339 reason, subsequent changes to the original Setup file are not tracked
340 automatically, as they might overwrite local changes.  To force a copy
341 of a changed original Setup file, delete the target Setup file.  (The
342 makesetup script supports multiple input files, so if you want to be
343 fancy you can change the rules to create an empty Setup.local if it
344 doesn't exist and run it with arguments $(srcdir)/Setup Setup.local;
345 however this assumes that you only need to add modules.)
348 Building on non-UNIX systems
349 ----------------------------
351 On non-UNIX systems, you will have to fake the effect of running the
352 configure script manually.  A good start is to copy the file
353 config.h.in to config.h and edit the latter to reflect the actual
354 configuration of your system.  Most symbols must simply be defined as
355 1 only if the corresponding feature is present and can be left alone
356 otherwise; however RETSIGTYPE must always be defined, either as int or
357 as void, and the *_t type symbols must be defined as some variant of
358 int if they need to be defined at all. Then arrange that the symbol
359 HAVE_CONFIG_H is defined during compilation (usually by passing an
360 argument of the form `-DHAVE_CONFIG_H' to the compiler, but this is
361 necessarily system-dependent).
363 I have tried to collect instructions, Makefiles and additional sources
364 for various platforms in this release.  The following directories
365 exist:
367 Mac/            Apple Macintosh, using THINK C 6.0 or MPW 3.2.
368 Dos/            MS-DOS and Windows 3.1, using Microsoft C.
369 Nt/             Windows NT, using Microsoft Visual C/C++.
370 Os2/            OS/2.
372 Most of these instructions were last tested with a previous Python
373 release, so you may still experience occasional problems.  If you have
374 fixes or suggestions, please let me know and I'll try to incorporate
375 them in the next release.
379 Miscellaneous issues
380 ====================
383 Documentation
384 -------------
386 All documentation is provided in the subdirectory Doc in the form of
387 LaTeX files.  In order of importance for new users: Tutorial (tut),
388 Library Reference (lib), Language Reference (ref), Extending (ext).
389 Especially the Library Reference is of immense value since much of
390 Python's power (including the built-in data types and functions!) is
391 described here.
393 To print the documentation from the LaTeX files, chdir into the Doc
394 subdirectory, type "make" (let's hope you have LaTeX installed!), and
395 send the four resulting PostScript files (tut.ps, lib.ps, ref.ps, and
396 ext.ps) to the printer.  See the README file there.
398 All documentation is also available on-line via the World-Wide Web
399 (WWW): <URL:http://www.cwi.nl/~guido/Python.html>.  It can also be
400 downloaded separately from the ftp archives (see below) in Emacs INFO,
401 HTML or PostScript form -- see the FAQ (file Misc/FAQ) for more info.
404 Emacs mode
405 ----------
407 There's an excellent Emacs editing mode for Python code; see the file
408 Misc/python-mode.el.  Originally written by Tim Peters, who's no
409 longer on the net, it is now maintained by Barry Warsaw
410 <bwarsaw@cnri.reston.va.com>.
412 BTW, if you want to use font-lock for Python sources, here's something
413 to put in your .emacs file:
415         (defun my-python-mode-hook ()
416           (setq font-lock-keywords python-font-lock-keywords)
417           (font-lock-mode 1))
418         (add-hook 'python-mode-hook 'my-python-mode-hook)
422 Bug reports
423 -----------
425 Bugs are best reported to the comp.lang.python newsgroup or the Python
426 mailing list -- see the section "Newsgroup and mailing list" below.
427 Before posting, read the FAQ (file Misc/FAQ) first to see if your
428 problem has already been answered!
431 Ftp access
432 ----------
434 Python's "home ftp site" is ftp.cwi.nl, directory pub/python.  See the
435 FAQ (file Misc/FAQ) for a list of other ftp sites carrying the Python
436 distribution.
439 Newsgroup and mailing list
440 --------------------------
442 There are a newsgroup and a mailing list devoted to Python
443 programming, design and bugs.  The newsgroup, comp.lang.python,
444 contains exactly the same messages as the mailing list.  To subscribe
445 to the mailing list, send mail containing your real name and e-mail
446 address to "python-list-request@cwi.nl" (a real person reads these
447 messages, so no LISTPROC or Majordomo commands, please).
450 The Tk interface
451 ----------------
453 Tk (the user interface component of John Ousterhout's Tcl language) is
454 also usable from Python.  Since this requires that you first build and
455 install Tcl/Tk, the Tk interface is not enabled by default.  It
456 requires Tcl 7.4 and Tk 4.0.  (Support for Tk 3.6 and Tcl 7.3 can be
457 found in Lib/tk3inter/.)
459 To enable the Python/Tk interface, once you've built and installed
460 Tcl/Tk, all you need to do is edit two lines in Modules/Setup; search
461 for the string "tkinter".  Un-comment one (normally the first) of the
462 lines beginning with "#tkinter" and un-comment the line beginning with
463 "#TKPATH".  (If you have installed Tcl/Tk in unusual places you will
464 have to edit the first line as well to fix the -I and -L options.)
465 See the Build Instructions above for more details.
467 There is little documentation.  Begin with fetching the "Tk Lifesaver"
468 document, e.g. <URL:ftp://ftp.cwi.nl/pub/python/doc/tkinter-doc.tar.gz>
469 (a gzipped tar file containing a PostScript file).  There are demos in
470 the Demo/tkinter directory, in the subdirectories guido, matt and www.
472 Note that there's a Python module called "Tkinter" (capital T) which
473 lives in Lib/tkinter/Tkinter.py, and a C module called "tkinter"
474 (lower case t) which lives in Modules/tkintermodule.c.  Demos and
475 normal Tk applications only import the Python Tkinter module -- only
476 the latter uses the C tkinter module directly.  In order to find the C
477 tkinter module, it must be compiled and linked into the Python
478 interpreter -- the tkinter line in the Setup file does this.  In order
479 to find the Python Tkinter module, sys.path must be set correctly --
480 the TKPATH assignment in the Setup file takes care of this, but only
481 if you install Python properly ("make install libinstall").  (You can
482 also use dynamic loading for the C tkinter module, in which case you
483 must manually fix up sys.path or set $PYTHONPATH for the Python
484 Tkinter module.)
486 See <URL:http://www.sunlabs.com/research/tcl/> for more info on where
487 to get Tcl/Tk.
490 Distribution structure
491 ----------------------
493 Most subdirectories have their own README file.  Most files have
494 comments.
496 ChangeLog       A raw list of changes since the first 1.0.0 BETA release
497 Contrib/        Interesting or useful Python code contributed by others
498 Demo/           Demonstration scripts, modules and programs
499 Doc/            Documentation (LaTeX sources)
500 Extensions/     Extension modules (distributed separately)
501 Grammar/        Input for the parser generator
502 Include/        Public header files
503 Lib/            Python library modules
504 Makefile.in     Source from which config.status creates Makefile
505 Misc/           Miscellaneous files
506 Modules/        Implementation of most built-in modules
507 Objects/        Implementation of most built-in object types
508 Parser/         The parser and tokenizer and their input handling
509 Python/         The "compiler" and interpreter
510 README          The file you're reading now
511 Tools/          Some useful programs written in Python
512 acconfig.h      Additional input for the autoheader program
513 config.h.in     Source from which config.status creates config.h
514 configure       Configuration shell script (GNU autoconf output)
515 configure.in    Configuration specification (GNU autoconf input)
517 The following files will (may) be created in the toplevel directory by
518 the configuration and build processes:
520 Makefile        Build rules
521 config.cache    cache of configuration variables
522 config.h        Configuration header
523 config.log      log from last configure run
524 config.status   status from last run of configure script
525 python          The executable interpreter
526 tags, TAGS      Tags files for vi and Emacs
529 Author's address
530 ----------------
532 Guido van Rossum
533 CWI, dept. CST
534 P.O. Box 94079
535 1090 GB  Amsterdam
536 The Netherlands
538 E-mail: guido@cwi.nl
542 Copyright notice
543 ================
545 The Python source is copyrighted, but you can freely use and copy it
546 as long as you don't change or remove the copyright notice:
548 ----------------------------------------------------------------------
549 Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
550 The Netherlands.
552                         All Rights Reserved
554 Permission to use, copy, modify, and distribute this software and its
555 documentation for any purpose and without fee is hereby granted,
556 provided that the above copyright notice appear in all copies and that
557 both that copyright notice and this permission notice appear in
558 supporting documentation, and that the names of Stichting Mathematisch
559 Centrum or CWI not be used in advertising or publicity pertaining to
560 distribution of the software without specific, written prior permission.
562 STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
563 THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
564 FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
565 FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
566 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
567 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
568 OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
569 ----------------------------------------------------------------------
572 --Guido van Rossum, CWI, Amsterdam <mailto:guido@cwi.nl>
573 <http://www.cwi.nl/~guido/>