MaxHalford / vose

Cython implementation of Vose's Alias method
MIT License
5 stars 5 forks source link

pxd files not exposed with pip install #1

Closed gaspardbb closed 4 years ago

gaspardbb commented 4 years ago

Hi, First of all, thanks a lot for this implementation! Super clear and easy to use. I wanted to put it in a Cython framework. However, doing cimport vose failed after a pip install. I noticed that changing package_data={'*': ['*.pxd']}, to package_data={'vose': ['*.pxd']}, in the setup.py file made the cython import works after installing with pip. I've no experience with Cython yet, so maybe this is not the best fix!

Run with cython 0.29 and python 3.7.

MaxHalford commented 4 years ago

Hey! Thanks for the interest.

I don't have that much experience with Cython, to be honest. In particular, sharing code from one package to another seems to be shrouded in mystery!

If you want you can issue a pull request. This way there's a record that you're the one who proposed this change. If not I can perform the update myself :)

I suppose you tested this by cloning the code, making the change in setup.py, and running python setup.py install?

gaspardbb commented 4 years ago

I did exactly that! Could you reproduce the fix? I don't know if it's the right way to do (took it from: https://cython.readthedocs.io/en/latest/src/userguide/source_files_and_compilation.html so it should be ok), I'm pretty lost with Cython too! Anyway, it's pretty well coded for someone who does not know cython haha ;)

MaxHalford commented 4 years ago

Yep I just tried it and it works wonderfully! Thank you so much for your contribution. One of the goals of this little package is to be able to be reused in other Cython codebases, and you've just made that possible :)

gaspardbb commented 4 years ago

Perfect! Thank you for writing this package!!