Skip to content

Commit

Permalink
Move bumpversion config to pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
mdellweg committed Nov 19, 2024
1 parent f599d0c commit a34e451
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 75 deletions.
19 changes: 0 additions & 19 deletions .bumpversion.cfg

This file was deleted.

25 changes: 16 additions & 9 deletions .ci/scripts/check_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import argparse
import re
import os
import tomllib
import yaml
from tempfile import TemporaryDirectory
from packaging.version import Version
Expand All @@ -22,6 +23,17 @@
Z_CHANGELOG_EXTS = [".bugfix", ".doc", ".misc"]


def current_version(repo):
try:
pyproject_toml = tomllib.loads(repo.git.show(f"{DEFAULT_BRANCH}:pyproject.toml"))
current_version = pyproject_toml["project"]["version"]
except Exception:
current_version = repo.git.grep(
"current_version", DEFAULT_BRANCH, "--", ".bumpversion.cfg"
).split("=")[-1]
return Version(current_version)


def main():
"""Check which branches need a release."""
parser = argparse.ArgumentParser()
Expand Down Expand Up @@ -113,15 +125,10 @@ def main():
for change in changes.split("\n"):
_, ext = os.path.splitext(change)
if ext in Y_CHANGELOG_EXTS:
# We don't put Y release bumps in the commit message, check file instead
# The 'current_version' is always the next version to release
next_version = repo.git.grep(
"current_version", DEFAULT_BRANCH, "--", ".bumpversion.cfg"
).split("=")[-1]
next_version = Version(next_version)
print(
f"A new Y-release is needed! New Version: {next_version.base_version}"
)
# We don't put Y release bumps in the commit message, check file instead.
# The 'current_version' is always the dev of the next version to release.
next_version = current_version(repo).base_version
print(f"A new Y-release is needed! New Version: {next_version}")
releases.append(next_version)
break

Expand Down
2 changes: 1 addition & 1 deletion .github/template_gitref
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2021.08.26-393-g0e700c1
2021.08.26-395-gc4460b7
2 changes: 1 addition & 1 deletion .github/workflows/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ set -euv

source .github/workflows/scripts/utils.sh

PLUGIN_VERSION="$(sed -n -e 's/^\s*current_version\s*=\s*//p' .bumpversion.cfg | python -c 'from packaging.version import Version; print(Version(input()))')"
PLUGIN_VERSION="$(bump-my-version show current_version | tail -n -1 | python -c 'from packaging.version import Version; print(Version(input()))')"
PLUGIN_SOURCE="./pulp_gem/dist/pulp_gem-${PLUGIN_VERSION}-py3-none-any.whl"

export PULP_API_ROOT="/pulp/"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
- name: "Install python dependencies"
run: |
echo ::group::PYDEPS
pip install towncrier twine wheel httpie docker netaddr boto3 'ansible~=10.3.0' mkdocs jq jsonpatch
pip install towncrier twine wheel httpie docker netaddr boto3 'ansible~=10.3.0' mkdocs jq jsonpatch bump-my-version
echo "HTTPIE_CONFIG_DIR=$GITHUB_WORKSPACE/pulp_gem/.ci/assets/httpie/" >> $GITHUB_ENV
echo ::endgroup::
Expand Down
15 changes: 15 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## Contributing

We have provided detailed documentation for ways in which you can
contribute to Pulp here:
https://docs.pulpproject.org/contributing/

This documentation includes:

* Suggestions of how to contribute
* How we track bugs
* Ways to get in touch with other contributors who can advise you
* A contribution checklist
* A developer guide

Join us! We look forward to hearing from you.
35 changes: 0 additions & 35 deletions CONTRIBUTING.rst

This file was deleted.

1 change: 0 additions & 1 deletion HISTORY.rst

This file was deleted.

3 changes: 2 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
include CHANGES.md
exclude CONTRIBUTING.md
include COMMITMENT
include COPYRIGHT
include LICENSE
include README.md
include functest_requirements.txt
include LICENSE
include test_requirements.txt
include unittest_requirements.txt
include pyproject.toml
Expand Down
34 changes: 27 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,33 @@ pulp_gem = "pulp_gem:default_app_config"
[tool.setuptools.packages.find]
where = ["."]

[tool.bumpversion]
current_version = "0.7.0.dev"
commit = false
tag = false
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)(\\.(?P<release>[a-z]+))?"
serialize = [
"{major}.{minor}.{patch}.{release}",
"{major}.{minor}.{patch}",
]

[tool.bumpversion.parts.release]
optional_value = "prod"
values = [
"dev",
"prod",
]

[[tool.bumpversion.files]]
filename = "./pulp_gem/app/__init__.py"
search = "version = \"{current_version}\""
replace = "version = \"{new_version}\""

[[tool.bumpversion.files]]
filename = "./pyproject.toml"
search = "version = \"{current_version}\""
replace = "version = \"{new_version}\""

[tool.towncrier]
package = "pulp_gem"
filename = "CHANGES.md"
Expand Down Expand Up @@ -71,18 +98,11 @@ exclude = '''

[tool.check-manifest]
ignore = [
".bumpversion.cfg",
"CHANGES/**",
"CONTRIBUTING.rst",
"CODEOWNERS",
"HISTORY.rst",
"dev_requirements.txt",
"doc_requirements.txt",
"docs/**",
"staging_docs/**",
"template_config.yml",
".travis/**",
".travis.yml",
".pep8speaks.yml",
".ci/**",
".github/**",
Expand Down

0 comments on commit a34e451

Please sign in to comment.