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

adding abi3-py38 compatibility for python wheel #6

Merged
merged 2 commits into from
Jan 31, 2025
Merged

adding abi3-py38 compatibility for python wheel #6

merged 2 commits into from
Jan 31, 2025

Conversation

luccabb
Copy link
Member

@luccabb luccabb commented Jan 30, 2025

Summary

This PR relies on abi3 to build a python module that can be used on multiple python versions. Before this PR, gni's python module was only compatible with the exact python version it was compiled against.

whats abi3?

PEP 384 defines a limited python API with a stable ABI (aka abi3), this limited ABI works across multiple python versions.

Test Plan

Before

build on py310 env:

$ python -c 'import sys; print(sys.version_info[:])'
(3, 10, 12, 'final', 0)
$ maturin build --release --features=python
…
📦 Built wheel for CPython 3.10 to /path/to/310.whl

install on py39 env:

$ python -c 'import sys; print(sys.version_info[:])'
(3, 9, 17, 'final', 0)
$ pip install /path/to/310.whl
...
ERROR: 310.whl is not a supported wheel on this platform.

After

build on py310 env:

$ python -c 'import sys; print(sys.version_info[:])'
(3, 10, 12, 'final', 0)
$ maturin build --release --features=python
…
📦 Built wheel for CPython 3.10 to /path/to/310.whl

install on py39 env:

$ python -c 'import sys; print(sys.version_info[:])'
(3, 9, 17, 'final', 0)
$ pip install /path/to/310.whl
…
$ python -c 'import gni_lib; print(gni_lib.get_gpu_node_id())'
<id>

@@ -17,7 +17,7 @@ version = "0.1.2"
dependencies = ["cffi"]
readme = "src/python/README.md"
description = "Library to create a GPU Node ID"
requires-python = ">=3.10"
requires-python = ">=3.8"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you want to downgrade here?
The default version in fbcode is 3.10 https://fburl.com/wiki/7q6e07my

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as a result of "abi3-py38" it should be compatible with any version >= python 3.8. so removed the artificial restriction on pyproject.toml

@luccabb luccabb merged commit 7d1a92c into main Jan 31, 2025
11 checks passed
@luccabb luccabb deleted the abi3 branch January 31, 2025 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants