@@ -21,7 +21,7 @@ print_help() {
2121 echo " --no-tag Don't create a tag for the release commit"
2222 echo " --no-edit Don't pause to allow CHANGELOG editing"
2323 echo " --do Actually run. Safety so that no arguments doesnt commit"
24- # echo "--dry-run, -n Don't do anything"
24+ # echo "--dry-run, -n Don't do anything"
2525 echo
2626 echo " ARG.... Arguments to pass to bump2version"
2727}
@@ -54,35 +54,35 @@ _positionals=()
5454while [[ $# -gt 0 ]]; do
5555 _key=" $1 "
5656 case " $_key " in
57- -h| --help)
58- print_help
59- exit 0
60- ;;
61- -h* )
62- print_help
63- exit 0
64- ;;
65- -n| --dry-run)
66- DRY_RUN=true
67- ;;
68- --allow-nonmain)
69- ALLOW_NONMAIN=true
70- ;;
71- --allow-dirty)
72- ALLOW_DIRTY=true
73- ;;
74- --no-tag)
75- NO_TAG=true
76- ;;
77- --no-edit)
78- NO_EDIT=true
79- ;;
80- --do)
81- DO=true
82- ;;
83- * )
84- _positionals+=(" $1 " )
85- ;;
57+ -h | --help)
58+ print_help
59+ exit 0
60+ ;;
61+ -h* )
62+ print_help
63+ exit 0
64+ ;;
65+ -n | --dry-run)
66+ DRY_RUN=true
67+ ;;
68+ --allow-nonmain)
69+ ALLOW_NONMAIN=true
70+ ;;
71+ --allow-dirty)
72+ ALLOW_DIRTY=true
73+ ;;
74+ --no-tag)
75+ NO_TAG=true
76+ ;;
77+ --no-edit)
78+ NO_EDIT=true
79+ ;;
80+ --do)
81+ DO=true
82+ ;;
83+ * )
84+ _positionals+=(" $1 " )
85+ ;;
8686 esac
8787 shift
8888done
123123_start_commit=" $( git rev-parse HEAD) "
124124
125125echo " Starting release process"
126- bump2version_args=(release --list )
126+ bump2version_args=(bump release )
127127if [[ $ALLOW_DIRTY == true ]]; then
128128 bump2version_args+=(--allow-dirty)
129129fi
130- if ! _output=" $( set -x; bump2version " ${bump2version_args[@]} " ) " ; then
131- echo " ${R} Error: Bump2version failed"
130+ if ! _output=" $(
131+ set -x
132+ uvx bump-my-version " ${bump2version_args[@]} "
133+ ) " ; then
134+ echo " ${R} Error: Bumpbump-my-version2version failed"
132135 echo " $_output " $NC
133136 exit 1
134137fi
135138
136- new_version=" $( echo " $_output " | grep new_version | sed -r s," ^.*=" ,,) "
139+ read_version () {
140+ uv run --no-project --with=toml python3 -c " import toml, pathlib; print(toml.loads(pathlib.Path('pyproject.toml').read_text())['project']['version'])"
141+ }
142+
143+ new_version=" $( read_version) "
137144echo " New version: $BOLD$M$new_version$NC "
138145
139146echo " Regenerating SWIG files$W "
140147silently ./regenerate_pycbf.py
141148
142- # On M1 mac, there are no wheels for numpy, and it doesn't build.
143- # Numpy is only a runtime requirement so this is safe
144- echo " Removing numpy from dependencies"
145- silently cp pyproject.toml pyproject.toml.bak
146- silently sed -i' ' -e ' s/numpy = ">=1.17"/# numpy = ">=1.17"/' pyproject.toml
147-
148- echo " Installing base environment"
149- silently poetry install
150-
151- # Restore back for the build
152- echo " Restoring original pyproject"
153- silently mv pyproject.toml.bak pyproject.toml
154-
155- echo " Re-running build for Cython"
156- silently poetry build
157-
158149echo " Running towncrier"
159- silently towncrier --yes --version=" $new_version "
150+ silently uvx towncrier build --yes --version=" $new_version "
160151
161152if [[ $NO_EDIT != true ]]; then
162153 echo " Pausing for CHANGELOG editing"
168159echo " Running pre-commit to clean up"
169160quietly pre-commit run --all || true
170161
171-
172162echo " ${BOLD} Making commit$NC "
173163quietly git add --update
174164quietly git commit -n -m " pycbf $new_version "
181171echo " $NC "
182172echo " Advancing to new development release"
183173
184- if ! _output=" $( set -x; bump2version minor --list) " ; then
174+ if ! _output=" $(
175+ set -x
176+ uvx bump-my-version bump minor
177+ ) " ; then
185178 echo " ${R} Error: Advancing release tag to next development release"
186179 echo " $_output " $NC
187180 exit 1
188181fi
189182
190- new_dev_version=" $( echo " $_output " | grep new_version | sed -r s, " ^.*= " ,, ) "
183+ new_dev_version=" $( read_version ) "
191184echo " New development version: $BOLD$M$new_dev_version$NC "
192185
193186echo " Regenerating SWIG files$W "
194187silently ./regenerate_pycbf.py
195188
196- echo " Re-running build for Cython"
197- silently poetry build
198-
199189echo " ${BOLD} Making new development commit$NC "
200- ( set -x
190+ (
191+ set -x
201192 git add --update
202193 git commit -n -m " Advance to ${new_dev_version} development series"
203194)
204195echo
205196echo " Successfully released $M$new_version$NC and advanced to $M$new_dev_version$NC "
206197echo
207198if [[ $NO_TAG != true ]]; then
208- echo " Please remember to ${B} git push origin main v$new_version$NC "
199+ echo " Please remember to ${B} git push origin --atomic main v$new_version$NC "
209200fi
0 commit comments