gradio/scripts/check_pypi.py
Abubakar Abid 3464673064
Add manual trigger to deploy to pypi (#2192)
* Create test.yml

* Update deploy-pypi.yml

* Update deploy-pypi.yml

* Delete test.yml

* fixes

* fixes

* check pypi

* check pypi

* version

* version
2022-09-06 13:49:49 -07:00

18 lines
486 B
Python

import urllib.request
import json
import sys
from pathlib import Path
root_directory = Path(__file__).parent.parent
version = (root_directory / "gradio" / "version.txt").read_text(
encoding='utf8').strip()
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")