Commit 90b64b51 authored by William Stein's avatar William Stein

More Pyrex/SageX --> Cython changes

parent c4fa206b
......@@ -8,4 +8,6 @@ Cython, which derives from Pyrex, is licensed under the Python
Software Foundation License. More precisely, all modifications
made to go from Pyrex to Cython are so licensed.
See LICENSE.txt for more details.
from distutils.core import setup
from distutils.extension import Extension
from Pyrex.Distutils import build_ext
from Cython.Distutils import build_ext
setup(
name = 'Demos',
......
......@@ -4,7 +4,7 @@ PYINCLUDE = \
-I$(PYHOME)/$(ARCH)/include/python2.2
%.c: %.pyx
../../bin/pyrexc $<
../../bin/cython $<
%.o: %.c
gcc -c -fPIC $(PYINCLUDE) $<
......
from distutils.core import setup
from distutils.extension import Extension
from Pyrex.Distutils import build_ext
from Cython.Distutils import build_ext
setup(
name = 'callback',
......
This diff is collapsed.
......@@ -4,7 +4,7 @@
<meta name="GENERATOR" content="Mozilla/4.51 (Macintosh; I; PPC) [Netscape]"><title>FAQ.html</title></head>
<body>
<center> <h1> <hr width="100%">Pyrex FAQ
<center> <h1> <hr width="100%">Cython FAQ
<hr width="100%"></h1>
</center>
<h2> Contents</h2>
......@@ -14,7 +14,7 @@
bytes to a Python string?</a></b></li>
<li> <b><a href="#NumericAccess">How do I access the data inside a Numeric
array object?</a></b></li>
<li><b><a href="#Rhubarb">Pyrex says my extension type object has no attribute
<li><b><a href="#Rhubarb">Cython says my extension type object has no attribute
'rhubarb', but I know it does. What gives?</a></b></li><li><a style="font-weight: bold;" href="#Quack">Python says my extension type has no method called 'quack', but I know it does. What gives?</a><br>
</li>
......@@ -55,10 +55,10 @@ bytes to a Python string?</h2>
section of the <a href="extension_types.html">"Extension Types"</a> documentation
page.<br>
<tt> </tt> </p>
<h2><a name="Rhubarb"></a>Pyrex says my extension type object has no attribute
<h2><a name="Rhubarb"></a>Cython says my extension type object has no attribute
'rhubarb', but I know it does. What gives?</h2>
You're probably trying to access it through a reference which Pyrex thinks
is a generic Python object. You need to tell Pyrex that it's a reference
You're probably trying to access it through a reference which Cython thinks
is a generic Python object. You need to tell Cython that it's a reference
to your extension type by means of a declaration,<br>
for example,<br>
<blockquote><tt>cdef class Vegetables:</tt><br>
......
This diff is collapsed.
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"><html><head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="GENERATOR" content="Mozilla/4.51 (Macintosh; I; PPC) [Netscape]"> <title>Pyrex - Front Page</title></head><body>&nbsp;<table CELLSPACING=0 CELLPADDING=10 WIDTH="500" ><tr><td VALIGN=TOP BGCOLOR="#FF9218"><font face="Arial,Helvetica"><font size=+4>Pyrex</font></font></td> <td ALIGN=RIGHT VALIGN=TOP WIDTH="200" BGCOLOR="#5DBACA"><font face="Arial,Helvetica"><font size=+1>A smooth blend of the finest Python&nbsp;</font></font><br><font face="Arial,Helvetica"><font size=+1>with the unsurpassed power&nbsp;</font></font><br><font face="Arial,Helvetica"><font size=+1>of raw C.</font></font></td></tr></table> <blockquote><font size=+1>Welcome to Pyrex, a language for writing Python extension modules. Pyrex makes creating an extension module is almost as easy as creating a Python module! To find out more, consult one of the edifying documents below.</font></blockquote> <h1><font face="Arial,Helvetica"><font size=+2>Documentation</font></font></h1> <blockquote><h2><font face="Arial,Helvetica"><font size=+1><a href="About.html">About Pyrex</a></font></font></h2> <blockquote><font size=+1>Read this to find out what Pyrex is all about and what it can do for you.</font></blockquote> <h2><font face="Arial,Helvetica"><font size=+1><a href="overview.html">Language Overview</a></font></font></h2> <blockquote><font size=+1>A description of all the features of the Pyrex language. This is the closest thing to a reference manual in existence yet.</font></blockquote> <h2><font face="Arial,Helvetica"><font size=+1><a href="FAQ.html">FAQ</a></font></font></h2> <blockquote><font size=+1>Want to know how to do something in Pyrex? Check here first<font face="Arial,Helvetica">.</font></font></blockquote></blockquote> <h1><font face="Arial,Helvetica"><font size=+2>Other Resources</font></font></h1> <blockquote><h2><font face="Arial,Helvetica"><font size=+1><a href="http://www.cosc.canterbury.ac.nz/~greg/python/Pyrex/mpj17-pyrex-guide/">Michael's Quick Guide to Pyrex</a></font></font></h2> <blockquote><font size=+1>This tutorial-style presentation will take you through the steps of creating some Pyrex modules to wrap existing C libraries. Contributed by <a href="mailto:mpj17@cosc.canterbury.ac.nz">Michael JasonSmith</a>.</font></blockquote> <h2><font face="Arial,Helvetica"><font size=+1><a href="mailto:greg@cosc.canterbury.ac.nz">Mail to the Author</a></font></font></h2> <blockquote><font size=+1>If you have a question that's not answered by anything here, you're not sure about something, or you have a bug to report or a suggestion to make, or anything at all to say about Pyrex, feel free to email me:<font face="Arial,Helvetica"> </font><tt><a href="mailto:greg@cosc.canterbury.ac.nz">greg@cosc.canterbury.ac.nz</a></tt></font></blockquote></blockquote> </body></html>
\ No newline at end of file
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"><html><head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="GENERATOR" content="Mozilla/4.51 (Macintosh; I; PPC) [Netscape]"> <title>Cython - Front Page</title></head><body>&nbsp;<table CELLSPACING=0 CELLPADDING=10 WIDTH="500" ><tr><td VALIGN=TOP BGCOLOR="#FF9218"><font face="Arial,Helvetica"><font size=+4>Cython</font></font></td> <td ALIGN=RIGHT VALIGN=TOP WIDTH="200" BGCOLOR="#5DBACA"><font face="Arial,Helvetica"><font size=+1>A smooth blend of the finest Python&nbsp;</font></font><br><font face="Arial,Helvetica"><font size=+1>with the unsurpassed power&nbsp;</font></font><br><font face="Arial,Helvetica"><font size=+1>of raw C.</font></font></td></tr></table> <blockquote><font size=+1>Welcome to Cython, a language for writing Python extension modules. Cython makes creating an extension module is almost as easy as creating a Python module! To find out more, consult one of the edifying documents below.</font></blockquote> <h1><font face="Arial,Helvetica"><font size=+2>Documentation</font></font></h1> <blockquote><h2><font face="Arial,Helvetica"><font size=+1><a href="About.html">About Cython</a></font></font></h2> <blockquote><font size=+1>Read this to find out what Cython is all about and what it can do for you.</font></blockquote> <h2><font face="Arial,Helvetica"><font size=+1><a href="overview.html">Language Overview</a></font></font></h2> <blockquote><font size=+1>A description of all the features of the Cython language. This is the closest thing to a reference manual in existence yet.</font></blockquote> <h2><font face="Arial,Helvetica"><font size=+1><a href="FAQ.html">FAQ</a></font></font></h2> <blockquote><font size=+1>Want to know how to do something in Cython? Check here first<font face="Arial,Helvetica">.</font></font></blockquote></blockquote> <h1><font face="Arial,Helvetica"><font size=+2>Other Resources</font></font></h1> <blockquote><h2><font face="Arial,Helvetica"><font size=+1><a href="http://www.cosc.canterbury.ac.nz/~greg/python/Cython/mpj17-pyrex-guide/">Michael's Quick Guide to Cython</a></font></font></h2> <blockquote><font size=+1>This tutorial-style presentation will take you through the steps of creating some Cython modules to wrap existing C libraries. Contributed by <a href="mailto:mpj17@cosc.canterbury.ac.nz">Michael JasonSmith</a>.</font></blockquote> <h2><font face="Arial,Helvetica"><font size=+1><a href="mailto:greg@cosc.canterbury.ac.nz">Mail to the Author</a></font></font></h2> <blockquote><font size=+1>If you have a question that's not answered by anything here, you're not sure about something, or you have a bug to report or a suggestion to make, or anything at all to say about Cython, feel free to email me:<font face="Arial,Helvetica"> </font><tt><a href="mailto:greg@cosc.canterbury.ac.nz">greg@cosc.canterbury.ac.nz</a></tt></font></blockquote></blockquote> </body></html>
\ No newline at end of file
......
This diff is collapsed.
<!DOCTYPE doctype PUBLIC "-//w3c//dtd html 4.0 transitional//en">
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Mozilla/4.61 (Macintosh; I; PPC) [Netscape]"><title>Sharing Declarations Between Pyrex Modules</title></head>
<meta name="GENERATOR" content="Mozilla/4.61 (Macintosh; I; PPC) [Netscape]"><title>Sharing Declarations Between Cython Modules</title></head>
<body>
<h1> <hr width="100%">Sharing Declarations Between Pyrex Modules
<h1> <hr width="100%">Sharing Declarations Between Cython Modules
<hr width="100%"></h1>
This section describes a new set of facilities introduced in Pyrex 0.8
for making C declarations and extension types in one Pyrex module available
for use in another Pyrex module. These facilities are closely modelled on
This section describes a new set of facilities introduced in Cython 0.8
for making C declarations and extension types in one Cython module available
for use in another Cython module. These facilities are closely modelled on
the Python import mechanism, and can be thought of as a compile-time version
of it.
<h2> Contents</h2>
......@@ -27,9 +27,9 @@ naming conflicts</a></li>
<li> <a href="#SharingExtensionTypes">Sharing extension types</a></li>
</ul>
<h2> <a name="DefAndImpFiles"></a>Definition and Implementation files</h2>
A Pyrex module can be split into two parts: a <i>definition file</i> with
A Cython module can be split into two parts: a <i>definition file</i> with
a <tt>.pxd</tt> suffix, containing C declarations that are to be available
to other Pyrex modules, and an <i>implementation file</i> with a <tt>.pyx</tt>
to other Cython modules, and an <i>implementation file</i> with a <tt>.pyx</tt>
suffix, containing everything else. When a module wants to use something
declared in another module's definition file, it imports it using the <a href="#CImportStatement"><b>cimport</b> statement</a>.
<h3> <a name="WhatDefFileContains"></a>What a Definition File contains</h3>
......@@ -44,11 +44,11 @@ declared in another module's definition file, it imports it using the <a href="#
<p>It cannot contain the implementations of any C or Python functions, or
any Python class definitions, or any executable statements. </p>
<blockquote>NOTE: You don't need to (and shouldn't) declare anything in a
declaration file <b>public</b> in order to make it available to other Pyrex
declaration file <b>public</b> in order to make it available to other Cython
modules; its mere presence in a definition file does that. You only need a
public declaration if you want to make something available to external C code.</blockquote>
<h3> <a name="WhatImpFileContains"></a>What an Implementation File contains</h3>
An implementation file can contain any kind of Pyrex statement, although
An implementation file can contain any kind of Cython statement, although
there are some restrictions on the implementation part of an extension type
if the corresponding definition file also defines that type (see below).
......@@ -101,7 +101,7 @@ name under which you imported it. Using <b>cimport</b> to import extension
types is covered in more detail <a href="#SharingExtensionTypes">below</a>.
</p>
<h3> <a name="SearchPaths"></a>Search paths for definition files</h3>
When you <b>cimport</b> a module called <tt>modulename</tt>, the Pyrex
When you <b>cimport</b> a module called <tt>modulename</tt>, the Cython
compiler searches for a file called <tt>modulename.pxd</tt> along the search
path for include files, as specified by <b>-I</b> command line options.
<p>Also, whenever you compile a file <tt>modulename.pyx</tt>, the corresponding
......
......@@ -5,7 +5,7 @@
<body>
<h1> <hr width="100%">Special Methods of Extension Types
<hr width="100%"></h1>
This page describes the special methods currently supported by Pyrex extension
This page describes the special methods currently supported by Cython extension
types. A complete list of all the special methods appears in the table at
the bottom. Some of these methods behave differently from their Python counterparts
or have no direct Python counterparts, and require special mention.
......@@ -73,11 +73,11 @@ touch the object. In particular, don't call any other methods of the object
or do anything which might cause the object to be resurrected. It's best if
you stick to just deallocating C data. </p>
<p>You don't need to worry about deallocating Python attributes of your object,
because that will be done for you by Pyrex after your <tt>__dealloc__</tt>
because that will be done for you by Cython after your <tt>__dealloc__</tt>
method returns.<br>
<br>
<b>Note:</b> There is no <tt>__del__</tt> method for extension types. (Earlier
versions of the Pyrex documentation stated that there was, but this turned
versions of the Cython documentation stated that there was, but this turned
out to be incorrect.)<br>
</p>
<h2><font size="+1">Arithmetic methods</font></h2>
......
include MANIFEST.in README.txt INSTALL.txt CHANGES.txt ToDo.txt USAGE.txt
include setup.py
include bin/pyrexc
include pyrexc.py
include Pyrex/Compiler/Lexicon.pickle
include bin/cython
include cython.py
include Cython/Compiler/Lexicon.pickle
include Doc/*
include Demos/*
VERSION = 0.9.4.1
VERSION = 0.9.6
version:
@echo "Setting version to $(VERSION)"
@echo "version = '$(VERSION)'" > Pyrex/Compiler/Version.py
#check_contents:
# @if [ ! -d Pyrex/Distutils ]; then \
# echo Pyrex/Distutils missing; \
# exit 1; \
# fi
@echo "version = '$(VERSION)'" > Cython/Compiler/Version.py
clean:
@echo Cleaning Source
......
Welcome to Cython!
=================
Cython (http://www.cython.org) is based on Pyrex, but
supports more cutting edge functionality and optimizations.
Cython (http://www.cython.org) is based on Pyrex, but supports more
cutting edge functionality and optimizations.
LICENSE:
......@@ -14,17 +14,24 @@ below). Cython itself is licensed under the
--------------------------
There are TWO mercurial (hg) repositories included with Cython:
--------------------------
* Various project files, documentation, etc. (in the top level directory)
* The main codebase itself (in Cython/)
We keep these separate for easier merging with the Pyrex project.
To see the change history, go to the Pyrex directory and type
To see the change history for Cython code itself, go to the Cython
directory and type
$ hg log
This requires that you have installed Mercurial.
-- William Stein (wstein@gmail.com)
-- William Stein (wstein@gmail.com)
xxxx
......
-- The Original Pyrex Todo List --
DONE - Pointer-to-function types.
DONE - Nested declarators.
......
Pyrex - Usage Instructions
Cython - Usage Instructions
==========================
Building Pyrex extensions using distutils
Building Cython extensions using distutils
-----------------------------------------
Pyrex comes with an experimental distutils extension for compiling
Pyrex modules, contributed by Graham Fawcett of the University of
Cython comes with an experimental distutils extension for compiling
Cython modules, contributed by Graham Fawcett of the University of
Windsor (fawcett@uwindsor.ca).
The Demos directory contains a setup.py file demonstrating its use. To
......@@ -30,17 +30,17 @@ Try out the extensions with:
python run_numeric_demo.py
Building Pyrex extensions by hand
Building Cython extensions by hand
---------------------------------
You can also invoke the Pyrex compiler on its own to translate a .pyx
You can also invoke the Cython compiler on its own to translate a .pyx
file to a .c file. On Unix,
pyrexc filename.pyx
cython filename.pyx
On other platforms,
python pyrexc.py filename.pyx
python cython.py filename.pyx
It's then up to you to compile and link the .c file using whatever
procedure is appropriate for your platform. The file
......@@ -51,19 +51,25 @@ one particular Unix system.
Command line options
--------------------
The pyrexc command supports the following options:
The cython command supports the following options:
Short Long Argument Description
-----------------------------------------------------------------------------
-v --version Display version number of pyrex compiler
-v --version Display version number of cython compiler
-l --create-listing Write error messages to a .lis file
-I --include-dir <directory> Search for include files in named
directory (may be repeated)
directory (may be repeated)
-o --output-file <filename> Specify name of generated C file (only
one source file allowed if this is used)
one source file allowed if this is used)
-p, --embed-positions If specified, the positions in Cython files of each
function definition is embedded in its docstring.
-z, --pre-import <module> If specified, assume undeclared names in this
module. Emulates the behavior of putting
"from <module> import *" at the top of the file.
Anything else is taken as the name of a Pyrex source file and compiled
to a C source file. Multiple Pyrex source files can be specified
Anything else is taken as the name of a Cython source file and compiled
to a C source file. Multiple Cython source files can be specified
(unless -o is used), in which case each source file is treated as the
source of a distinct extension module and compiled separately to
produce its own C file.
#
# Pyrex -- Main Program, generic
# Cython -- Main Program, generic
#
from Pyrex.Compiler.Main import main
from Cython.Compiler.Main import main
main(command_line = 1)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment