Files
wehub-resource-sync adf0d17497
publish / version_or_publish (push) Has been cancelled
storybook-build / changes (push) Has been cancelled
storybook-build / :storybook-build (push) Has been cancelled
Sync Gradio Skills to Hugging Face / sync-skills (push) Has been cancelled
functional / changes (push) Has been cancelled
functional / build-frontend (push) Has been cancelled
functional / functional-test-SSR=false (push) Has been cancelled
functional / functional-reload (push) Has been cancelled
js / changes (push) Has been cancelled
js / js-test (push) Has been cancelled
docs-build / changes (push) Has been cancelled
docs-build / docs-build (push) Has been cancelled
docs-build / website-build (push) Has been cancelled
functional / functional-test-SSR=true (push) Has been cancelled
hygiene / hygiene-test (push) Has been cancelled
python / changes (push) Has been cancelled
python / build (push) Has been cancelled
python / test-ubuntu-latest-flaky (push) Has been cancelled
python / test-ubuntu-latest-not-flaky (push) Has been cancelled
python / test-windows-latest-flaky (push) Has been cancelled
python / test-windows-latest-not-flaky (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:17:32 +08:00

40 lines
1.5 KiB
Python

"""This file is the part of 'gradio/cli.py' for printing the environment info
for the cli command 'gradio environment'
"""
from __future__ import annotations
import platform
from importlib import metadata
from packaging.requirements import Requirement
from rich import print
def print_environment_info():
"""Print Gradio environment information."""
print("Gradio Environment Information:\n------------------------------")
print("Operating System:", platform.system())
for package_name in ["gradio", "gradio_client"]:
try:
package_version = metadata.version(package_name)
print(f"{package_name} version:", package_version)
except metadata.PackageNotFoundError:
print(f"{package_name} package is not installed.")
print("\n------------------------------------------------")
for package_name in ["gradio", "gradio_client"]:
try:
dist = metadata.distribution(package_name)
print(f"{package_name} dependencies in your environment:\n")
if dist.requires is not None:
for req in dist.requires:
req_obj = Requirement(req)
try:
print(f"{req_obj.name}: {metadata.version(req_obj.name)}")
except metadata.PackageNotFoundError:
print(f"{req_obj.name} is not installed.")
print("\n")
except metadata.PackageNotFoundError:
print(f"{package_name} package is not installed.")