File size: 499 Bytes
a03b3ba
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import json
import sys
import urllib.request
from pathlib import Path

version_file = Path(__file__).parent.parent / "gradio_client" / "package.json"
with version_file.open() as f:
    version = json.load(f)["version"]

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")