gary thompson schrieb am 22.03.2015 um 23:10:
> I am having a problem with exporting a public api with the right package
> loading code
>
> specifically I have something like the following in setup.py
>
>
> ext_modules = [Extension("yy.xx", ['yy.xx.pyx'],
> define_macros = [('CPLUSPLUS', '1') ,
> ('USE_CDS_NAMESPACE', '1') ,
>
> ('OLD_ENSEMBLE_INTERFACE',old_ensemble_interface)],
>
> language="c++",
> extra_compile_args=extra_compile_args,
> extra_link_args=extra_link_args,
> include_dirs=include_dirs)]
>
> setup(
> package_dir = {'yy':''},
> ext_modules=cythonize(ext_modules[0:1]),
> cmdclass = {'build_ext': build_ext},
> )
>
>
> and
yy.xx.py has
>
> cdef public api double zz(object *self*, int i, ...):
>
> ..... some very interesting cython code
>
> now when I do the build everything cython goes in the right pace and looks
> good (ie we have a yy directory with an xx in it
>
> Howvere, now I expect to have a file called
>
> yy.xx_api.h but I am just getting a file called xx_api.h
That's how it currently works.
> furthermore inside I get
>
> import_xx()
>
> not
>
> import_yy__xx()
And that's, well, less intentional. ;)
The reason is (I think) that your module does not live in a package. If you
create a folder "yy" and a file "yy/__init__.py" and then move your code
file into that folder, it should work.
Stefan