3

Here is a simple Cython package:

foo/
    __init__.py # Contains:  from . import foo
    foo.pyx

I use waf (I know pyximport or setup.py can be used too) to build the Python extension from foo.pyx:

foo/
    __init__.py # Contains:  from . import foo
    foo.pyx

build/
    foo/
         foo.cpython-35m-x86_64-linux-gnu.so

I would like to import the foo package without installing it (development mode).

If the Python extension would be next to __init___ like this:

foo/
    __init__.py # Contains:  from . import foo
    foo.cpython-35m-x86_64-linux-gnu.so

it would work, but __init__.py is in the the source directory while the .so file is in the build directory.

I would like to avoid copying .so files in source directory.

A solution solution would be to copy (with waf) foo/__init__.py in build/foo/__init__.py, and import the foo package in build/.

Is there other alternatives?

Source code is here.

David Froger
  • 645
  • 6
  • 15

0 Answers0