PIP显示不显示要求

发布于 2025-02-04 04:38:43 字数 1589 浏览 2 评论 0 原文

当我在我的软件包上运行 pip show 命令 我得到以下内容。

D:\Python\Python\Classeviva>pip show classeviva.py
Name: Classeviva.py
Version: 0.1.1.post1
Summary: Classeviva Python API wrapper
Home-page: https://github.com/Lioydiano/Classeviva
Author: FLAK-ZOSO
Author-email: @gmail.com
License: 
Location: c:\users\...\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages
Requires: 
Required-by: 

特别是字段要求:是空的,尽管包含在 setup.py (url的当前版本)。

requires=["requests"]

一个>也是。在其中我也指定了许可,所以我不明白 pip 未在字段许可中显示它。

[build-system]
license = "MIT"
requires = ["setuptools>=42", "requests>=2.27.1"]
build-backend = "setuptools.build_meta"

编辑


这是 d:\\ python \ python \ classeviva 下的文件夹结构,可以在github上在存储库上找到,除 .gitignore .gitignore d d文件和文件夹。


​iguananaut ,通过 pip 使需求可见。

Requires: requests

When I run the pip show command on my package Classeviva.py I get the following.

D:\Python\Python\Classeviva>pip show classeviva.py
Name: Classeviva.py
Version: 0.1.1.post1
Summary: Classeviva Python API wrapper
Home-page: https://github.com/Lioydiano/Classeviva
Author: FLAK-ZOSO
Author-email: @gmail.com
License: 
Location: c:\users\...\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages
Requires: 
Required-by: 

In particular the field Requires: is empty, despite being included in setup.py (current version at url).

requires=["requests"]

And in pyproject.toml too. In it I specified license too, so I don't get why pip isn't showing it in the field license.

[build-system]
license = "MIT"
requires = ["setuptools>=42", "requests>=2.27.1"]
build-backend = "setuptools.build_meta"

Edit


This is the folder structure under D:\\Python\Python\Classeviva, it can be found on GitHub at the repository, except for .gitignored files and folders.

...

Edit (1)


Adding install_requires='requests>=2.27' as argument to the setuptools.setup call, as suggested below by Iguananaut, made the requirement visible via pip.

Requires: requests

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

从﹋此江山别 2025-02-11 04:38:43

使用 setup.py 文件几乎是弃用的(有利于static setup.cfg 文件)。更重要的是,需要= 关键字是较旧的distifact,在setuptools中根本没有真正使用。

您想要的是欺骗性的类似 install_requires ='请求> = 2.27'

putting quode> regigns = ['requests'] in pyproject.toml is ,除非您确切地知道自己在做什么,否则毫无用处。此需要是您项目的构建系统所需的内容,并且与项目的运行时要求无关。

欢迎来到任何令人困惑的Python包装世界。

Use of setup.py files are all but deprecated (in favor of static setup.cfg files). What's more, the requires= keyword is an even older artifact of distutils and is not really used at all in setuptools.

What you want here is the deceptively similar install_requires='requests>=2.27'

Putting requires=['requests'] in pyproject.toml is, unless you know exactly what you're doing, pretty useless. This requires is just what the build system for your project requires, and has no connection to the runtime requirements of your project.

Welcome to the not at all confusing world of Python packaging.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文