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

Python: Switch to maturin for all Python building/development #2345

Merged
merged 3 commits into from
Aug 11, 2023

Conversation

badboy
Copy link
Member

@badboy badboy commented Jan 23, 2023

(based on #2344)

After the recent universal2 wheel work I realized how messy our Python setup is:
A big home-grown solution inside a setup.py reinventing half of Python package management all over again.

There must be something better for it.
There is: maturin.

Tried and trusted in other projects, this tool can take care of most of the build and development hassles of a Python package with UniFFI bindings.


This PR switches our development tooling over to maturin, for both local development and on CI.
And while I was at it I also moved all Python tooling configuration into the one and only pyproject.toml.

This is not yet ready for merge, because:

  • Waiting on a release that will include Use the extension_name in develop builds PyO3/maturin#1416
    • CI is probably broken at the moment
  • UniFFI 0.23 (upcoming) will move things around, we probably want to have that first, then see how maturin needs to adopt that
  • Ensure the release tasks on CI work
  • Remove check requirements on GitHub for Python 3_6 tests, Python 3_6 tests minimum dependencies and Python 3_9 tests minimum dependencies as those tests are gone.

Copy link
Contributor

@perrymcmanis144 perrymcmanis144 left a comment

Choose a reason for hiding this comment

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

👍 yep, I like it a lot.

I especially like having a pyproject.toml

@badboy badboy marked this pull request as ready for review August 2, 2023 11:59
@badboy badboy requested a review from a team as a code owner August 2, 2023 11:59
@badboy badboy force-pushed the with-maturin branch 4 times, most recently from b4a3056 to 77db015 Compare August 8, 2023 12:20
maturin is a Python build tool (written in Rust),
that can robustly handle building Python packages with UniFFI bindings.

This gets rid of our highly custom `setup.py` setup,
streamlines development and building of the Python package
and ensures consistent generation of Wheel packages for release.

This also combines all Python configuration into a single place:
a top-level pyproject.toml
@badboy
Copy link
Member Author

badboy commented Aug 8, 2023

fwiw I pushed a locally-built package to pypi test here: https://test.pypi.org/project/glean-sdk/52.0.0/
then installed it manually (fetching dependencies from normal pypi though) and that all worked out just fine.

IMO this is good to go.

This breaks with the new setup.
We're down to only 2 direct dependencies. We're "fine" for now
@badboy badboy merged commit fa0390f into mozilla:main Aug 11, 2023
27 of 29 checks passed
@badboy badboy deleted the with-maturin branch August 11, 2023 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants