Helper to build and upload a project that used poetry to PyPi, with prechecks
GPL-3.0 License
= About poetry-publish =
Helper to build and upload a project that used poetry to PyPi, with prechecks:
After a successful upload to PyPi:
Compatible Python Versions (see [[https://github.com/jedie/poetry-publish/blob/master/tox.ini|tox.ini]] or [[https://github.com/jedie/poetry-publish/blob/master/.travis.yml|.travis.yml]]):
| {{https://github.com/jedie/poetry-publish/workflows/test/badge.svg?branch=master|Build Status on github}} | [[https://github.com/jedie/poetry-publish/actions?query=workflow%3Atest|github.com/jedie/poetry-publish/actions]] | | {{https://travis-ci.org/jedie/poetry-publish.svg|Build Status on travis-ci.org}} | [[https://travis-ci.org/jedie/poetry-publish/|travis-ci.org/jedie/poetry-publish]] | | {{https://codecov.io/gh/jedie/poetry-publish/branch/master/graph/badge.svg|Coverage Status on codecov.io}} | [[https://codecov.io/gh/jedie/poetry-publish|codecov.io/gh/jedie/poetry-publish]] | | {{https://landscape.io/github/jedie/poetry-publish/master/landscape.svg|Status on landscape.io}} | [[https://landscape.io/github/jedie/poetry-publish/master|landscape.io/github/jedie/poetry-publish/master]] | | {{https://badge.fury.io/py/poetry-publish.svg|PyPi version}} | [[https://pypi.org/project/poetry-publish/|pypi.org/project/poetry-publish/]] |
== example ==
{{{ ~/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
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
== setup usage in projects ==
Create a publish hook in you project, e.g. create {{{your_project/publish.py}}} with: {{{ 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, ) }}}
Add this to your poetry {{{pyproject.toml}}}, e.g.: {{{ [tool.poetry.scripts] publish = 'your_project:publish' }}}
To publish do this: {{{ ~$ cd your_project ~/your_project$ poetry run publish }}}
Note: Don't miss the {{{run}}} ! It's not the same as {{{poetry publish}}}
based on: https://github.com/jedie/python-code-snippets/blob/master/CodeSnippets/setup_publish.py
== unittests ==
{{{
~$ git clone https://github.com/jedie/poetry-publish.git ~$ cd poetry-publish
~/poetry-publish$ make install-poetry
~/poetry-publish$ make install
~/poetry-publish$ make pytest
~/poetry-publish$ make tox
~/poetry-publish$ make tox-py38 ~/poetry-publish$ make tox-py37 ~/poetry-publish$ make tox-py36 }}}
== make targets ==
To see all make targets, just call {{{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 }}}
= history =
first source code was written 27.11.2008: [[http://www.python-forum.de/viewtopic.php?f=3&t=16742|Forum thread (de)]]
== Project links ==
| GitHub | [[https://github.com/jedie/poetry-publish/]] | PyPi | [[https://pypi.org/project/poetry-publish/]]
== donation