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

Build python wheels and upload to pypi #371

Merged
merged 9 commits into from
Sep 5, 2024

Conversation

ermakov-oleg
Copy link
Contributor

@ermakov-oleg ermakov-oleg commented Aug 6, 2024

Hi @chdsbd,

I have started working on issue #261 and have successfully built Python packages for macOS, Windows, and Linux (x86_64).

However, I’m encountering issues building libpg_query-sys for Linux aarch64. Could you please assist me with this?

Thanks!

Copy link

netlify bot commented Aug 6, 2024

👷 Deploy request for squawkhq pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 169331f

@ermakov-oleg ermakov-oleg force-pushed the upload-to-pypi branch 14 times, most recently from 42cbc91 to 7e6c42a Compare August 6, 2024 12:49
@ermakov-oleg ermakov-oleg force-pushed the upload-to-pypi branch 9 times, most recently from 7f8c91c to 2bbfd13 Compare August 6, 2024 15:12
@ermakov-oleg
Copy link
Contributor Author

Hi @ods,

I came across your repository where you are already building Python packages: squawk-cli-python-package. Thank you for your work on this!

What do you think about moving the build process to this repository, publishing it to your PyPI squawk-cli, and transferring the rights to @sbdchd and @chdsbd?

@ods
Copy link
Contributor

ods commented Aug 6, 2024

Hi @ermakov-oleg,

What do you think about moving the build process to this repository, publishing it to your PyPI squawk-cli, and transferring the rights to @sbdchd and @chdsbd?

It would be the best option!

@ermakov-oleg
Copy link
Contributor Author

Hi @ermakov-oleg,

What do you think about moving the build process to this repository, publishing it to your PyPI squawk-cli, and transferring the rights to @sbdchd and @chdsbd?

It would be the best option!

Great!

Now we just need to figure out the build process for the Linux aarch64 package.

@ermakov-oleg ermakov-oleg force-pushed the upload-to-pypi branch 2 times, most recently from 867700b to 8ecbb5f Compare August 6, 2024 16:12
@ermakov-oleg
Copy link
Contributor Author

@ermakov-oleg How do you handle libpg_query FFI dependency when cross-compiling?

I’m not very experienced in this, but as far as I understand, when selecting a target different from the current system, the entire necessary toolchain for the specific platform is downloaded, and bindgen sets the sysroot path to the header files of that platform from this toolchain

@ermakov-oleg
Copy link
Contributor Author

A cold build under QEMU takes about 40 minutes, and with caching (sccache), around 20 minutes.

I had to update the Rust version to start using the sparse index in Cargo, otherwise, the crates.io index update would hang indefinitely.

@ods
Copy link
Contributor

ods commented Aug 10, 2024

I’m not very experienced in this, but as far as I understand, when selecting a target different from the current system, the entire necessary toolchain for the specific platform is downloaded, and bindgen sets the sysroot path to the header files of that platform from this toolchain

I'm neither experienced. What I saw so far, this works perfectly for pure rust code, but not for FFI. Also, I saw maturin docs suggest to use zig for cross-compilation in such cases.

@ermakov-oleg
Copy link
Contributor Author

I’m not very experienced in this, but as far as I understand, when selecting a target different from the current system, the entire necessary toolchain for the specific platform is downloaded, and bindgen sets the sysroot path to the header files of that platform from this toolchain

I'm neither experienced. What I saw so far, this works perfectly for pure rust code, but not for FFI. Also, I saw maturin docs suggest to use zig for cross-compilation in such cases.

Thanks for the idea!
The libpg_query-sys library cross-compiles using Zig, but only with glibc version >= 2.38.
I’m currently trying to figure out how to provide Maturin with the appropriate glibc version.

@ermakov-oleg
Copy link
Contributor Author

@sbdchd I’ve finished building the Python wheels for all major platforms. Could you please review this PR?
Thank you in advance!

@ermakov-oleg
Copy link
Contributor Author

Hi @sbdchd and @chdsbd,

I hope you’re doing well! I just wanted to kindly check in on the status of this pull request. I’ve finished the work on building the Python wheels and would love to hear your thoughts on the feature. Do you think there might be some time in the near future for a code review?

Thank you in advance!

@sbdchd
Copy link
Owner

sbdchd commented Sep 3, 2024

Is the PR description still accurate, specifically:

However, I’m encountering issues building libpg_query-sys for Linux aarch64. Could you please assist me with this?

otherwise looks good, thank you for doing this, lot of hard work!!

@ermakov-oleg
Copy link
Contributor Author

Yes, I was able to resolve the issue with the aarch64 build. The package now builds correctly for all major platforms, including Linux aarch64. The description is outdated — everything is working fine now.

@sbdchd sbdchd added the automerge automerge with kodiak label Sep 5, 2024
@sbdchd sbdchd merged commit c140dfb into sbdchd:master Sep 5, 2024
19 checks passed
@ermakov-oleg
Copy link
Contributor Author

Hi! When is the release planned?
Do you need my help with uploading the package to PyPI or will you and @ods manage it yourselves?

@chdsbd
Copy link
Collaborator

chdsbd commented Sep 8, 2024

I'm pushed a new version but I think we need to figure out authentication

@chdsbd
Copy link
Collaborator

chdsbd commented Sep 8, 2024

@ods I think since you own squawk-cli, you'd need to either transfer the project, add @sbdchd and myself as collaborators, or configure https://docs.pypi.org/trusted-publishers/adding-a-publisher/ so we can publish via OpenID Connect

@ods
Copy link
Contributor

ods commented Sep 9, 2024

Hi @chdsbd, is chdsbd the correct user?

@ods
Copy link
Contributor

ods commented Sep 9, 2024

@ermakov-oleg, is ermakov the correct user? I'm planning to also add you as a maintainer, so that you can help with setting it up.

@ermakov-oleg
Copy link
Contributor Author

@ermakov-oleg, is ermakov the correct user? I'm planning to also add you as a maintainer, so that you can help with setting it up.

Yeah, it's me.

@chdsbd
Copy link
Collaborator

chdsbd commented Sep 10, 2024

@ods I use cdignam on PyPi

@ods
Copy link
Contributor

ods commented Sep 11, 2024

@ods I use cdignam on PyPi

Added. Feel free removing me after successful publishing.

@chdsbd
Copy link
Collaborator

chdsbd commented Sep 14, 2024

I finally got publishing working, so 1.2.0 is on pypi

@ods
Copy link
Contributor

ods commented Sep 15, 2024

Excellent! Is there a change this way of installation being mentioned in the docs?

@chdsbd
Copy link
Collaborator

chdsbd commented Sep 21, 2024

Hey @ods, I updated the readme to mention you can install squawk via pip:

squawk/README.md

Lines 19 to 21 in 013a414

# or via PYPI
pip install squawk-cli

@ermakov-oleg ermakov-oleg deleted the upload-to-pypi branch October 1, 2024 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge automerge with kodiak
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants