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

Add first class support in PythonArtifact for Extension and ext_modules #7344

Open
Eric-Arellano opened this issue Mar 9, 2019 · 2 comments
Labels
backend: Python Python backend-related issues

Comments

@Eric-Arellano
Copy link
Contributor

In https://github.com/pantsbuild/pants/pull/7235/files#diff-3ce39309d74098493a1f3c8107292a8d, we realized we have to add ext_modules to the Pants PythonArtifact so that its ABI gets properly resolved.

However, we are doing this using the deprecated tuple syntax, rather than using the expected Extension interface. See https://docs.python.org/3/distutils/setupscript.html#describing-extension-modules for what this should look like.

--

To land this fix, we will need to add first class support in python_artifact.py for Extension and ext_modules.

cc @jsirois

@sureshjoshi
Copy link
Member

@Eric-Arellano Is this still an issue? I'm testing out adding 'mypyc' support and the easiest way is an extension module in setup.py of the python_distribution.

@Eric-Arellano
Copy link
Contributor Author

Yeah, we still do this:

# NB: by setting `ext_modules`, we signal to setup_py and bdist_wheel that this library
# has native code. As a consequence, bdist_wheel pins the ABI (application binary interface)
# used when creating the wheel, which is a good thing. We should be setting this ABI to ensure
# consumers of pantsbuild.pants are using a compatible interpreter.
# TODO(7344): the tuple syntax for ext_modules is deprecated. Use Extension once we support it.
ext_modules=[("native_engine", {"sources": ["pants/dummy.c"]})],

@cognifloyd cognifloyd added the backend: Python Python backend-related issues label Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend: Python Python backend-related issues
Projects
None yet
Development

No branches or pull requests

3 participants