Skip to content

Commit

Permalink
feat: Use tbump over bump2version (#1790)
Browse files Browse the repository at this point in the history
* Add tbump to 'develop' extra and remove bump2version.
* Add tbump.toml to configure tbump.
   - Allow for valid versions to follow SemVer and also support release
candidates: <major>.<minor>.<patch>rc<candidate>
   - Guard pyhf.utils.SCHEMA_VERSION against version bumps accidentally
bumping the SCHEMA_VERSION.
  • Loading branch information
matthewfeickert authored Mar 2, 2022
1 parent 9fd99be commit a8982e4
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 1 deletion.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
+ extras_require['test']
+ [
'nbdime',
'bump2version',
'tbump>=6.7.0',
'ipython',
'pre-commit',
'check-manifest',
Expand Down
61 changes: 61 additions & 0 deletions tbump.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
github_url = "https://github.com/scikit-hep/pyhf/"

[version]
current = "0.6.3"

# Example of a semver regexp.
# Make sure this matches current_version before
# using tbump
regex = '''
(?P<major>\d+)
\.
(?P<minor>\d+)
\.
(?P<patch>\d+)
(rc
(?P<candidate>\d+)
)?
'''

[git]
# The current version will get updated when tbump is run
message_template = "Bump version: 0.6.3 → {new_version}"
tag_template = "v{new_version}"

# For each file to patch, add a [[file]] config
# section containing the path of the file, relative to the
# tbump.toml location.
[[file]]
src = "tbump.toml"
# Restrict search to make it explicit why tbump.toml
# is even included as a file to bump, as it will get
# its version.current attribute bumped anyway.
search = "Bump version: {current_version} → "

[[file]]
src = "src/pyhf/utils.py"
# Guard SCHEMA_VERSION
# This search is just identifying the line to restrict the
# regex to, but all matches in the line will get bumped.
search = "pyhf: v{current_version}"

[[file]]
src = "README.rst"

[[file]]
src = "src/pyhf/data/citation.bib"

[[file]]
src = ".zenodo.json"

[[file]]
src = "codemeta.json"

[[file]]
src = "CITATION.cff"

[[field]]
# the name of the field
name = "candidate"
# the default value to use, if there is no match
default = ""

0 comments on commit a8982e4

Please sign in to comment.