ReleaseRabbit
A little tool to make releasing new versions of open source Python projects easier.
In one simple command, ReleaseRabbit bumps version number in your project, pushes a github release, packs and uploads Python package to PyPI.
Usage
$ cd myproject
$ releaserabbit 1.2.3
# OR
$ releaserabbit patch
# OR
$ releaserabbit minor
# OR
$ releaserabbit major
Setup
-
pip install releaserabbit
. - Setup your pypi credentials in
~/.pypirc
. -
setup.py
must pull version name from a separate version file (see snippet below).VERSION_FILE
must be a constant in setup.py- Alternative:
VERSION
as a string constant insetup.py
if you can't (or don't want to) expose__version__
in your actual production python code.
- Alternative:
- Make sure you can push commits and tags to master.
Pulling version from a separate file
import io, re
VERSION_FILE = "cleancat/__init__.py"
with io.open(VERSION_FILE, "rt", encoding="utf8") as f:
version = re.search(r'__version__ = ([\'"])(.*?)\1', f.read()).group(2)