mirror of
https://github.com/gradio-app/gradio.git
synced 2024-11-27 01:40:20 +08:00
52f7831751
* refactor: Use package.json for version management - uses package.json file for version management. - updated the regex pattern. - removed the logic that creates or updates the version.txt file * load version through package.json * fix code duplication * add changeset * add changeset * fixes * fix * package version * fix * typing * typing * changes * add changeset --------- Co-authored-by: Abubakar Abid <abubakar@huggingface.co> Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
18 lines
485 B
Python
18 lines
485 B
Python
import json
|
|
import sys
|
|
import urllib.request
|
|
from pathlib import Path
|
|
|
|
version_file = Path(__file__).parent.parent / "gradio" / "package.json"
|
|
with version_file.open() as f:
|
|
version = json.load(f)["version"]
|
|
|
|
with urllib.request.urlopen("https://pypi.org/pypi/gradio/json") as url:
|
|
releases = json.load(url)["releases"]
|
|
|
|
if version in releases:
|
|
print(f"Version {version} already exists on PyPI")
|
|
sys.exit(1)
|
|
else:
|
|
print(f"Version {version} does not exist on PyPI")
|