-
Notifications
You must be signed in to change notification settings - Fork 340
Workflow to build python CLI artifacts (sdist + wheels) #3036
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
base: main
Are you sure you want to change the base?
Conversation
|
@HonahX very nice work. We are almost there to have package in PyPI. |
snazy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a particular reason to not extent the release-automation workflows?
We have to follow the ASF release policy. It seems there are some steps missing in this PR:
- checksums
- gpg signatures
- RC staging
- staging the source tarball and artifacts to vote on
- eventually publishing exactly the artifacts that have been voted on
|
Hi @snazy Thanks for highlighting these important elements of the final release candidate for python CLI. Given the number of missing pieces in the CLI release process, my goal is to separate the pipeline into 2 milestone:
This PR aims to focus on the first milestone in order to have additional CI to ensure that all changes are compatible with the release process and unblock nightly build. The signature/checksum/release candidate are goals in the second milestone. This way we could first determine what to release and start testing the artifacts and then finishing the rest part. WDYT? |
9247338 to
36a45e4
Compare
|
@HonahX is this PR a draft PR or not? The summary says yes, the PR status says no. |
|
Hi @snazy It's ready for review. I checked the current PR description and it does not seem to imply this as a draft. Could you please point me to the part of the summary that may lead to the wrong implication here? Just want to eliminate all potential confusion. |
snazy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR adds completely new release workflows for separate Python releases.
We already have release workflows in place, so I do not see a point having a separate set of workflows.
Technically it's missing a lot of the requirements for release artifacts for ASF projects and the ASF release process.
A huge amount of time and work already went into the existing release automation, because it is not an easy task to get it right.
|
Hi @snazy, I think there might be some confusion in the original PR summary and the workflow name. I should not put the "release" in the workflow title as the intention was not to make this a separate release procedure than the existing release automation. Ultimately, the python client release process should be part of the release automation. I've updated the PR to simplify the workflow file and updated the summary to clarify the intention. We will focus on build the right wheels and sdist and make nightly build working first. Sorry for any confusion above. Please take a look again and let me know WDYT! |
|
I can take another look, but due to time constraints likely not before next week. |
| uses: pypa/[email protected] | ||
| with: | ||
| output-dir: wheelhouse | ||
| package-dir: "./client/python" | ||
| config-file: "{package}/pyproject.toml" | ||
| env: | ||
| # Ignore 32 bit architectures | ||
| CIBW_ARCHS: "auto64" | ||
| CIBW_PROJECT_REQUIRES_PYTHON: ">=3.10,<3.14" | ||
| CIBW_REPAIR_WHEEL_COMMAND_MACOS: "" # Disable wheel repair since there will be no binary in the wheel | ||
| CIBW_REPAIR_WHEEL_COMMAND_LINUX: "" | ||
| CIBW_ENVIRONMENT: POLARIS_CLI_SKIP_CLIENT_GENERATION="true" # java is not available in linux containers during wheel build, skip client generation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious: does this command archive the same result?
run: |
make client-build FORMAT=wheel
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be mostly the same for MacOs/windows, but for linux it will help build both manylinux and musllinux wheel to have broad compatibility.
flyrain
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks @HonahX !
snazy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we do not need the overhead of CPython.
Without that, I suspect the Python package build can be moved into the Makefile and the calling workflows would just need to setup the necessary Python versions.
Then the existing nightly-build workflow can be extended with one job to setup Python, call that Makefile target and publish to test.pypi.org.
| make client-build FORMAT=sdist | ||
| - name: Build wheels | ||
| uses: pypa/[email protected] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actions in ASF workflows must reference the Git SHA of an ASF-approved version of the action, see this policy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The action docs mention that the wheels can contain libraries from the build container.
Which ones are included and what are the licenses for those libraries?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. We definitely should use the approved version here: https://github.com/apache/infrastructure-actions/blob/7a58482c11f14b79ea238d4a57093077cc18673c/approved_patterns.yml#L174C3-L174C61
The action docs mention that the wheels can contain libraries from the build container.
The dependencies may be brought by the wheel repair operation. In our case, we explicitly disabled the wheel repair:
CIBW_REPAIR_WHEEL_COMMAND_MACOS: ""
CIBW_REPAIR_WHEEL_COMMAND_LINUX: ""
so no additional dependencies will be brought in.
But based on other comments and discussion, cibuildwheel may not be the best way here, let me try another approach first
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switched to use make client-build FORMAT=wheel directly instead of cibuildwheel
| workflow_dispatch: | ||
| inputs: | ||
| version: | ||
| description: 'Version to set (optional, e.g. 1.1.0 or 1.1.0rc1 or dev-20251202-abc1234)' | ||
| type: string | ||
| required: false | ||
| workflow_call: | ||
| inputs: | ||
| version: | ||
| description: 'Version to set (optional)' | ||
| type: string | ||
| required: false | ||
| pull_request: | ||
| paths: | ||
| - '.github/workflows/python-client-build-artifacts.yml' | ||
| - 'client/python/**' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought this WF is just for nightly builds?
I'm confused about the need for a "version" input and that the WF is triggered by PRs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The version here is optional and used to set the package version here
- name: Set version (if provided)
if: inputs.version != ''
env:
VERSION: ${{ inputs.version }}
run: make client-set-version VERSION="${{ env.VERSION }}"
In the nightly build, we will need to determine a convention of the package version for nightly build, such as including commit hash/date to the package version, so we could have a better reference in test.pypi.org. But IMHO the details of the version we want to set to the package could be determined in the actual nightly build publication step. This workflow should focus on building all the wheels required, by default leave the package version unchanged and make it an option for any upstream caller to set the version as needed. WDYT?
| strategy: | ||
| matrix: | ||
| os: [ ubuntu-24.04, macos-14, macos-15] # current build script is not compatible with windows |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there anything that's performance critical in the Python package?
I'd prefer to not build native code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, ideally we only need a universal wheel since everything is pure python. However, since we need to leverage a custom build script to do open api client generation, poetry thinks it needs to generate platform-specific wheels. This is a known limitation and seems we have no native way to override this behavior now.
Should the situation changed in the future, we should definitely switch to universal wheel if possible.
| if [ -n "${{ inputs.version }}" ]; then | ||
| ARTIFACT_NAME="python-client-artifacts-${{ inputs.version }}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason for this special case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could make the output zip file name indicate that a custom version has been provided hence the built sdist and wheels will have its package version changed. Just for convenience.
abe51b0 to
2578b89
Compare
This PR include a github workflow, "Python Client Build Artifacts", to build wheels for multiple os/platform for nightly build and release automation in the future. It will produce a zip containing
contain sdist and wheels built for macos and linux (TODO: support windows)
The expected usage for this workflow is:
The build of a release candidate that include proper sig, checksum, is out-of-scope of this PR and should be included in follow-up PR for python client release automation
cc: @binarycat0 @MonkeyCanCode @flyrain @snazy
Checklist
CHANGELOG.md(if needed)site/content/in-dev/unreleased(if needed)