admin管理员组文章数量:1313006
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: /
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="[email protected]" },
]
description = "A python package"
readme = "README.md"
requires-python = ">=3.8"
classifiers = [
"Programming Language :: Python :: 3",
"Operating System :: OS Independent",
]
dependencies = [
"requests",
"numpy",
]
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./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="[email protected]" },
]
description = "A python package"
readme = "README.md"
requires-python = ">=3.8"
classifiers = [
"Programming Language :: Python :: 3",
"Operating System :: OS Independent",
]
dependencies = [
"requests",
"numpy",
]
Share
Improve this question
edited Feb 3 at 9:20
phd
95.1k14 gold badges158 silver badges207 bronze badges
asked Feb 3 at 7:36
AmineTrabelsiAmineTrabelsi
459 bronze badges
2
|
2 Answers
Reset to default 4It seems to be a version issue as shown in this post: version issue with twine. Two main points of takeaway is to check your twine and pkginfo version. You can do this by python -m pip show <package name>
. Make sure that twine version is <= 6.0.1 ad pkginfo is the latest version 1.12.0.
You can do this for example if you are using a commonly known license
[project]
license = {text = "The Unlicense"}
or
[project]
license = {file = "licenses/license.txt"}
if you are having trouble with the path you can use this to set the package root
[tool.setuptools]
package-dir = { "" = "src" }
本文标签:
版权声明:本文标题:python - What is the correct way of specifying the license in pyproject.toml file for a new package? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741833423a2400070.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
[project]license = {file = "LICENSE"}
Found in stackoverflow/search?q=%5Bpyproject.toml%5D+license+file – phd Commented Feb 3 at 9:22