543
543
extensions can be built, but if no C compiler is present, the pure python
544
544
versions we supply will work, though more slowly.
546
For developers we recommend that pyrex be installed, so that the C
546
For developers we recommend that Cython be installed, so that the C
547
547
extensions can be changed if needed.
549
549
For the C extensions, the extension module should always match the
550
550
original python one in all respects (modulo speed). This should be
551
551
maintained over time.
553
To create an extension, add rules to setup.py for building it with pyrex,
553
To create an extension, add rules to setup.py for building it with Cython ,
554
554
and with distutils. Now start with an empty .pyx file. At the top add
555
555
"include 'yourmodule.py'". This will import the contents of foo.py into this
556
556
file at build time - remember that only one module will be loaded at
557
557
runtime. Now you can subclass classes, or replace functions, and only your
558
558
changes need to be present in the .pyx file.
560
Note that pyrex does not support all 2.4 programming idioms, so some
561
syntax changes may be required. I.e.
563
- 'from foo import (bar, gam)' needs to change to not use the brackets.
564
- 'import foo.bar as bar' needs to be 'import foo.bar; bar = foo.bar'
566
If the changes are too dramatic, consider
567
maintaining the python code twice - once in the .pyx, and once in the .py,
568
and no longer including the .py file.
571
560
Making Installers for OS Windows
572
561
================================
573
562
To build a win32 installer, see the instructions on the wiki page: