跳转到主要内容

用于构建和上传使用poetry的项目的辅助工具,带有预检查

项目描述

关于poetry-publish

用于构建和上传使用poetry的项目的辅助工具,带有预检查

  • 用户必须确认

    • 如果__version__包含‘dev’或‘rc’

    • 如果git仓库不在mainmaster

  • 如果git仓库包含更改则终止发布

  • 如果git仓库不是最新的则终止

  • 如果poetry check失败则终止

  • 如果twine check失败则终止

  • 如果git版本标签已存在则终止

在成功上传到PyPi后

  • 创建一个git版本标签

  • 将标签推送到远程服务器

兼容Python版本(见tox.ini.travis.yml

  • 3.10, 3.9, 3.8, 3.7, 3.6

  • PyPy3

Build Status on github

github.com/jedie/poetry-publish/actions

Build Status on travis-ci.org

travis-ci.org/jedie/poetry-publish

Coverage Status on codecov.io

codecov.io/gh/jedie/poetry-publish

Status on landscape.io

landscape.io/github/jedie/poetry-publish/master

PyPi version

pypi.org/project/poetry-publish/

示例

~/repos/python-creole$ poetry run publish

Check if we are on "master" branch:
    Call: 'git branch --no-color'
OK

Set version in "pyproject.toml" to: v1.4.3
    Call: 'poetry version 1.4.3'

Bumping version from 1.4.3 to 1.4.3

check if if git repro is clean:
    Call: 'git status --porcelain'
OK

Run "poetry check":
OK

check if pull is needed
    Call: 'git fetch --all'

Fordere an von origin
    Call: 'git log HEAD..origin/master --oneline'
OK
    Call: 'git push'

Everything up-to-date

Cleanup old builds:
    remove tree: /home/jens/repos/python-creole/dist

build but do not upload...
    Call: 'poetry build'
Build log file is here: 'publish.log'

check git tag
OK

Upload to PyPi via poetry:
    Call: 'poetry publish'


Publishing python-creole (1.4.3) to PyPI
 - Uploading python-creole-1.4.3.tar.gz 100%
 - Uploading python_creole-1.4.3-py3-none-any.whl 100%

git tag version
    Call: 'git tag v1.4.3'


git push tag to server
    Call: 'git push --tags'

Total 0 (delta 0), reused 0 (delta 0)
To github.com:jedie/python-creole.git
 * [new tag]         v1.4.3 -> v1.4.3

在项目中设置使用示例

在您的项目中创建一个发布钩子,例如创建your_project/publish.py,如下所示

from pathlib import Path

import your_project
from poetry_publish.publish import poetry_publish


def publish():
    poetry_publish(
        package_root=Path(your_project.__file__).parent.parent,
        version=your_project.__version__,
    )

将此内容添加到您的诗歌 pyproject.toml 中,例如:

[tool.poetry.scripts]
publish = 'your_project:publish'

要发布,请执行以下操作:

~$ cd your_project
~/your_project$ poetry run publish

注意:不要错过 run!它与 poetry publish 不同。

基于:https://github.com/jedie/python-code-snippets/blob/master/CodeSnippets/setup_publish.py

单元测试

# clone repository (or use your fork):
~$ git clone https://github.com/jedie/poetry-publish.git
~$ cd poetry-publish

# install or update poetry:
~/poetry-publish$ make install-poetry

# install poetry-publish via poetry:
~/poetry-publish$ make install

# Run pytest:
~/poetry-publish$ make pytest

# Run pytest via tox with all environments:
~/poetry-publish$ make tox

# Run pytest via tox with one Python version:
~/poetry-publish$ make tox-py38
~/poetry-publish$ make tox-py37
~/poetry-publish$ make tox-py36

make 目标

要查看所有 make 目标,只需调用 make

~/poetry-publish$ make
help                 List all commands
install-poetry       install or update poetry
install              install python-poetry_publish via poetry
update               Update the dependencies as according to the pyproject.toml file
lint                 Run code formatters and linter
fix-code-style       Fix code formatting
tox-listenvs         List all tox test environments
tox                  Run pytest via tox with all environments
tox-py36             Run pytest via tox with *python v3.6*
tox-py37             Run pytest via tox with *python v3.7*
tox-py38             Run pytest via tox with *python v3.8*
tox-py39             Run pytest via tox with *python v3.9*
pytest               Run pytest
update-rst-readme    update README.rst from README.creole
publish              Release new version to PyPi

历史记录

  • dev - compare v0.5.0…master

    • TBC

  • v0.5.0 - 2022-07-19 - compare v0.4.1…v0.5.0

    • 使用 Python 3.10 进行测试

    • 修复 twine 检查调用。

    • 修复 poetry publish 调用。

  • v0.4.1 - 2021-03-19 - compare v0.4.0…v0.4.1

    • 修复如果使用 git main 分支而不是 master 时的错误。

  • v0.4.0 - 2020-10-17 - compare v0.3.2…v0.4.0

    • 也调用 twine check dist/*.*

    • 对项目设置进行了一些元更新。

  • v0.3.2 - 2020-10-16 - compare v0.3.1…v0.3.2

    • 创建 git 注解标签而不是轻量级标签。 由 sebhmg 在 #9 贡献

    • python-creole 设为可选依赖项。基于 sebhmg 的贡献。

    • 允许 main 作为稳定分支,除了 master

    • 添加 make update

    • 更新 pytest.ini

    • 更改 pyproject.toml 中支持的 Python 版本

    • 也使用 Python 3.9 运行测试

  • v0.3.1 - 2020-02-19 - compare v0.3.0…v0.3.1

    • 更宽松的依赖项规范

    • 添加:poetry_publish.tests.test_project_setup.test_assert_rst_readme}

  • v0.3.0 - 2020-02-10 - compare v0.2.3…v0.3.0

    • poetry publish 错误 -> 回退并使用 twine

    • 使用 -vvv 调用 poetry publish

    • 使用 origin <current-branch> 调用 git push

    • 添加 isort 配置

  • v0.2.3 - 2020-02-02 - compare v0.2.2…v0.2.3

    • 使 poetry_publish.tests.test_project_setup 可用于外部包

  • v0.2.2 - 2020-02-01 - compare v0.2.1…v0.2.2

    • 修复 PyPi 上缺少项目描述的问题

  • v0.2.1 - 2020-02-01 - compare v0.2.0…v0.2.1

    • 在“branch is master”检查后调用“poetry version”

    • 添加许多测试

    • 也使用 PyPy v3 进行测试

    • 上传覆盖率报告

    • 修复代码风格

    • 更新 README

  • v0.2.0 - 2020-02-01 - compare 92e584…v0.2.0

第一个源代码编写于 27.11.2008: 论坛线程(德语)

捐赠


注意:此文件由 README.creole 生成于 2022-07-19 12:48:48,使用 "python-creole"

项目详情


下载文件

下载适用于您平台的文件。如果您不确定选择哪个,请了解有关 安装包 的更多信息。

源分发

poetry-publish-0.5.0.tar.gz (27.3 kB 查看哈希值)

上传时间

构建分发

poetry_publish-0.5.0-py3-none-any.whl (39.5 kB 查看哈希值)

上传时间 Python 3

支持者: