Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cythonize/Cython compilation fails to import/recognize `.pxd` from external modules that only have `__init__.so` #2886

Open
JonasT opened this Issue Mar 4, 2019 · 3 comments

Comments

Projects
None yet
3 participants
@JonasT
Copy link

JonasT commented Mar 4, 2019

When trying to use a .pxd from an external module and making sure it can be found on sys.path, Cythonize/Cython compilation will still fail to pick it up if that module only has __init__.cpython-36m-x86_64-linux-gnu.so but no __init__.py (which it obviously couldn't have, given the __init__ part is already that C extension).

As soon as I do touch __init__.py in that folder it's all picked up fine, but of course that's not really a meaningful thing to do and renders the module broken, which I think I shouldn't have to do just so I can import .pxd files from it, should I?

So this looks a bit like a Cython bug to me, tested with Cython 0.29.6

@scoder

This comment has been minimized.

Copy link
Contributor

scoder commented Mar 4, 2019

PR welcome that extends the package check in Utils.is_package_dir() and adds a test for it.

@HSR05

This comment has been minimized.

Copy link

HSR05 commented Mar 12, 2019

@scoder I would like to work on it. Can you guide me a little. I will be more than thankful. 👍

@scoder

This comment has been minimized.

Copy link
Contributor

scoder commented Mar 13, 2019

Sure. Read the code in Cython.Utils.is_package_dir(), it checks for package files in the directories. As for a test, see tests/run/different_package_names.srctree. That's a text file containing multiple files, which the test runner extracts into a test directory. See https://github.com/cython/cython/wiki/HackerGuide#tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.