Skip to content

Instantly share code, notes, and snippets.

@PhillCli
Last active November 14, 2022 14:11
Show Gist options
  • Save PhillCli/5b60753d3c1c9058a29227b718664f60 to your computer and use it in GitHub Desktop.
Save PhillCli/5b60753d3c1c9058a29227b718664f60 to your computer and use it in GitHub Desktop.
PEP440 bump2version config
[bumpversion]
commit = True
tag = False
current_version = 1.2.0.dev0
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\.(?P<release>[a-z]+)(?P<build>\d+))?
serialize =
{major}.{minor}.{patch}.{release}{build}
{major}.{minor}.{patch}
# inspired by: https://stackoverflow.com/a/64654668/8389830
[bumpversion:file:./src/<PACKAGE>/__version__.py]
search = VERSION = "{current_version}"
replace = VERSION = "{new_version}"
[bumpversion:part:build]
[bumpversion:part:release]
optional_value = gamma
values =
dev
gamma
@PhillCli
Copy link
Author

corresponding .pre-commit config, with exclude for trailing-white spaces

repos:
  - repo: https://github.com/psf/black
    rev: 22.3.0
    hooks:
      - id: black
        args: [--config=black.toml]

  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.2.0 # Use the ref you want to point at
    hooks:
      - id: trailing-whitespace
        exclude: .bumpversion.cfg # bump2version adds trailing whitespace, to the config ...: https://github.com/c4urself/bump2version/issues/124
      - id: requirements-txt-fixer
      - id: mixed-line-ending
        args: [--fix=lf]

  - repo: https://gitlab.com/daverona/pre-commit/cpp
    rev: 0.8.0
    hooks:
      - id: clang-format
      - id: cpplint
      - id: cppcheck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment