Skip to content

Latest commit

 

History

History
executable file
·
65 lines (49 loc) · 2.44 KB

File metadata and controls

executable file
·
65 lines (49 loc) · 2.44 KB

GitHub Workflow Fixes for PyPI Publishing

This document summarizes the changes made to fix the GitHub Actions workflow for PyPI publishing.

Issues Fixed

  1. Cache Implementation

    • Added proper caching for pip dependencies
    • Configured cache paths for requirements files
    • Implemented smart cache invalidation based on dependencies
  2. Attestation Improvements

    • Added verbose output and hash verification
    • Improved logging for package validation
    • Added security-related permissions
  3. Package Structure and Configuration

    • Fixed package discovery with proper setuptools configuration
    • Implemented dynamic dependencies via requirements.txt
    • Added proper keywords handling
    • Fixed licensing information
    • Enhanced version detection across both pyproject.toml and setup.py
  4. Workflow Reliability

    • Added package verification step before publishing
    • Improved error handling and reporting
    • Added version consistency check between pyproject.toml and setup.py
    • Enhanced trigger conditions to include setup.py changes

Python Packaging Best Practices

The changes align with Python packaging best practices:

  1. Using modern pyproject.toml for package configuration
  2. Dynamic dependency management with requirements.txt
  3. Proper package discovery with setuptools
  4. SPDX license identifiers instead of classifiers
  5. Comprehensive package metadata

Testing Your Workflow

To manually test the workflow:

  1. Go to the GitHub Actions tab for your repository
  2. Select the "Upload Python Package" workflow
  3. Click "Run workflow"
  4. You have two options:
    • Force Publish: Automatically enabled to run the workflow without requiring version changes
    • Version Override: Optionally provide a specific version number to use (will update both pyproject.toml and setup.py files)
  5. Click "Run workflow" and monitor the execution

The workflow will automatically:

  • Verify versions match between pyproject.toml and setup.py
  • Update version numbers if an override is provided
  • Build, validate, and publish the package
  • Generate a summary report with publishing details

Troubleshooting

If publishing still fails:

  1. Check PyPI configuration in your GitHub repository settings
  2. Verify trusted publisher configuration on PyPI
  3. Ensure proper GitHub Environments setup
  4. Validate PyPI project name matches the name in your configuration files