Conversation
The deploy job in publish.yml uploaded metaflow-stubs to PyPI before metaflow. Because metaflow-stubs pins its dependency exactly (install_requires=["metaflow==<version>"] in stubs/setup.py, where the version matches the release), publishing the stubs first leaves metaflow-stubs==<version> on the index while metaflow==<version> does not yet exist, so pip cannot resolve it. If the later metaflow upload fails, that state is permanent: PyPI does not allow re-uploading the same file, so a retried release fails on the already-published stubs. Swap the two publish steps so the depended-upon package (metaflow) is published before the dependent package (metaflow-stubs). Signed-off-by: Anas Khan <83116240+anxkhn@users.noreply.github.com>
Contributor
Greptile SummaryThis PR changes the release publish order for the Python packages.
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (1): Last reviewed commit: "ci: publish metaflow before metaflow-stu..." | Re-trigger Greptile |
Author
|
@saikonen when you have a chance, could you please take a look at this pr and let me know if any update is needed? |
Shriprasad-P
left a comment
There was a problem hiding this comment.
Review
PR: ci: publish metaflow before metaflow-stubs on release
Touched: .github/workflows/publish.yml
- CI/tooling change — confirm the pipeline still passes on this branch.
- Size looks manageable (+2/-2).
Commenting as a drive-by reviewer after reading the diff. Happy to look again if maintainers want a deeper pass on a specific file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Type
On release,
publish.ymluploadedmetaflow-stubsto PyPI beforemetaflow.Because
metaflow-stubshard-pinsmetaflow==<same version>, publishing thestubs first leaves them briefly (and, if the
metaflowupload then fails,permanently) uninstallable. This swaps the two publish steps so
metaflowpublishes first.
Issue
Fixes #
Reproduction
Runtime: release workflow (GitHub Actions
deployjob in.github/workflows/publish.yml)This is a release-pipeline ordering defect, so the "reproduction" is the ordering
plus the version pin rather than a runnable local command; a live failure only
surfaces during an actual PyPI release.
Where evidence shows up: the
deployjob's publish steps / the resulting PyPI index state.The dependent package pins the dependency exactly:
Before this change the
deployjob published in this order:So immediately after the first step,
metaflow-stubs==Xis on PyPI whilemetaflow==Xis not, andpip install metaflow-stubs==Xcannot resolve itsmetaflow==Xdependency. If the second step (publishingmetaflow) fails for anyreason (a PyPI hiccup, a metadata rejection, a re-run where the file already
exists), the state is permanent: PyPI does not allow re-uploading the same file,
and
gh-action-pypi-publishdefaultsskip-existing: false, so a retried releasealso dies on the already-published stubs.
After this change:
The depended-upon package is on the index before the package that pins it, so the
metaflow-stubsdependency is always resolvable.Root Cause
The two PyPI publish steps in the
deployjob were ordered dependent-first: themetaflow-stubsupload ran before themetaflowupload, even thoughmetaflow-stubs'sinstall_requireshard-pins the exactmetaflowversion(
stubs/setup.py:45), which is not on the index until the later step completes.Why This Fix Is Correct
Standard practice is to publish a depended-upon distribution before any
distribution that pins it, so the dependency is resolvable the moment the
dependent package appears. Swapping the two steps restores that invariant with the
smallest possible change: only the order of the two existing
pypa/gh-action-pypi-publishsteps changes. Thepackages-dir: ./stubs/distsetting stays attached to the
metaflow-stubsstep, and the action version pinsare untouched.
Failure Modes Considered
metaflow-stubs==Xisorphaned with an unresolvable pin, and because PyPI blocks re-uploading the same
file (
skip-existingdefaults to false), the release cannot be cleanly retried.After: if the second upload (
metaflow-stubs) fails,metaflow==Xis alreadypublished and installable on its own; only the stubs are missing, which is the
less harmful ordering.
with: packages-dir. Verified thepackages-dir: ./stubs/distblock stays under themetaflow-stubsstep and themetaflowstep keeps nopackages-dir(it uploads the root-built dist),confirmed by parsing the job with
yaml.safe_load.Tests
No unit test applies to a release-workflow ordering change (the repo has no test
that executes
publish.yml, and the effect only manifests during a real PyPIrelease). Validation:
pre-commit run --files .github/workflows/publish.ymlpasses(check-yaml, end-of-file, trailing-whitespace, mixed-line-ending, detect-private-key
all Passed), and the post-swap step order was confirmed by parsing the
deployjob.Non-Goals
skip-existing: trueto the publish steps. That would make re-runsidempotent and is arguably a good follow-up, but it changes publish semantics and
is out of scope for this ordering fix. Kept the diff to the two-line reorder.
metaflow-stubsversion pin instubs/setup.py, the action SHApins, or any other step.
AI Tool Usage
An AI coding assistant helped locate the ordering defect and draft this PR text. I
reviewed and understand every line: the change is a two-line reorder of the two
existing
pypa/gh-action-pypi-publishsteps in.github/workflows/publish.ymlsothe
metaflowpackage publishes before themetaflow-stubspackage that pins it.I validated it with
pre-commitand by re-parsing the resulting workflow.