-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: Add nada-mir-proto package and initial uv support * chore: Fix publish pipeline
- Loading branch information
1 parent
1564c77
commit 03d0631
Showing
4 changed files
with
61 additions
and
9 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
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,43 @@ | ||
# Checks python package version | ||
# Based on https://github.com/maybe-hello-world/pyproject-check-version/blob/v4/version_checker.py | ||
import re | ||
import sys | ||
import tomli | ||
import os | ||
import requests | ||
from packaging import version | ||
import json | ||
|
||
from packaging.version import Version | ||
|
||
|
||
def get_public_version(project_name: str, is_test=False) -> Version: | ||
response = requests.get( | ||
f'https://{"test." if is_test else ""}pypi.org/pypi/{project_name}/json' | ||
) | ||
if response.status_code == 200: | ||
return version.parse(json.loads(response.content)["info"]["version"]) | ||
else: | ||
return Version("0.0") | ||
|
||
|
||
if __name__ == "__main__": | ||
pyproject_toml_path = sys.argv[1] | ||
test_regex = sys.argv[2] | ||
with open(pyproject_toml_path, "rb") as f: | ||
project = tomli.load(f) | ||
|
||
project_version = version.parse(project["project"]["version"]) | ||
is_test = False | ||
if test_regex: | ||
if re.compile(test_regex).search(str(project_version)): | ||
is_test = True | ||
public_project_version = get_public_version(project["project"]["name"], is_test) | ||
|
||
with open(os.environ["GITHUB_OUTPUT"], "at") as f: | ||
f.write( | ||
f"local_version_is_higher={str(project_version > public_project_version).lower()}\n" | ||
) | ||
f.write(f"local_version={str(project_version)}\n") | ||
f.write(f"public_version={str(public_project_version)}\n") | ||
f.write(f"is_test={str(is_test).lower()}\n") |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.