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

Update PyPI Integrations for Release Upload #72

Merged
merged 3 commits into from
Apr 19, 2024

Conversation

JN-Hernandez
Copy link
Contributor

@JN-Hernandez JN-Hernandez commented Apr 15, 2024

Overview

The python-omgeo Python packages is published via the Azavea PyPI account, however recent builds of these projects are failing because PyPI has changed from username/password authentication to token based and trusted-publisher based authentication. This PR will address updating the integration.

Closes #71

Demo

The Problem:

Uploading python_omgeo-6.2.1-py3-none-any.whl
25l
  0% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0/47.7 kB • --:-- • ?
100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 47.7/47.7 kB • 00:00 • 145.3 MB/s
100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 47.7/47.7 kB • 00:00 • 145.3 MB/s
25hWARNING  Error during upload. Retry with the --verbose option for more details. 
ERROR    HTTPError: 403 Forbidden from https://upload.pypi.org/legacy/          
         Username/Password authentication is no longer supported. Migrate to API
         Tokens or Trusted Publishers instead. See                              
         https://pypi.org/help/#apitoken and                                    
         https://pypi.org/help/#trusted-publishers                              
Error: Process completed with exit code 1.

Proposed Solution:

      - name: Upload release to TestPyPI
        uses: pypa/gh-action-pypi-publish@release/v1

Notes

  • Prior to merging this PR, TestPyPI and PyPI were updated to add a new publisher, as outlined in the workplan on Issue Update PyPI Integration #71
  • After conducting a test upload to TestPyPI and confirming success, update the workflow.yml file by removing the with: clause from the Upload release to TestPyPI step and update the step name accordingly. This will switch the upload from TestPyPI to PyPI.

Testing Instructions

TestPyPI Testing - Manual Release:

Note

Example of successful manual test: GitHub Action Release #6
Note that upload was misspelled in this test run, it has since been corrected.

  • 1. Create a manual test release branch off this one titled release/test with the tags test, then push up
git checkout -b release/test
git tag test
git push --set-upstream origin release/test
git push --tags
  • 2. Review the GitHub Action generated to see if it completes successfully
  • 3. Remove the tags from origin and the local branch
git tag -d test
git push --delete origin test

Checklist

  • 1. CHANGES.txt has been updated
  • 2. After merging, ensure a release workflow has been conducted

@JN-Hernandez
Copy link
Contributor Author

CI fails a couple of tests:

test_impatiently_geocode_azavea (omgeo.tests.tests.GeocoderTest) ... ok

======================================================================
FAIL: test_geocode_esri_wgs_senado_mx (omgeo.tests.tests.GeocoderTest)
Attempt to geocode ``Paseo de la Reforma 135, Tabacalera,
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/python-omgeo/python-omgeo/omgeo/tests/tests.py", line 183, in test_geocode_esri_wgs_senado_mx
    self.assertEqual(search_text in candidates[0].match_addr, True,
AssertionError: False != True : "Paseo de la Reforma 135" not found in match_addr. Got "Paseo de La Reforma 135, Tabacalera, Ciudad de México, Cuauhtémoc, Ciudad de México, 06030".

======================================================================
FAIL: test_geocode_structured_esri_wgs_senado_mx (omgeo.tests.tests.GeocoderTest)
Attempt to geocode ``Paseo de la Reforma 135, Tabacalera,
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/python-omgeo/python-omgeo/omgeo/tests/tests.py", line 196, in test_geocode_structured_esri_wgs_senado_mx
    self.assertEqual(search_text in candidates[0].match_addr, True,
AssertionError: False != True : "Paseo de la Reforma 135" not found in match_addr. Got "Paseo de La Reforma 135, Tabacalera, Ciudad de México, Cuauhtémoc, Ciudad de México, 06030".

----------------------------------------------------------------------
Ran 53 tests in 5.887s

FAILED (failures=2, skipped=14)
Test failed: <unittest.runner.TextTestResult run=53 errors=0 failures=2>
error: Test failed: <unittest.runner.TextTestResult run=53 errors=0 failures=2>
Error: Process completed with exit code 1.

Uncertain if this is because the data being returned has changed or if a function isn't parsing out the data returned correctly. Additional investigation needed.

@JN-Hernandez
Copy link
Contributor Author

Confirmed with @rajadain that the data being returned changed for the affected tests and that we should simply update the tests to match expected return.

Copy link
Collaborator

@rajadain rajadain left a comment

Choose a reason for hiding this comment

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

Nice work! But we need to update the GitHub Actions to point to production PyPI before this can be merged.

.github/workflows/release.yml Outdated Show resolved Hide resolved
.github/workflows/release.yml Outdated Show resolved Hide resolved
Copy link
Collaborator

@rajadain rajadain left a comment

Choose a reason for hiding this comment

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

Looks good, nice work!

@JN-Hernandez JN-Hernandez merged commit 09d60fd into develop Apr 19, 2024
1 check passed
@JN-Hernandez JN-Hernandez deleted the jnh/update-pypi-publishing-integration branch April 19, 2024 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update PyPI Integration
2 participants