Skip to content

suteelng/python-semantic-release

 
 

Repository files navigation

Python Semantic Release

Test Status PyPI Version Read the Docs Status

Automatic semantic versioning for python projects. This is a python implementation of semantic-release for JS by Stephan Bönnemann. If you find this topic interesting you should check out his talk from JSConf Budapest.

The general idea is to be able to detect what the next version of the project should be based on the commits. This tool will use that to automate the whole release, upload to PyPI and post changelogs to GitHub. You can run the tool on a CI service, or just run it locally.

Install

pip install python-semantic-release

Configure

Set up Python Semantic Release using the configuration options shown on this page.

The only one which is required is version_variable, which tells the tool where to bump the version number:

[semantic_release]
version_variable = semantic_release/__init__.py:__version__

Run it

There are three different things you can do:

Command Description
version Create a new release. Will change the version, commit it and tag it.
publish Run version before pushing to git and uploading to PyPI.
changelog Generate the changelog for the next release.

Run these commands as semantic-release <command>.

Running from setup.py

Add the following hook to your setup.py and you will be able to run python setup.py <command> as you would semantic-release <command>.

try:
    from semantic_release import setup_hook
    setup_hook(sys.argv)
except ImportError:
    pass

Running on CI

Getting a fully automated setup with releases from CI can be helpful for some projects. It was the main motivation to create this tool.

See this documentation page for instructions.

About

Automatic semantic versioning for python projects

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 99.4%
  • Other 0.6%