www.csse.canterbury.ac.nz Open in urlscan Pro
132.181.17.3  Public Scan

Submitted URL: http://www.csse.canterbury.ac.nz//greg.ewing//python//Pyrex//
Effective URL: https://www.csse.canterbury.ac.nz//greg.ewing//python//Pyrex//
Submission: On October 12 via api from US — Scanned from NZ

Form analysis 0 forms found in the DOM

Text Content

PYREX - A LANGUAGE FOR WRITING PYTHON EXTENSION MODULES





BRIEF DESCRIPTION

Pyrex lets you write code that mixes Python and C data types any way you want,
and compiles it into a C extension for Python.



--------------------------------------------------------------------------------


DOCUMENTATION


> ABOUT PYREX
> 
> 
> LANGUAGE OVERVIEW
> 
> 
> FAQ


CONTRIBUTED BY USERS


Quick Guide to Pyrex

Contributed by Michael JasonSmith.
If the above link doesn't work, there is a copy here.

Embedding Pyrex

Using Pyrex to write stand-alone programs that embed a Python interpreter.
Contributed by David McNab.

C++ Wrapping Tutorial

Contributed by David McNab. Warning: This page is really for Cython and mentions
some Cython features that Pyrex doesn't have. Some of what it says is also
obsoleted by recently-added C++ features in Pyrex.



--------------------------------------------------------------------------------


DOWNLOAD


> PYREX COMPILER AND DOCUMENTATION

> > Pyrex-0.9.9.tar.gz (255272 bytes, 2010-04-12)
> 
> 
> TEST SUITE AND TESTING FRAMEWORK
> 
> > Pyrex-Tests-0.9.9.tar.gz (447472 bytes, 2010-04-12)
> 
> Note: Currently the testing framework will only work out of the box on MacOS X
> or Linux, but should be adaptable to other unices with a little work.
> 
> 
> 
> RELEASE NOTES FOR VERSION 0.9.9
> 
> 
> CHANGES


MERCURIAL REPOSITORY AND UPDATES


PREVIOUS RELEASES

Pyrex requires Python 2.3 or later, both to run the Pyrex compiler and to use
the generated extension modules.

--------------------------------------------------------------------------------


NEWS


VERSION 0.9.9

Some features for interfacing with C++ code have been introduced, a few things
have been changed, and some bugs have been fixed. See the Release Notes and
CHANGES for details.


OLD NEWS

--------------------------------------------------------------------------------


PATCHES

WARNING: I have not reviewed or tested these patches - use them at your own
risk.


Sam Rushing has submitted a patch to Pyrex 0.9.3.1 which adds some conditional
compilation facilities.


Email message
rushing-2006-03-29.tar.gz



--------------------------------------------------------------------------------


OLD PATCHES

Lenard Lindstrom contributed some patches to Pyrex 0.9.3.1 to improve the C++
compatibility of the generated code. Since 0.9.4 these should no longer be
necessary.


lindstrom-2005-10-14.tar.gz
lindstrom-2005-11-01.tar.gz --- readme



--------------------------------------------------------------------------------


PACKAGES

These packages are maintained by others, so they may not be up to date with the
latest version.


RedHat/Fedora


Pyrex-0.9.3.1-1.noarch.rpm
Pyrex-0.9.3.1-1.src.rpm

Contributed by Giovanni Bajo


Fedora Core 1
Fedora Core 2

Contributed by Jan Ondrej


Windows


Windows

Contributed by Samuel Thibault




--------------------------------------------------------------------------------


RELATED TOOLS

pyrexdoc

Generate HTML documentation from a compiled Pyrex module, by David McNab


Pyrex Builder X

A mini-IDE for building Pyrex projects on MacOSX, by Nik Molnar.



--------------------------------------------------------------------------------


MAILING LIST

You are invited to subscribe to the Pyrex Mailing List for all Pyrex-related
discussions.

Thanks are due to Johannes Grødem of Copyleft Software for setting up and
hosting this list at the request of Joakim Ziegler.

Discussion of Pyrex is also welcome on the Python newsgroup, comp.lang.python.



IRC CHANNEL

irc.freenode.net #pyrex

I don't normally use IRC myself, but you may find someone there who's able to
help you.


--------------------------------------------------------------------------------


AUTHOR

> Greg Ewing (greg.ewing@canterbury.ac.nz )


EXAMPLE PYREX MODULES

--------------------------------------------------------------------------------

#
#  Calculate prime numbers
#

def primes(int kmax):
  cdef int n, k, i
  cdef int p[1000]
  result = []
  if kmax > 1000:
    kmax = 1000
  k = 0
  n = 2
  while k < kmax:
    i = 0
    while i < k and n % p[i] <> 0:
      i = i + 1
    if i == k:
      p[k] = n
      k = k + 1
      result.append(n)
    n = n + 1
  return result



--------------------------------------------------------------------------------

#
#  Defining an extension type
#

cdef class Spam:

  cdef int amount

  def __cinit__(self):
    self.amount = 0

  def get_amount(self):
    return self.amount

  def set_amount(self, new_amount):
    self.amount = new_amount

  def describe(self):
    print self.amount, "tons of spam!"





>