gradio/client/python/scripts/check_pypi.py
Abubakar Abid c4ad09b631
Adds a pypi release action for the gradio python client (#3743)
* release action

* fixes

* name

* Update version.txt

* Update version.txt

* update

* fixes

* version

* rename

* action

* fix token

* custom dir

* fixes

* change password

* revert back to token

* scripts

* remove twine
2023-04-04 13:51:51 -07:00

17 lines
487 B
Python

import json
import sys
import urllib.request
from pathlib import Path
version_file = Path(__file__).parent.parent / "gradio_client" / "version.txt"
version = version_file.read_text(encoding="utf8").strip()
with urllib.request.urlopen("https://pypi.org/pypi/gradio_client/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")