Skip to content

license in pyproject.toml is not following the PEP 621 #200

Closed

Description

@Bluefissure

Hi!

I'm getting the following error while trying to install the poetry==1.8.2 using pip 25.0.1, it looks that the license in pyproject.toml is not compatible with the PEP 621:

Collecting cffi>=1.14 (from cryptography>=2.0->SecretStorage>=3.2->keyring<25.0.0,>=24.0.0->poetry==1.8.2)
  Downloading #REDACTED#/pypi/simple/cffi/2.0.0/cffi-2.0.0.tar.gz
     - 523.6 kB 231.7 MB/s 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [87 lines of output]
      configuration error: `project.license` must be valid exactly by one definition (2 matches found):
      
          - keys:
              'file': {type: string}
            required: ['file']
          - keys:
              'text': {type: string}
            required: ['text']
      
      DESCRIPTION:
          `Project license <https://peps.python.org/pep-0621/#license>`_.
      
      GIVEN VALUE:
          "MIT"
      
      OFFENDING RULE: 'oneOf'
      
      DEFINITION:
          {
              "oneOf": [
                  {
                      "properties": {
                          "file": {
                              "type": "string",
                              "$$description": [
                                  "Relative path to the file (UTF-8) which contains the license for the",
                                  "project."
                              ]
                          }
                      },
                      "required": [
                          "file"
                      ]
                  },
                  {
                      "properties": {
                          "text": {
                              "type": "string",
                              "$$description": [
                                  "The license of the project whose meaning is that of the",
                                  "`License field from the core metadata",
                                  "<https://packaging.python.org/specifications/core-metadata/#license>`_."
                              ]
                          }
                      },
                      "required": [
                          "text"
                      ]
                  }
              ]
          }

I proposed #199 for making it compatible but am not quite sure whether it's the best way to resolve it

Activity

  1. EpicWink commented on Sep 11, 2025

    @EpicWink

    license being a (inline) table is deprecated, and should be a string (identifying the license). See:

    Try using Setuptools v77.0.3 or later. If your version of Python can't support that, try constraining cffi to below v2

  2. cclauss commented on Dec 1, 2025

    @cclauss
    Contributor

    Is this still a problem?

    % uvx --with=packaging validate-pyproject pyproject.toml # https://validate-pyproject.readthedocs.io

    Valid file: pyproject.toml
    

    @DimitriPapadopoulos

  3. DimitriPapadopoulos commented on Dec 1, 2025

    @DimitriPapadopoulos
    Contributor

    As explained in #200 (comment), PEP 621 has been superseded by PEP 639.

    Make sure that you use up-to-date build tools. From the Python Packaging User Guide:

    Ensure pip, setuptools, and wheel are up to date

    While pip alone is sufficient to install from pre-built binary archives, up to date copies of the setuptools and wheel projects are useful to ensure you can also install from source archives:

    python3 -m pip install --upgrade pip setuptools wheel
    

    You'll need poetry 2.2.0 for PEP 639 support.

  4. cclauss commented on Dec 1, 2025

    @cclauss
    Contributor

    @Bluefissure Should this issue be closed?

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions