Skip to content

ERROR InvalidDistribution: Invalid distribution metadata: unrecognized or malformed field 'license-file' #923

Open

Description

@igorpompeo

Is there an existing issue for this?

  • I have searched the existing issues (open and closed), and could not find an existing issue

What keywords did you use to search existing issues?

No response

What operating system are you using?

Linux

If you selected 'Other', describe your Operating System here

No response

What version of Python are you running?

Python 3.12.3

How did you install twine? Did you use your operating system's package manager or pip or something else?

pip install twine

What version of twine do you have installed (include the complete output)

twine version 6.1.0 (keyring: 25.6.0, packaging: 25.0, requests: 2.32.3, requests-toolbelt: 1.0.0, urllib3: 2.4.0, id: 1.5.0)

Which package repository are you using?

https://pypi.org/manage/project/meu-pacote-python/collaboration/

Please describe the issue that you are experiencing

ERROR InvalidDistribution: Invalid distribution metadata: unrecognized or malformed field 'license-file'

Please list the steps required to reproduce this behaviour

Run 'twine upload dist/*'

Anything else you'd like to mention?

Sorry guys for bother y'all, but is the thing.
I'm studying python (with dummy exercises) and decide to bring a poor DevOps to my repository.
I'm using the pyproject.toml and the twine.
Mine code inside those are here: pyproject.toml
I tried another forum but I didn't get what is wrong with my codes, so if you could, check my repo, and give me some help to resolve that.

Activity

  1. woodruffw commented on May 7, 2025

    @woodruffw
    Member

    Hi @igorpompeo, thanks for filing an issue.

    To clarify: can you share the entire error message? Are you seeing that error from twine itself, or as a spit-out from PyPI?

    (This should be fixed with packaging 25.0, which your twine metadata suggests you're using.)

  2. igorpompeo commented on May 7, 2025

    @igorpompeo
    Author

    @woodruffw hello, thank you for the speed.
    For sure, this is the message of error

    Checking dist/meu_pacote_python-1.0.9-py3-none-any.whl: ERROR    InvalidDistribution: Invalid distribution metadata: unrecognized or    
             malformed field 'license-file'
    

    This error appears to me at the verify file step at my CD

  3. woodruffw commented on May 8, 2025

    @woodruffw
    Member

    Okay, thank you. Could you share that .whl file, as well as the output you see when you run pip list?

  4. igorpompeo commented on May 8, 2025

    @igorpompeo
    Author

    Okay, thank you. Could you share that .whl file, as well as the output you see when you run pip list?

    Sorry my delay.
    Here is the .whl if isn't this, let me know please.
    I really appreciated your help.

  5. sigmavirus24 commented on May 8, 2025

    @sigmavirus24
    Member

    @woodruffw does this belong here or in packaging problems?

  6. igorpompeo commented on May 8, 2025

    @igorpompeo
    Author

    @woodruffw does this belong here or in packaging problems?

    My packaging are at version 25.0, I had checked. Sorry for intruding

  7. woodruffw commented on May 8, 2025

    @woodruffw
    Member

    Hmm, I can't reproduce this: I extracted the METADATA file from that .whl, and it parses fine:

    uv run --with packaging python

    then:

    >>> from packaging.metadata import Metadata
    >>> email = open("./METADATA").read()
    >>> meta = Metadata.from_email(email)
    >>> meta.license_files
    ['LICENSE']

    @igorpompeo can you please provide your full pip list output? I strongly suspect you're running into some kind of mixed environment problem.

    (Per @sigmavirus24's point, this is probably best suited for general triage in packaging-problems, so I'll migrate there.)

  8. transferred this issue frompypa/twineon May 8, 2025
  9. igorpompeo commented on May 8, 2025

    @igorpompeo
    Author

    Hmm, I can't reproduce this: I extracted the METADATA file from that .whl, and it parses fine:

    uv run --with packaging python

    then:

    from packaging.metadata import Metadata
    email = open("./METADATA").read()
    meta = Metadata.from_email(email)
    meta.license_files
    ['LICENSE']

    @igorpompeo can you please provide your full pip list output? I strongly suspect you're running into some kind of mixed environment problem.

    (Per @sigmavirus24's point, this is probably best suited for general triage in packaging-problems, so I'll migrate there.)

    Hello,

    Here is.

    Package            Version
    ------------------ -----------
    black              25.1.0
    build              1.2.2.post1
    certifi            2025.4.26
    cfgv               3.4.0
    charset-normalizer 3.4.2
    click              8.1.8
    colorama           0.4.6
    distlib            0.3.9
    docutils           0.21.2
    emoji              2.14.1
    filelock           3.18.0
    flake8             7.2.0
    id                 1.5.0
    identify           2.6.10
    idna               3.10
    jaraco.classes     3.4.0
    jaraco.context     6.0.1
    jaraco.functools   4.1.0
    keyring            25.6.0
    markdown-it-py     3.0.0
    mccabe             0.7.0
    mdurl              0.1.2
    more-itertools     10.7.0
    mypy_extensions    1.1.0
    nh3                0.2.21
    nodeenv            1.9.1
    packaging          25.0
    pathspec           0.12.1
    pip                25.1
    platformdirs       4.3.7
    pre_commit         4.2.0
    pycodestyle        2.13.0
    pyflakes           3.3.2
    pygame             2.6.1
    Pygments           2.19.1
    pyproject_hooks    1.2.0
    pywin32-ctypes     0.2.3
    PyYAML             6.0.2
    readme_renderer    44.0
    requests           2.32.3
    requests-toolbelt  1.0.0
    rfc3986            2.0.0
    rich               14.0.0
    setuptools         80.3.1
    twine              6.1.0
    urllib3            2.4.0
    virtualenv         20.31.0
    wheel              0.45.1
    

    And I'm using venv environment, I don't know if this is some important to say.

  10. woodruffw commented on May 8, 2025

    @woodruffw
    Member

    Thanks, I'll be able to triage this more tonight.

    And I'm using venv environment, I don't know if this is some important to say.

    Yes, that's helpful context, thanks! That's the right thing to be doing.

  11. igorpompeo commented on May 8, 2025

    @igorpompeo
    Author

    Thanks, I'll be able to triage this more tonight.

    And I'm using venv environment, I don't know if this is some important to say.

    Yes, that's helpful context, thanks! That's the right thing to be doing.

    Sorry about that, I'm new in all of this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions