为什么 PyPI 上不使用 setup.py 元数据?

发布于 2024-11-13 13:12:22 字数 663 浏览 3 评论 0原文

我在 PyPi 上发布了我的软件包的测试版。

setup.py 中的元信息(例如主页、类别等)出现在 项目的 PyPi 页面

后来我更新了项目。我在 setup.py 中唯一更改的是版本号。

更新一如既往,永远不要相信说这种话的人。我从 setuptools 改为 distutils! Cargo Cult 编程 - 我只是复制了另一个项目所做的事情。抱歉。

但是 项目的 PyPi 页面 中的下一个版本没有元信息。

我正在尝试弄清楚我是如何打破它的;我发现 PyPi 的正确性相当费力,所以我确信就是我。 这次,我在全新安装的 Windows 上使用了 Python 2.7.1(之前我使用的是 Python 2.6.x),

我几乎肯定使用了不同的命令行来上传它。 (这一次,似乎需要签名并安装 pgp,我不记得上次需要)。

我应该在哪里查看为什么 setup.py 文件中的元信息不再上传?

I had a beta-version of my package up on PyPi.

The meta-information (e.g. home page, categories, etc.) from setup.py appeared on the project's PyPi page.

Later, I updated the project. The only thing I changed in the setup.py was the version number.

Update: As always, never trust someone who says that. I changed from setuptools to distutils! Cargo Cult programming - I just copied what another project had done. Sorry.

But the next version in the project's PyPi page has no meta-information.

I am trying to work out how I broke it; I find PyPi rather taxing to get right, so I am sure it was me.
This time, I used Python 2.7.1 on a fairly fresh install of Windows (where previously I had used Python 2.6.x)

I almost certainly used a different command-line to upload it. (This time, it seemed to need signing and pgp installed, which I don't recall needing last time).

Where should I look to see why the meta-information in the setup.py file is no longer being uploaded?

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

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

发布评论

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

评论(2

心的位置 2024-11-20 13:12:22

在 setup.py 上运行以下命令应该可以解决该问题:

$ python setup.py register

理想情况下,您希望在上传的同时运行注册命令。在发布任何包时,我通常至少使用三个命令(sdist、register、upload)。以下将对 PyPI 进行典型发布:

$ python setup.py sdist register upload

本文的其余部分简要解释了这些命令的用途。

sdist 命令是构建源代码发行版的几个构建命令之一。由于您上传了 .zip 文件,因此您可能已经熟悉它了。类似的命令是bdist,它构建二进制发行版。

分发(或包)元数据与构建的分发分开发送。 setuptools 的 upload 命令将上传您的项目构建(例如 myproject-0.0.zip)。应使用 register 命令来更新元数据信息。 register 命令以 PyPI 可以理解的格式将 PKGINFO(或 Egg_info)发送到 PyPI。

Running the following command on your setup.py should correct the issue:

$ python setup.py register

Ideally, you would want to run the register command alongside the upload. I usually use a minimum of three commands when releasing any package (sdist, register, upload). The following will make a typical release to PyPI:

$ python setup.py sdist register upload

The rest of this post is a brief explanation of what these commands do.

The sdist command is one of a few build commands that will build a source distribution. You are likely familiar with it already since you have uploaded a .zip file. A similar command is bdist, which builds binary distributions.

The distribution (or package) metadata is sent separate from the built distribute. The setuptools' upload command will upload your project build(s) (e.g. myproject-0.0.zip). The register command should be used to update the metadata information. The register command sends the PKGINFO (or egg_info) to PyPI in a format that it understands.

不知在何时 2024-11-20 13:12:22

这很难回答。您能给我们您使用的命令行吗?你的 setup.py 使用 distutils 或 setuptools 吗?您在两次之间是否更改了 pydistutils.cfg 或 .pypirc 文件?

This is hard to answer. Can you give us the command lines you used? Does your setup.py use distutils or setuptools? Have you changed your pydistutils.cfg or .pypirc file between the two times?

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