Eli
Eli

Reputation: 38989

Can I pip install a cython module and make its pxds available for cimport?

I'm trying to pip install a Cython library (https://github.com/kmike/marisa-trie/tree/master/src, for example) and then subclass it in Cython by cimporting from its pxds. Is there any way to make the related pxds from the library available to me so I can cimport from them? I've checked a bunch of related info in Cython docs like this, but all of it deals with the case where pxd files are available in relative folders and not pip installed somewhere.

Upvotes: 7

Views: 639

Answers (1)

jcdude
jcdude

Reputation: 3011

There is a "package_data" setting and associated settings you can add to setup.py, e.g.

setup(...,
      packages=['helpers']
      package_dir={'helpers': 'src/helpers'},
      package_data={'helpers': ['*.pxd']},
)

Check out: http://docs.cython.org/en/latest/src/userguide/sharing_declarations.html#search-paths-for-definition-files

and I've taken the example above from here: https://groups.google.com/forum/#!topic/cython-users/fYaqdkSfCI0

Upvotes: 1

Related Questions