本文共 3918 字,大约阅读时间需要 13 分钟。
python pypi库
I’ve just finished the first release of pypi-publisher (ppp), a library for simple command line publishing of python libraries. You can grab the source or an install here:
我刚刚完成了pypi-publisher(ppp)的第一个发行版,这是一个用于python库的简单命令行发布的库。 您可以在此处获取源代码或安装:
In , I’ve shown how with a cookiecutter framework and some fast typing, you can release a package to pypi in pretty much no time at all. In it’s current state, ppp can cut down on that slightly. But as it grows to support more distribution types and more robust linting it will really cut down on the boring parts of releasing python code. Today it handles 4 main tasks:
在 ,我已经展示了如何使用cookiecutter框架和一些快速输入,您几乎可以立即将包发布到pypi。 在当前状态下,ppp可以稍微降低一点。 但是随着它逐渐支持更多的分发类型和更健壮的lint,它将真正减少发布python代码的无聊部分。 今天,它处理4个主要任务:
The first release targets support for sdist (source distributions), but later releases will support wheels and other packaging options.
第一个发行版支持sdist(源分发版),但后来的发行版将支持wheel和其他打包选项。
To install use pip:
要安装,请使用pip:
pip install pypi-publisher
Then to use just:
然后只使用:
ppp publish [-options]
Available options are:
可用的选项有:
To go into a little more detail of those 4 tasks mentioned above:
要详细介绍上述4个任务:
If you already have a .pypi file at ~ on the box, then you can just pass -s to reference a server in that. If you pass -s and -u, -p, and/or -i for a server that is in the file already, the parameters passed will be upserted into that file. If you pass -s, -u, -p, and -i for a server that is not in the file, it will be inserted as a new server.
如果框上的〜处已经有一个.pypi文件,则只需传递-s即可引用其中的服务器。 如果为文件中已存在的服务器传递-s和-u,-p和/或-i,则传递的参数将被升序到该文件中。 如果为不在文件中的服务器传递-s,-u,-p和-i,则它将作为新服务器插入。
A few examples:
一些例子:
To use an existing server
使用现有服务器
ppp publish -s=foo
To update some values (username and index url) for an existing server
为现有服务器更新某些值(用户名和索引URL)
ppp publish -s=foo -u=bar -i=baz
To create a whole new server in the file:
要在文件中创建一个全新的服务器:
ppp publish -s=foo -u=bar -p=baz -i=bat
Currently, the linting is very basic, and is just checking that a few files actually exist (manifest.in, setup.py and setup.cfg). This happens in all runs, regardless of flags passed.
当前,棉绒是非常基本的,仅检查实际存在的几个文件(manifest.in,setup.py和setup.cfg)。 无论是否传递标志,所有运行都会发生这种情况。
If you pass the -t flag, ppp will try to find the version number in the setup.py file and push a tag with the version to git. The search looks for any line (case insensitive) that starts with version or version, and takes it’s value, so
如果传递-t标志,则ppp会尝试在setup.py文件中查找版本号,并将带有该版本的标签推送到git。 搜索将查找以version或version开头的任何行(不区分大小写),并采用其值,因此
__version__ = '1.0.0'
or
要么
VERSION = '1.0.0'
Would both work perfectly. It’s worth noting that if you push tags on the initial publishing to a test server, you won’t need to push the same tag again for the following publishing to the prod server.
两者都能完美地工作。 值得注意的是,如果您将初始发布中的标签推送到测试服务器,则无需再将同一标签推送到随后的发布到产品服务器。
Currently, this only supports sdist uploads, in the future we plan to add more sophisticated packaging functionality, like wheels.
目前,此功能仅支持sdist上传,将来我们计划添加更复杂的打包功能,例如wheel。
If you’d like to help development or have any feedback, let me know, and if you run into any issues with ppp please open up a ticket on github and I’ll look into it.
如果您想帮助开发或有任何反馈,请告诉我,如果您遇到ppp的任何问题,请在github上打开票证,我将进行调查。
翻译自:
python pypi库
转载地址:http://twhwd.baihongyu.com/