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

gradio cc publish to twine broken on python 3.9 #7721

Closed
1 task done
duerrsimon opened this issue Mar 16, 2024 · 3 comments · Fixed by #8040
Closed
1 task done

gradio cc publish to twine broken on python 3.9 #7721

duerrsimon opened this issue Mar 16, 2024 · 3 comments · Fixed by #8040
Assignees
Labels
bug Something isn't working custom-components Related to custom component cli or workflow

Comments

@duerrsimon
Copy link
Contributor

Describe the bug

gradio cc publish fails on Python 3.9 with the following error:

 Uploading distributions to https://upload.pypi.org/legacy/
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /home/duerr/miniconda3/envs/gradio_customcomponents/lib/python3.9/site-packages/gradio/cli/comma │
│ nds/components/publish.py:196 in _publish                                                        │
│                                                                                                  │
│   193 │   │   │   │   if (not max_version or max_version in p.name)                              │
│   194 │   │   │   ]                                                                              │
│   195 │   │   │   print(f"Uploading files: {','.join(twine_files)}")                             │
│ ❱ 196 │   │   │   twine_upload(twine_settings, twine_files)                                      │
│   197 │   │   except Exception:                                                                  │
│   198 │   │   │   console.print_exception()                                                      │
│   199 │   if upload_demo and not demo_dir:                                                       │
│                                                                                                  │
│ /home/duerr/miniconda3/envs/gradio_customcomponents/lib/python3.9/site-packages/twine/commands/u │
│ pload.py:123 in upload                                                                           │
│                                                                                                  │
│   120 │   repository_url = cast(str, upload_settings.repository_config["repository"])            │
│   121 │   print(f"Uploading distributions to {repository_url}")                                  │
│   122 │                                                                                          │
│ ❱ 123 │   packages_to_upload = [                                                                 │
│   124 │   │   _make_package(filename, signatures, upload_settings) for filename in uploads       │
│   125 │   ]                                                                                      │
│   126                                                                                            │
│                                                                                                  │
│ /home/duerr/miniconda3/envs/gradio_customcomponents/lib/python3.9/site-packages/twine/commands/u │
│ pload.py:124 in <listcomp>                                                                       │
│                                                                                                  │
│   121 │   print(f"Uploading distributions to {repository_url}")                                  │
│   122 │                                                                                          │
│   123 │   packages_to_upload = [                                                                 │
│ ❱ 124 │   │   _make_package(filename, signatures, upload_settings) for filename in uploads       │
│   125 │   ]                                                                                      │
│   126 │                                                                                          │
│   127 │   repository = upload_settings.create_repository()                                       │
│                                                                                                  │
│ /home/duerr/miniconda3/envs/gradio_customcomponents/lib/python3.9/site-packages/twine/commands/u │
│ pload.py:77 in _make_package                                                                     │
│                                                                                                  │
│    74 │   filename: str, signatures: Dict[str, str], upload_settings: settings.Settings          │
│    75 ) -> package_file.PackageFile:                                                             │
│    76 │   """Create and sign a package, based off of filename, signatures and settings."""       │
│ ❱  77 │   package = package_file.PackageFile.from_filename(filename, upload_settings.comment)    │
│    78 │                                                                                          │
│    79 │   signed_name = package.signed_basefilename                                              │
│    80 │   if signed_name in signatures:                                                          │
│                                                                                                  │
│ /home/duerr/miniconda3/envs/gradio_customcomponents/lib/python3.9/site-packages/twine/package.py │
│ :117 in from_filename                                                                            │
│                                                                                                  │
│   114 │   │   ]                                                                                  │
│   115 │   │   if missing_fields:                                                                 │
│   116 │   │   │   supported_metadata = list(pkginfo.distribution.HEADER_ATTRS)                   │
│ ❱ 117 │   │   │   raise exceptions.InvalidDistribution(                                          │
│   118 │   │   │   │   "Metadata is missing required fields: "                                    │
│   119 │   │   │   │   f"{', '.join(missing_fields)}.\n"                                          │
│   120 │   │   │   │   "Make sure the distribution includes the files where those fields "        │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
InvalidDistribution: Metadata is missing required fields: Name, Version.
Make sure the distribution includes the files where those fields are specified, and is using a supported Metadata-Version: 1.0, 
1.1, 1.2, 2.0, 2.1, 2.2.

Have you searched existing issues? 🔎

  • I have searched and found no existing issues

Reproduction

See above, the exact same package can be published after upgrading to python 3.10

Screenshot

No response

Logs

No response

System Info

python 3.9, gradio 4.21.0

Severity

I can work around it

@duerrsimon duerrsimon added the bug Something isn't working label Mar 16, 2024
@abidlabs abidlabs added the custom-components Related to custom component cli or workflow label Mar 18, 2024
@freddyaboulton
Copy link
Collaborator

Thanks will take a look! What version of twine are you using @duerrsimon ?

@freddyaboulton freddyaboulton self-assigned this Mar 18, 2024
@duerrsimon
Copy link
Contributor Author

It works with

twine version 5.0.0 (importlib-metadata: 7.0.2, keyring: 24.3.1, pkginfo:
1.10.0, requests: 2.31.0, requests-toolbelt: 1.0.0, urllib3: 2.2.1)

I believe the twine version before was 4.0.2. This is the only twine I could find in dist-info in my lib/python3.9/site-packages

@freddyaboulton
Copy link
Collaborator

This is a bug with twine: pypa/twine#1070. same thing happened last night during the gradio release.

twine does not set a required version of pkginfo, so when hatch updated, twine didn't know how to read the metadata.

I don't think there's much we can do beyond raising an error in gradio. Will look into that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working custom-components Related to custom component cli or workflow
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants