-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add just file for updating python versions
update justfile update justfile update justfile update justfile correct justfile
- Loading branch information
1 parent
e1afd3e
commit 3b5a4c1
Showing
1 changed file
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
[positional-arguments] | ||
pin python_version: | ||
rye pin {{python_version}} --relaxed | ||
rye sync | ||
rye test | ||
|
||
[positional-arguments] | ||
update_workflow minimum_version maximum_version: | ||
#! /usr/bin/env python3 | ||
from pathlib import Path | ||
import sys | ||
|
||
workflow = Path('.github/workflows/package_testing.yml') | ||
|
||
vmin = sys.argv[1] | ||
vmax = sys.argv[2] | ||
|
||
minor_min = int(vmin.split(".")[1]) | ||
minor_max = int(vmax.split(".")[1]) | ||
|
||
with open(workflow) as f: | ||
content = f.readlines() | ||
|
||
for it, line in enumerate(content): | ||
if "MAIN_PYTHON_VERSION: " in line: | ||
print(it) | ||
content[it] = f' MAIN_PYTHON_VERSION: "{vmax}"\n' | ||
elif "python-version:" in line: | ||
new_line = f' python-version: [' | ||
for jt in range(minor_min, minor_max): | ||
new_line += f'"3.{jt}", ' | ||
new_line += f'"3.{minor_max}"]\n' | ||
content[it] = new_line | ||
|
||
with open(workflow, 'w') as f: | ||
f.writelines(content) | ||
|
||
[positional-arguments] | ||
python_update minimum_version maximum_version: | ||
# ensure git is clean | ||
git status | grep "nothing to commit" || exit 1 | ||
|
||
just pin {{maximum_version}} | ||
just update_workflow {{minimum_version}} {{maximum_version}} | ||
|
||
# git add and commit | ||
|
||
git checkout -b 'update-python-{{maximum_version}}' | ||
|
||
git add . | ||
git commit -m "Update supported python to {{maximum_version}}, minimum version {{minimum_version}}" | ||
|
||
git push origin 'update-python-{{maximum_version}}' | ||
|
||
# create PR with gh | ||
gh pr create --title "Update supported python to {{maximum_version}}, minimum version {{minimum_version}}" --body "This PR updates the supported python version to {{maximum_version}}, with a minimum version of {{minimum_version}}" |