英文:
Fields are missing when I `pip show` my Python package
问题
I recently uploaded my first Python package to PyPI. The relevant parts of pyproject.toml
are defined as follows:
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
[project]
name = "jutility"
version = "0.0.4"
license = {text = "MIT License"}
authors = [
{name = "Jake Levi", email = "jakelevi@hotmail.co.uk"},
]
# ...
[project.urls]
homepage = "https://github.com/jakelevi1996/jutility"
After installing this package with the command python3 -m pip install -U jutility
, I run the command python3 -m pip show jutility
, and get the following output:
Name: jutility
Version: 0.0.4
Summary: Collection of Python utilities intended to be useful for machine learning research and experiments
Home-page:
Author:
Author-email: Jake Levi <jakelevi@hotmail.co.uk>
License: MIT License
Location: /usr/local/lib/python3.10/dist-packages
Requires: matplotlib, numpy, Pillow
Required-by:
Notably, the Home-page
and Author
fields are empty in the output from pip show
, although they seem to be defined in pyproject.toml
.
How should I change pyproject.toml
to make these fields display properly in the pip show
output?
Version-wise, I built and uploaded these packages to PyPI on my Windows 10 PC with Python 3.7.6, but I also tried downloading and installing this package and displaying the pip show
output from a Google Colab notebook with Python 3.10.11. The package works completely as expected in the Colab notebook, but I get the same pip show
output with empty Home-page
and Author
fields. I'd just like to know what I need to change in order to get these fields to display properly.
英文:
I recently uploaded my first Python package to PyPI. The relevant parts of pyproject.toml
are defined as follows (full file available here):
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
[project]
name = "jutility"
version = "0.0.4"
license = {text = "MIT License"}
authors = [
{name = "Jake Levi", email = "jakelevi@hotmail.co.uk"},
]
# ...
[project.urls]
homepage = "https://github.com/jakelevi1996/jutility"
After installing this package with the command python3 -m pip install -U jutility
, I run the command python3 -m pip show jutility
, and get the following output:
Name: jutility
Version: 0.0.4
Summary: Collection of Python utilities intended to be useful for machine learning research and experiments
Home-page:
Author:
Author-email: Jake Levi <jakelevi@hotmail.co.uk>
License: MIT License
Location: /usr/local/lib/python3.10/dist-packages
Requires: matplotlib, numpy, Pillow
Required-by:
Notably, the Home-page
and Author
fields are empty in the output from pip show
, although they seem to be defined in pyproject.toml
.
How should I change pyproject.toml
to make these fields display properly in the pip show
output?
Version-wise, I built and uploaded these packages to PyPI on my Windows 10 PC with Python 3.7.6, but I also tried downloading and installing this package and displaying the pip show
output from a Google Colab notebook with Python 3.10.11. The package works completely as expected in the Colab notebook, but I get the same pip show
output with empty Home-page
and Author
fields. I'd just like to know what I need to change in order to get these fields to display properly.
答案1
得分: 1
我通过删除pyproject.toml
的前三行来解决了这个问题,使pyproject.toml
看起来像这样:
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
然后,我在setup.cfg
中添加了以下配置(感谢@Ratul Hasan的建议):
[metadata]
name = jutility
version = 0.0.8
author = Jake Levi
author_email = jakelevi@hotmail.co.uk
description = Collection of Python utilities intended to be useful for machine learning research and experiments
long_description = file: README.md
long_description_content_type = text/markdown
license = MIT License
license_files = LICENSE
url = https://github.com/jakelevi1996/jutility
project_urls =
Documentation = https://github.com/jakelevi1996/jutility
Source Code = https://github.com/jakelevi1996/jutility
Bug Tracker = https://github.com/jakelevi1996/jutility/issues
[options]
python_requires = >=3.7
install_requires =
matplotlib>=3.5.3
numpy>=1.21.6
Pillow>=9.5.0
现在,我通过python3 -m pip show jutility
获得了以下输出,如期望:
Name: jutility
Version: 0.0.8
Summary: Collection of Python utilities intended to be useful for machine learning research and experiments
Home-page: https://github.com/jakelevi1996/jutility
Author: Jake Levi
Author-email: jakelevi@hotmail.co.uk
License: MIT License
Location: /usr/local/lib/python3.10/dist-packages
Requires: matplotlib, numpy, Pillow
Required-by:
有关setup.cfg
文件的更多信息,请参阅使用setup.cfg
文件配置setuptools。至于为什么在Packaging Python Projects教程中没有提到setup.cfg
文件,这是其他人的问题。
英文:
I fixed the issue by deleting all but the first 3 lines of pyproject.toml
, so that pyproject.toml
looks like this:
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
I then added the following configuration to setup.cfg
(thank you to @Ratul Hasan for the suggestion):
[metadata]
name = jutility
version = 0.0.8
author = Jake Levi
author_email = jakelevi@hotmail.co.uk
description = Collection of Python utilities intended to be useful for machine learning research and experiments
long_description = file: README.md
long_description_content_type = text/markdown
license = MIT License
license_files = LICENSE
url = https://github.com/jakelevi1996/jutility
project_urls =
Documentation = https://github.com/jakelevi1996/jutility
Source Code = https://github.com/jakelevi1996/jutility
Bug Tracker = https://github.com/jakelevi1996/jutility/issues
[options]
python_requires = >=3.7
install_requires =
matplotlib>=3.5.3
numpy>=1.21.6
Pillow>=9.5.0
I now get the following output from python3 -m pip show jutility
, as desired:
Name: jutility
Version: 0.0.8
Summary: Collection of Python utilities intended to be useful for machine learning research and experiments
Home-page: https://github.com/jakelevi1996/jutility
Author: Jake Levi
Author-email: jakelevi@hotmail.co.uk
License: MIT License
Location: /usr/local/lib/python3.10/dist-packages
Requires: matplotlib, numpy, Pillow
Required-by:
More information on setup.cfg
files is given on the page Configuring setuptools using setup.cfg
files. It remains to be seen why setup.cfg
files are not mentioned in the Packaging Python Projects tutorial, but this is a question for someone else.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论