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

Allow optional compilation of C extensions #2330

Closed
2 tasks done
teknico opened this issue Apr 20, 2020 · 5 comments
Closed
2 tasks done

Allow optional compilation of C extensions #2330

teknico opened this issue Apr 20, 2020 · 5 comments
Labels
kind/feature Feature requests/implementations
Milestone

Comments

@teknico
Copy link

teknico commented Apr 20, 2020

  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have searched the documentation and believe that my question is not covered.

This issue is prompted by a suggestion:

I'd recommend creating a new issue detailing shortcomings of the current implementations with as much details as possible please.

Feature Request

This is in reference to issue #11. The tinydecred project uses Poetry, and we're trying to add a Cython-generated extension to speed up the code in one of the Python files, using the undocumented feature mentioned in issue #11.

Here's the build.py file we're using:

try:
    from Cython.Build import cythonize
except ImportError:
    def build(setup_kwargs):
        pass
else:
    def build(setup_kwargs):
        setup_kwargs.update(
            {"ext_modules": cythonize(["decred/crypto/secp256k1/field.py"])}
        )

A problem we have is that we'd like to ignore the error that happens if the developer does not have a C compiler installed and they execute the poetry install command (example).

(Ignoring such errors is the correct behavior in this case because the C extension is generated by Cython from a Python file and a matching .pxd file. If the compiled dynamic library is not there, the interpreter will just use the Python file.)

Thanks.

@teknico teknico added kind/feature Feature requests/implementations status/triage This issue needs to be triaged labels Apr 20, 2020
@abn
Copy link
Member

abn commented Apr 20, 2020

If this is the desired behaviour, wouldn't it be cleaner and more explicit to wrap the build step in a try catch within the build.py?

@teknico
Copy link
Author

teknico commented Apr 20, 2020

Indeed, and that's what we ended up doing.

Still a workaround though, so we'll be happy to eventually see official support of non-Python extensions in Poetry.

@abn
Copy link
Member

abn commented Apr 20, 2020

Fair enough. Within the frame of current implementation, I'd consider that the solution for now.

That said, we should consider this if we end up further integrating support for C extensions.

@Secrus
Copy link
Member

Secrus commented Jun 5, 2023

Closing as duplicate of #1351

@Secrus Secrus closed this as not planned Won't fix, can't repro, duplicate, stale Jun 5, 2023
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/feature Feature requests/implementations
Projects
None yet
Development

No branches or pull requests

4 participants