Automating Python package release process

前端 未结 2 875
独厮守ぢ
独厮守ぢ 2021-02-01 22:00

I\'ve just started an open source Python project that I hope might be popular one day. At the moment to release a new version I have to do a few things.

  1. Test all t
2条回答
  •  心在旅途
    2021-02-01 22:19

    I automated this for one of my open-source tools. It‘s all in the file manage.py: https://github.com/tfeldmann/organize/blob/master/manage.py

    My project uses poetry for uploading to pypi, so this looks a bit different but should be a good starting point. It also manages the changelog and creates all releases.

    python manage.py version steps:

    • prompts for version number and checks validity
    • updates the __version__.py file
    • updates the pyproject.toml file used by poetry
    • searches for a section ## WIP in changelog.md and replaces it with current version and todays date.

    python manage.py publish steps:

    • reads the current version
    • reads the changes listed for this version from the changelog
    • creates a git tag
    • pushes to github (with tags)
    • builds and publishes to pypi
    • creates a github release with the version number as name and the changes from the changelog as description

    The scripts asks for confirmation for each step so things don't get out of hand and prompts for your github and pypi passwords as soon as they are needed.

提交回复
热议问题