Skip to content

Commit b88c6b0

Browse files
authored
Merge pull request #118 from xsuite/release/v0.5.9
Release 0.5.9
2 parents d26142b + bdc6267 commit b88c6b0

File tree

7 files changed

+14
-484
lines changed

7 files changed

+14
-484
lines changed

gh.py

Lines changed: 0 additions & 166 deletions
This file was deleted.

make_release_branch.py

Lines changed: 2 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -4,91 +4,8 @@
44
# Copyright (c) CERN, 2024. #
55
# ######################################### #
66

7-
import sys
8-
import platform
9-
from gh import *
7+
from xaux.tools import dev_make_release_branch
108
# sys.tracebacklimit = 0
119

12-
class VersionError(OSError):
13-
pass
14-
15-
16-
# Check necessary setup and installs
17-
assert_git_repo()
18-
assert_poetry_installed()
19-
20-
21-
# Check the script arguments
22-
if len(sys.argv) != 2:
23-
raise ValueError("This script needs exactly one argument: the new version number or a bump. "
24-
"The latter can be: patch, minor, major.")
25-
bump = sys.argv[1]
26-
27-
28-
# Check our working directory is clean
29-
git_assert_working_tree_clean()
30-
branch = git_current_branch()
31-
if branch != "main":
32-
raise GitError("This script needs to be ran on the main branch.")
33-
git_push() # Sync with the remote to be sure we don't delete an incomplete branch later
34-
git_pull()
35-
expected_ver = poetry_get_expected_version(bump)
36-
37-
38-
# Check that we are not accidentally bumping a major version
39-
major_ver = int(expected_ver.split('.')[0])
40-
if major_ver != 0:
41-
raise VersionError("Bumping a major version! If this is really what you want, "
42-
"then adapt make_release_branch.py manually.")
43-
44-
45-
# Confirm version bump
46-
branch = f"release/v{expected_ver}"
47-
expected_ver = f"{expected_ver}rc0"
48-
current_ver = poetry_get_version()
49-
print(f"Bumping from {current_ver} to {expected_ver}.")
50-
print("Type y to continue (or anything else to cancel):")
51-
answer = input()
52-
if answer not in ["y", "Y"]:
53-
print("Cancelled.")
54-
sys.exit(1)
55-
56-
57-
# Create release branch
58-
print("Creating release branch...")
59-
git_switch(branch, create=True)
60-
61-
62-
# Update version in the release branch
63-
print("Poetry version bump...")
64-
poetry_bump_version(expected_ver)
65-
new_ver = poetry_get_version()
66-
if new_ver != expected_ver:
67-
raise VersionError(f"Fatal error: `poetry --dry-run` expected {expected_ver}, but result is {new_ver}..."
68-
"Need to recover manually!")
69-
70-
71-
# Adapt version files
72-
for file, pattern in zip(["xcoll/general.py", "tests/test_version.py"],
73-
["__version__ = ", " assert __version__ == "]):
74-
file_adapted = False
75-
with Path(file).open("r") as fid:
76-
lines = fid.readlines()
77-
with Path(file).open("w") as fid:
78-
for line in lines:
79-
if line.startswith(pattern):
80-
fid.write(f"{pattern}'{new_ver}'\n")
81-
file_adapted = True
82-
else:
83-
fid.write(line)
84-
if not file_adapted:
85-
raise VersionError(f"Fatal error: could not adapt {file}...")
86-
87-
88-
# Commit and push
89-
git_add(['pyproject.toml', 'xcoll/general.py', 'tests/test_version.py'])
90-
git_commit(f"Created release branch release/v{new_ver}.", no_verify=True)
91-
git_push(set_upstream=True)
92-
93-
print("All done!")
9410

11+
dev_make_release_branch("xcoll")

pyproject.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "xcoll"
3-
version = "0.5.8"
3+
version = "0.5.9"
44
description = "Xsuite collimation package"
55
homepage = "https://github.com/xsuite/xcoll"
66
repository = "https://github.com/xsuite/xcoll"
@@ -25,14 +25,14 @@ python = ">=3.8"
2525
ruamel-yaml = { version = "^0.17.31", optional = true }
2626
numpy = ">=1.0"
2727
pandas = ">=1.4"
28-
xobjects = ">=0.2.6"
29-
xdeps = ">=0.1.1"
30-
xpart = ">=0.15.0"
31-
xtrack = ">=0.36.5"
32-
xfields = ">=0.12.1"
28+
xobjects = ">=0.4.5"
29+
xdeps = ">=0.7.3"
30+
xpart = ">=0.19.1"
31+
xtrack = ">=0.69.7"
3332

3433
[tool.poetry.dev-dependencies]
3534
pytest = ">=7.3"
35+
xaux = ">=0.2.1"
3636

3737
[tool.poetry.extras]
3838
tests = ["pytest", "ruamel-yaml"]

0 commit comments

Comments
 (0)