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

twine issue due to recent release of importlib-metadata #1180

Closed
geodab opened this issue Jun 28, 2024 · 4 comments · Fixed by #1199
Closed

twine issue due to recent release of importlib-metadata #1180

geodab opened this issue Jun 28, 2024 · 4 comments · Fixed by #1199

Comments

@geodab
Copy link

geodab commented Jun 28, 2024

Steps to Reproduce

It seems that a recent major release of importlib_metadata 8.0.0 removed deprecated support that twine 4.0.2 relies upon, which causes twine (and rye publish) to fail to run.

The simplest way to reproduce is to run ~/.rye/self/bin/twine --version.

The error can be fixed by either downgrading importlib_metadata to 7.2.1 or upgrading twine to 5.1.1, e.g., by running either ~/.rye/self/bin/pip install importlib_metadata==7.2.1 or ~/.rye/self/bin/pip install twine==5.1.1.

Additional details and explanation can be found at pypa/twine#1125 and abichinger/semantic-release-pypi#39.

Expected Result

Either:

$ ~/.rye/self/bin/twine --version
twine version 4.0.2 (importlib-metadata: 7.2.1, keyring: 25.2.1, pkginfo: 1.11.1, requests: 2.31.0, requests-toolbelt: 1.0.0,
urllib3: 2.0.7)

Or:

$ ~/.rye/self/bin/twine --version
twine version 5.1.1 (importlib-metadata: 8.0.0, keyring: 25.2.1, pkginfo: 1.10.0, requests: 2.31.0, requests-toolbelt: 1.0.0,
urllib3: 2.0.7)

Actual Result

$ ~/.rye/self/bin/twine --version
Traceback (most recent call last):
  File "/home/user/.rye/self/bin/twine", line 5, in <module>
    from twine.__main__ import main
  File "/home/user/.rye/self/lib/python3.12/site-packages/twine/__init__.py", line 43, in <module>
    __license__ = metadata["license"]
                  ~~~~~~~~^^^^^^^^^^^
  File "/home/user/.rye/self/lib/python3.12/site-packages/importlib_metadata/_adapters.py", line 54, in __getitem__
    raise KeyError(item)
KeyError: 'license

Version Info

$ rye --version
rye 0.35.0
commit: 0.35.0 (a1dbc56d4 2024-06-24)
platform: linux (x86_64)
self-python: [email protected]
symlink support: true
uv enabled: true

Stacktrace

No response

@zanieb
Copy link
Member

zanieb commented Jun 29, 2024

Thanks for the clear report! Sounds like

twine==4.0.2
should be bumped?

@avigailmo
Copy link

Thanks for the clear report! Sounds like

twine==4.0.2

should be bumped?

what the way to bump twine version in rye project?

@golgor
Copy link

golgor commented Jul 1, 2024

I can confirm that the fix from @geodab works. My Github actions failed due this bug, but I was able to publish my package locally from my machine.

@golgor
Copy link

golgor commented Jul 4, 2024

If anyone are having issues in their Github actions when publishing packages using Rye, I added an additional step that patches Rye with the update Twine and it works fine for me. Consider this is temporary patch though. It uses the environmental variable from setup-rye.

      - name: Set up Rye
        uses: eifinger/setup-rye@v3

      - name: Patch Rye
        run: |
          echo "Patching Rye with Twine 5.1.1"
          $RYE_HOME/self/bin/pip install twine==5.1.1

floherent added a commit to Coherent-Partners/spark-python-sdk that referenced this issue Aug 6, 2024
It seems that a recent major release of importlib_metadata 8.0.0 removed deprecated support that twine 4.0.2 relies upon, which causes twine (and rye publish) to fail to run.

See astral-sh/rye#1180 for more details
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 a pull request may close this issue.

4 participants