[Python] What is the correct way of specifying the license in pyproject.toml file for a new...

Discussão em 'Python' iniciado por Stack, Fevereiro 3, 2025.

  1. Stack

    Stack Membro Participativo

    I am facing an error with the license specification when trying to build and upload a python package.

    I have the last version of wheel, setuptools, twine, and build.

    building fails if I specify the license according to the python packaging tutorial: https://packaging.python.org/en/latest/tutorials/packaging-projects/

    if I do not specify the license then twine upload fails with the error:

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


    the same upload error occurs if I build with the following:

    [project.license]
    file = "LICENSE"


    or

    license = {text = "MIT"}


    or

    license = {file = "LICENSE"}


    this is my full configuration file:

    [build-system]
    requires = ["setuptools"]
    build-backend = "setuptools.build_meta"

    [project]
    name = "name"
    version = "0.0.1"
    authors = [
    { name="Your Name", email="your.email@example.com" },
    ]
    description = "A python package"
    readme = "README.md"
    requires-python = ">=3.8"

    classifiers = [
    "Programming Language :: Python :: 3",
    "Operating System :: OS Independent",
    ]

    dependencies = [
    "requests",
    "numpy",
    ]

    Continue reading...

Compartilhe esta Página