Skip to content

Commit a306a8e

Browse files
committed
added bump-my-version tool, removed old tool
1 parent f44c486 commit a306a8e

File tree

2 files changed

+1
-34
lines changed

2 files changed

+1
-34
lines changed

_tasks.py

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -12,36 +12,3 @@ def task_docs():
1212
if platform.system() == "Windows":
1313
return subprocess.run([HERE / "docs/make.bat", "html"], check=False)
1414
return subprocess.run(["make", "-C", HERE / "docs", "html"], check=False)
15-
16-
17-
def update_version_strings(file_path, new_version):
18-
# taken from:
19-
# https://stackoverflow.com/questions/57108712/replace-updated-version-strings-in-files-via-python
20-
version_regex = re.compile(r"(^_*?version_*?\s*=\s*\")(\d+\.\d+\.\d+-?\S*)\"", re.M)
21-
with open(file_path, "r+") as f:
22-
content = f.read()
23-
f.seek(0)
24-
f.write(
25-
re.sub(
26-
version_regex,
27-
lambda match: f'{match.group(1)}{new_version}"',
28-
content,
29-
)
30-
)
31-
f.truncate()
32-
33-
34-
def update_version(version):
35-
subprocess.run(["poetry", "version", version], shell=False, check=True)
36-
new_version = (
37-
subprocess.run(["poetry", "version"], shell=False, check=True, capture_output=True)
38-
.stdout.decode()
39-
.strip()
40-
.split(" ", 1)[1]
41-
)
42-
update_version_strings(HERE.joinpath("src/biopsykit/__init__.py"), new_version)
43-
44-
45-
def task_update_version():
46-
version = sys.argv[1]
47-
return update_version(version)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ _check_black = "black . --check"
121121
ci_check = { sequence = ["_check_black", "_lint_ci"], help = "Check all potential format and linting issues." }
122122
test = {cmd = "pytest --cov=biopsykit -cov-report=term-missing --cov-report=xml", help = "Run Pytest with coverage." }
123123
docs = {"script" = "_tasks:task_docs"}
124-
update_version = {"script" = "_tasks:task_update_version"}
124+
version = { cmd = "uvx bump-my-version" }
125125
register_ipykernel = { cmd = "python -m ipykernel install --user --name biopsykit --display-name biopsykit", help = "Add a new jupyter kernel for the project." }
126126
remove_ipykernel = { cmd = "jupyter kernelspec uninstall biopsykit", help = "Remove the project specific jupyter kernel."}
127127
default = {sequence = ["format", "lint", "test"], help = "Run the default pipeline, consisting of formatting, linting, and testing."}

0 commit comments

Comments
 (0)