mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
update pypi_helper.py
`
- dont rename requests - remove dash in verison (`2.3.0-rc3` becomes `2.3.0rc3`) - read package_name instead of hardcode it
This commit is contained in:
parent
cc3d431928
commit
7933f27a72
@ -1,26 +1,26 @@
|
|||||||
import requests as request
|
import requests
|
||||||
|
|
||||||
import ldm.invoke._version as version
|
from ldm.invoke.__init__ import __app_name__, __version__
|
||||||
|
|
||||||
local_version = str(version.__version__)
|
local_version = str(__version__).replace("-", "")
|
||||||
|
package_name = str(__app_name__)
|
||||||
|
|
||||||
|
|
||||||
def get_pypi_versions(package_name="InvokeAI") -> list[str]:
|
def get_pypi_versions(package_name=package_name) -> list[str]:
|
||||||
"""Get the versions of the package from PyPI"""
|
"""Get the versions of the package from PyPI"""
|
||||||
url = f"https://pypi.org/pypi/{package_name}/json"
|
url = f"https://pypi.org/pypi/{package_name}/json"
|
||||||
response = request.get(url).json()
|
response = requests.get(url).json()
|
||||||
versions: list[str] = list(response["releases"].keys())
|
versions: list[str] = list(response["releases"].keys())
|
||||||
return versions
|
return versions
|
||||||
|
|
||||||
|
|
||||||
def local_on_pypi(package_name="InvokeAI", local_version=local_version) -> bool:
|
def local_on_pypi(package_name=package_name, local_version=local_version) -> bool:
|
||||||
"""Compare the versions of the package from PyPI and the local package"""
|
"""Compare the versions of the package from PyPI and the local package"""
|
||||||
pypi_versions = get_pypi_versions(package_name)
|
pypi_versions = get_pypi_versions(package_name)
|
||||||
return local_version in pypi_versions
|
return local_version in pypi_versions
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
package_name = "InvokeAI"
|
|
||||||
if local_on_pypi():
|
if local_on_pypi():
|
||||||
print(f"Package {package_name} is up to date")
|
print(f"Package {package_name} is up to date")
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user