-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This should do the following: 1. Use `release-drafter` to maintain a draft of a `v###` release. 2. Build wheels with a version based on either the current state of the file or using the version from the tag. 3. When we publish that release, it should publish to PyPi.
- Loading branch information
1 parent
03becc8
commit 0956cfa
Showing
7 changed files
with
210 additions
and
53 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,9 @@ | ||
_extends: kaskada:.github/release-drafter.yml | ||
|
||
name-template: Python $RESOLVED_VERSION | ||
tag-template: python@v$RESOLVED_VERSION | ||
tag-prefix: python@v | ||
|
||
# Only include PRs with one of these labels | ||
include-labels: | ||
- python |
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 |
---|---|---|
@@ -1,9 +1,5 @@ | ||
_extends: kaskada:.github/release-drafter.yml | ||
|
||
name-template: Python $RESOLVED_VERSION | ||
tag-template: python@v$RESOLVED_VERSION | ||
tag-prefix: python@v | ||
|
||
# Only include PRs with one of these labels | ||
include-labels: | ||
- python | ||
name-template: Kaskada $RESOLVED_VERSION-a.0 | ||
tag-template: v$RESOLVED_VERSION-a.0 | ||
tag-prefix: v |
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
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
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
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,28 @@ | ||
import tomlkit | ||
import argparse | ||
from typing import List | ||
|
||
def get_value_from_toml(file_path: str, toml_path: List[str]) -> str: | ||
"""Retrieve a value from a TOML file at the given path.""" | ||
with open(file_path, 'r') as f: | ||
data = tomlkit.parse(f.read()) | ||
|
||
temp = data | ||
for key in toml_path: | ||
temp = temp[key] | ||
|
||
return str(temp) # Convert value to string in case it's a number or boolean | ||
|
||
def main(): | ||
parser = argparse.ArgumentParser(description='Retrieve value from a TOML file.') | ||
parser.add_argument('file', type=str, help='Path to the TOML file.') | ||
parser.add_argument('path', type=str, help='Path within the TOML file (e.g., package.version)') | ||
|
||
args = parser.parse_args() | ||
|
||
toml_path = args.path.split('.') | ||
value = get_value_from_toml(args.file, toml_path) | ||
print(f"Value at '{args.path}' in '{args.file}': {value}") | ||
|
||
if __name__ == "__main__": | ||
main() |
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,48 @@ | ||
import tomlkit | ||
from tomlkit import dumps | ||
import argparse | ||
from collections import defaultdict | ||
from typing import Dict, List | ||
|
||
def update_version_in_data(data: Dict, version: str, toml_paths: List[str]) -> None: | ||
"""Update the version number in a data dictionary (parsed TOML) at multiple paths.""" | ||
for path in toml_paths: | ||
temp = data | ||
path = path.split('.') | ||
for key in path[:-1]: | ||
temp = temp[key] | ||
temp[path[-1]] = version | ||
|
||
def main(): | ||
parser = argparse.ArgumentParser(description='Update version in TOML files.') | ||
parser.add_argument('version', type=str, help='The version number to set.') | ||
parser.add_argument('entries', nargs='+', type=str, | ||
help='TOML file and path, format: <file_path>:<toml_path> (e.g., config.toml:package.version)') | ||
|
||
args = parser.parse_args() | ||
|
||
# Dictionary to hold the paths for each file | ||
file_paths_dict = defaultdict(list) | ||
|
||
for entry in args.entries: | ||
parts = entry.split(":") | ||
if len(parts) != 2: | ||
print(f"Invalid entry format: {entry}") | ||
continue | ||
|
||
file_path, toml_path_str = parts | ||
|
||
file_paths_dict[file_path].append(toml_path_str) | ||
|
||
# Update the files using the stored paths | ||
for file_path, paths in file_paths_dict.items(): | ||
with open(file_path, 'r') as f: | ||
data = tomlkit.parse(f.read()) | ||
|
||
update_version_in_data(data, args.version, paths) | ||
|
||
with open(file_path, 'w') as f: | ||
f.write(dumps(data)) | ||
|
||
if __name__ == "__main__": | ||
main() |