Skip to main content

Automatically create a PR, bump version (using Commitizen), approve and merge (suitable for CI/CD).

Project description

pumper

PyPI - Version PyPI - Python Version code style - black types - mypy imports - isort

Automagically ๐Ÿงšโ€โ™€๏ธ create branch, pull request, bump version (using Commitizen), approve and merge.


pumper helps create CI/CD bump version jobs more secure ๐Ÿ‘ฎโ€โ™€๏ธ.

Common version bump strategy these days is to have CI/CD workflow run automatic version bump directly in a main branch:

common-bump-strategy

This raises following concerns (among others) in highly secured environments:

  • direct push to a main branch required
  • branch protection rules needs to be relieved
  • change in main branch is not reviewed

Bump strategy with pumper:

pumper-strategy

  1. Call great tool Commitizen. It checks your commit history and bumps your version. Check it out for more information how to configure and use it.
  2. Create a branch including changes from above step a push it.
  3. Create PR.
  4. Optionally approve a merge PR.

Quick install guide

pumper can be installed from PYPI. It's recommended to install it in isolated Python environment using venv.

python -m venv .venv
.venv/bin/pip install pumper

How to use it

Using CLI

pump create

 Usage: pumper create [OPTIONS]

 Bump version, push branch and create pull request.

โ•ญโ”€ Options โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ *  --repo            TEXT  The owner and repository name, eg 'owner/repo'.     โ”‚
โ”‚                            [env var: GITHUB_REPOSITORY]                        โ”‚
โ”‚                            [default: None]                                     โ”‚
โ”‚                            [required]                                          โ”‚
โ”‚    --url             TEXT  Github API url.                                     โ”‚
โ”‚                            [env var: GITHUB_API_URL]                           โ”‚
โ”‚                            [default: https://api.github.com]                   โ”‚
โ”‚ *  --token           TEXT  Github token.   [env var: GITHUB_TOKEN]             โ”‚
โ”‚                            [default: None] [required]                          โ”‚
โ”‚    --base            TEXT  Base branch of a PR. [env var: BASE_BRANCH]         โ”‚
โ”‚                            [default: main]                                     โ”‚
โ”‚    --branch          TEXT  Branch name and PR title.                           โ”‚
โ”‚                            [default: release/{version}]                        โ”‚
โ”‚    --user            TEXT  Git user name. [default: github-actions[bot]]       โ”‚
โ”‚    --email           TEXT  Git user email.                                     โ”‚
โ”‚                            [default:                                           โ”‚
โ”‚                            github-actions[bot]@users.noreply.github.com]       โ”‚
โ”‚    --gh-env                Create 'PR_NUM' env var for GH actions              โ”‚
โ”‚    --label           TEXT  Add labels to PR. [default: None]                   โ”‚
โ”‚    --assign                Assign PR [default: True]                           โ”‚
โ”‚    --assignee        TEXT  PR assignee name. [env var: GITHUB_ACTOR]           โ”‚
โ”‚    --help                  Show this message and exit.                         โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

pumper approve

 Usage: pumper approve [OPTIONS] PR_NUM

 Approve pull request.

โ•ญโ”€ Arguments โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ *    pr_num      INTEGER  PR number. [env var: PR_NUM] [default: None]         โ”‚
โ”‚                           [required]                                           โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
โ•ญโ”€ Options โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ *  --repo         TEXT  The owner and repository name, eg 'owner/repo'.        โ”‚
โ”‚                         [env var: GITHUB_REPOSITORY]                           โ”‚
โ”‚                         [default: None]                                        โ”‚
โ”‚                         [required]                                             โ”‚
โ”‚    --url          TEXT  Github API url.                                        โ”‚
โ”‚                         [env var: GITHUB_API_URL]                              โ”‚
โ”‚                         [default: https://api.github.com]                      โ”‚
โ”‚ *  --token        TEXT  Github token. [env var: GITHUB_TOKEN] [default: None]  โ”‚
โ”‚                         [required]                                             โ”‚
โ”‚    --body         TEXT  PR message. [default: ๐Ÿค– Approved by GH actions!]      โ”‚
โ”‚    --help               Show this message and exit.                            โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

pumper merge

 Usage: pumper merge [OPTIONS] PR_NUM

 Merge pull request.

โ•ญโ”€ Arguments โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ *    pr_num      INTEGER  PR number. [env var: PR_NUM] [default: None]        โ”‚
โ”‚                           [required]                                          โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
โ•ญโ”€ Options โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚    --method        [merge|squash|rebase]  The merge method to use.            โ”‚
โ”‚                                           [default: merge]                    โ”‚
โ”‚ *  --repo          TEXT                   The owner and repository name, eg   โ”‚
โ”‚                                           'owner/repo'.                       โ”‚
โ”‚                                           [env var: GITHUB_REPOSITORY]        โ”‚
โ”‚                                           [default: None]                     โ”‚
โ”‚                                           [required]                          โ”‚
โ”‚    --url           TEXT                   Github API url.                     โ”‚
โ”‚                                           [env var: GITHUB_API_URL]           โ”‚
โ”‚                                           [default: https://api.github.com]   โ”‚
โ”‚ *  --token         TEXT                   Github token.                       โ”‚
โ”‚                                           [env var: GITHUB_TOKEN]             โ”‚
โ”‚                                           [default: None]                     โ”‚
โ”‚                                           [required]                          โ”‚
โ”‚    --help                                 Show this message and exit.         โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

Github actions

See my GH actions bumper.yaml workflow. Replace pip install . with pip install pumper==0.2.0 (line 31).

Required setup

Appreciation

Big thanks ๐Ÿ™ to following libraries:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pumper-0.2.0.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

pumper-0.2.0-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file pumper-0.2.0.tar.gz.

File metadata

  • Download URL: pumper-0.2.0.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.23.3

File hashes

Hashes for pumper-0.2.0.tar.gz
Algorithm Hash digest
SHA256 e849ce0b5657bbae8c250c12f6a3535265d973ddfd349afaeacc28a4a9cd0336
MD5 4f0658b3b7786847ac43f27ff244797b
BLAKE2b-256 f5c8785aec529fb69de489401bc02ce030f638e095c6758c248c8ea15323e049

See more details on using hashes here.

File details

Details for the file pumper-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pumper-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.23.3

File hashes

Hashes for pumper-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f7f21b5256621ee6852d8241938ea46c472fe20b82d557965d1506415d806fb0
MD5 575083a7d7902b80689d5c31441a8ebd
BLAKE2b-256 ea2a14878234f6daa1091f50de57eb10ec7f0d001f1d82f730532df53c0b3787

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page