[Cython] 0.9.8.1.1 and .pxd files
Stefan Behnel
stefan_ml at behnel.de
Sun Aug 31 11:31:53 CEST 2008
Hi,
Lisandro Dalcin wrote:
> On Thu, Aug 28, 2008 at 7:05 PM, Jay Parlar <parlar at gmail.com> wrote:
>> This seems to have worked. Is there a difference between having a
>> __init__.pyx and just a regular __init__.py? I've got .py now, and it
>> seems to be working.
>
> AFAIK, there is no difference. However, if you 'install' your pxd's as
> package data, perhaps you will need to also install a __init__.pyx
> alongside the pxd's. For example, from one of my projects, pxd and C
> API (plus SWIG typemaps for my objects) are installed inside a
> 'include' dir (more or less as numpy does):
>
> $ tree ~/lib/python/mpi4py
> /u/dalcinl/lib/python/mpi4py
> |-- MPI.so
> |-- __init__.py
> |-- __init__.pyc
> |-- __init__.pyo
> |-- include
> | `-- mpi4py
> | |-- MPI.pxd
> | |-- __init__.pyx
> | |-- mpi.pxi
> | |-- mpi4py.h
> | |-- mpi4py.i
> | |-- mpi4py_MPI.h
> | |-- mpi4py_MPI_api.h
> | |-- mpi4py_MPI_api_fix.h
> | `-- mpi_c.pxd
> |-- rc.py
> |-- rc.pyc
> `-- rc.pyo
To clarify a bit, the only difference is that Cython knows both, but Python
only recognises __init__.py. So if you want to install a Cython package in a
place that Python does not recognise as package, __init__.pyx is a good way to
do so.
Stefan
More information about the Cython-dev
mailing list