博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
python pypi库_Pypi-publisher:发布python库的简单CLI
阅读量:2519 次
发布时间:2019-05-11

本文共 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个主要任务:

  1. Update the .pypi file with potentially new servers or information
  2. Lint the candidate repository to make sure nothing critical is missing
  3. Create and push a tag to git for the release
  4. Register and publish the repository to a pypi server
  1. 使用潜在的新服务器或信息更新.pypi文件
  2. 整理候选存储库,以确保没有遗漏任何关键信息
  3. 创建并推送标签到git进行发布
  4. 注册存储库并将其发布到pypi服务器

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:

可用的选项有:

  • -u/–username
  • -p/–password
  • -i/–index-url
  • -s/–server-name
  • -d/–dry-run
  • -v/–verbose
  • -t/–create-tag
  • -u / –用户名
  • -p / –密码
  • -i / –index-url
  • -s / –服务器名称
  • -d / –空运行
  • -v /-详细
  • -t / –创建标签

To go into a little more detail of those 4 tasks mentioned above:

要详细介绍上述4个任务:

更新.pypi文件 (Updating .pypi file)

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

整理候选人资料库 (Linting the candidate repository)

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)。 无论是否传递标志,所有运行都会发生这种情况。

将标签推送到git (Pushing a tag to git)

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.

两者都能完美地工作。 值得注意的是,如果您将初始发布中的标签推送到测试服务器,则无需再将同一标签推送到随后的发布到产品服务器。

发布存储库 (Publishing the repository)

Currently, this only supports sdist uploads, in the future we plan to add more sophisticated packaging functionality, like wheels.

目前,此功能仅支持sdist上传,将来我们计划添加更复杂的打包功能,例如wheel。

贡献与问题 (Contributing and Issues)

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/

你可能感兴趣的文章
python自动化测试-D11-学习笔记之一(yaml文件,ddt)
查看>>
mysql存储过程使用游标循环插入数据
查看>>
Ubuntu 12.04 添加新用户并启用root登录
查看>>
初涉MySQL
查看>>
NSMutableURLRequest和NSURLConnection用Post方式上传照
查看>>
mean shift博客推荐
查看>>
App Naver Line 5.3 add new features - "True Delete"
查看>>
shell中$0,$?,$!等的特殊用法
查看>>
jsp的page指令的错误页面跳转
查看>>
android用户界面之GridView教程实例汇总
查看>>
夺命雷公狗----Git---7---GitHub当仓库本地使用(完)
查看>>
.NET/ASP.NET Routing路由(深入解析路由系统架构原理)http://wangqingpei557.blog.51cto.com/1009349/1312422...
查看>>
647. Palindromic Substrings 互文的子字符串
查看>>
[poj2096]Collecting Bugs[概率dp]
查看>>
Mongodb数据导出工具mongoexport和导入工具mongoimport介绍(转)
查看>>
图片和视频操作核心代码
查看>>
css实现简单几何图形
查看>>
asp.net 2.0中实现异步处理任务.
查看>>
Java Cryptography Extension (JCE): 放开Java加密算法密钥最大长度16的限制
查看>>
苹果一体机发射Wi-Fi
查看>>