Skip to content

Conversation

jmgate
Copy link
Collaborator

@jmgate jmgate commented Jul 16, 2025

Type: Bug

Description

The PyPI upload failed with:

Checking dist/reverse_argparse-2.0.8-py3-none-any.whl: PASSED
Checking dist/multiple.intoto.jsonl: ERROR    InvalidDistribution:
Unknown distribution format:
         'multiple.intoto.jsonl'

I suppose the provenance can't be included in the dist directory for the PyPI upload, but it needs to be in there for python-semantic-release publish to GitHub Releases action. This commit reorders things, such that we publish to GitHub first, and save PyPI for last, and between the two we remove the provenance from the dist directory. Hopefully this works.

Related Issues/PRs

Problems created in #315 and #316.

Summary by Sourcery

Reorder the GitHub Actions release workflow to publish to GitHub Releases first, remove the provenance file from the distribution, and then publish to PyPI to prevent invalid distribution errors

Bug Fixes:

  • Remove provenance file before PyPI upload to fix invalid distribution error

CI:

  • Reorder semantic-release.yml to publish to GitHub Releases prior to PyPI
  • Add a step to remove the provenance file from dist before the PyPI publish

@jmgate jmgate self-assigned this Jul 16, 2025
Copy link

sourcery-ai bot commented Jul 16, 2025

Reviewer's Guide

The workflow adjustment in semantic-release.yml reorders the publish sequence to first publish to GitHub Releases, then removes the provenance file from dist, and finally pushes the package to PyPI, ensuring the provenance artifact isn’t included in the PyPI distribution.

Flow diagram for new release publishing order

flowchart TD
    Start([Start]) --> Build[Build dist/ with provenance]
    Build --> GHRelease[Publish to GitHub Releases]
    GHRelease --> RemoveProvenance[Remove provenance file from dist/]
    RemoveProvenance --> PyPI[Publish to PyPI]
    PyPI --> End([End])
Loading

File-Level Changes

Change Details Files
Reorder publishing steps to run PyPI upload last
  • Removed the original PyPI publish step before GitHub Releases
  • Re-inserted the PyPI publish step after the provenance removal stage
.github/workflows/semantic-release.yml
Ensure provenance file is excluded from PyPI upload
  • Added a new ‘Remove Provenance for PyPI Upload’ step running rm dist/${{ needs.provenance.outputs.provenance-name }}
.github/workflows/semantic-release.yml

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @jmgate - I've reviewed your changes - here's some feedback:

  • Use rm -f or add a check to avoid failing the workflow if the provenance file isn’t present when you try to remove it.
  • Consider adding a brief inline comment explaining why you’re reordering the publish steps and removing the provenance before PyPI upload.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Use `rm -f` or add a check to avoid failing the workflow if the provenance file isn’t present when you try to remove it.
- Consider adding a brief inline comment explaining why you’re reordering the publish steps and removing the provenance before PyPI upload.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link

codecov bot commented Jul 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.97%. Comparing base (27cb67b) to head (9c718b6).
Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #317   +/-   ##
=======================================
  Coverage   93.97%   93.97%           
=======================================
  Files           2        2           
  Lines         166      166           
  Branches       37       37           
=======================================
  Hits          156      156           
  Misses          4        4           
  Partials        6        6           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

The PyPI upload failed with:

    Checking dist/reverse_argparse-2.0.8-py3-none-any.whl: PASSED
    Checking dist/multiple.intoto.jsonl: ERROR    InvalidDistribution:
    Unknown distribution format:
             'multiple.intoto.jsonl'

I suppose the provenance can't be included in the `dist` directory for
the PyPI upload, but it needs to be in there for python-semantic-release
publish to GitHub Releases action.  This commit reorders things, such
that we publish to GitHub first, and save PyPI for last, and between the
two we remove the provenance from the `dist` directory.  Hopefully this
works.
@jmgate jmgate merged commit 50eb83f into master Jul 16, 2025
14 checks passed
@jmgate jmgate deleted the slsa-attempt-3 branch July 16, 2025 19:40
@jmgate jmgate mentioned this pull request Jul 16, 2025
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.

1 participant