gpt4 book ai didi

python - 如何将包裹发送到 PyPi?

转载 作者:太空狗 更新时间:2023-10-29 17:06:10 26 4
gpt4 key购买 nike

我写了一个小模块,我想知道打包它的基本步骤是什么,以便将它发送到 pypi :

  • 什么是文件层次结构?
  • 我应该如何命名文件?
  • 我应该使用 distutils 来创建 PKG-INFO 吗?
  • 我应该在哪里包含我的文档(用 sphinx 制作)?

最佳答案

我推荐阅读 The Hitchhiker's Guide to Packaging .具体来说,您应该查看 Quick Start section ,它描述了如何:

  1. Lay out your project
  2. Describe your project
  3. Create your first release
  4. Register your package with the Python Package Index (PyPI)
  5. Upload your release, then grab your towel and save the Universe!

您还应该查看 Current State of PackagingIntroduction to Packaging section ,因为这有助于解决围绕 setuptools、distutils、distutils2 和 distribute 的一些困惑。

更新回复:如何命名文件

以下摘录自PEP8 ,它回答了关于如何命名文件的问题:

Modules should have short, all-lowercase names. Underscores can be used in the module name if it improves readability. Python packages should also have short, all-lowercase names, although the use of underscores is discouraged.

Since module names are mapped to file names, and some file systems are case insensitive and truncate long names, it is important that module names be chosen to be fairly short -- this won't be a problem on Unix, but it may be a problem when the code is transported to older Mac or Windows versions, or DOS.

关于python - 如何将包裹发送到 PyPi?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3658084/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com