enhancement: Added support for new command 'gradio environment' (#4915)

* enhancement: Added support for new command 'gradio environment' in cli.py

* added change to the Upcoming Release section

* Add to Issue template

* making the output look a bit nicer

* format

* Use project_name

---------

Co-authored-by: freddyaboulton <alfonsoboulton@gmail.com>
Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
This commit is contained in:
देवांश वार्ष्णेय 2023-07-19 22:12:01 +05:30 committed by GitHub
parent a0b87cb6b3
commit fdc9ca2ddf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 38 additions and 5 deletions

View File

@ -1,6 +1,6 @@
name: "\U0001F41E Bug report"
description: Report a bug on Gradio
labels: [ "bug" ]
labels: ["bug"]
body:
- type: markdown
attributes:
@ -44,9 +44,8 @@ body:
id: system-info
attributes:
label: System Info
description: Please ensure you are running the latest version of Gradio. You can get the Gradio version by running `pip show gradio`
description: Please ensure you are running the latest version of Gradio. You can get the Gradio version and all its dependencies by running `gradio environment`
render: shell
placeholder: Please include (1) gradio (or gradio_client) version (2) the operating system (3) (if relevant,) the browser
validations:
required: true
- type: dropdown
@ -62,4 +61,4 @@ body:
- type: markdown
attributes:
value: |
📌 Please ensure that you have filled all of the required sections above, and that the reproduction you have provided is [minimal, complete, and reproducible](https://stackoverflow.com/help/minimal-reproducible-example). Incomplete issues will be closed.
📌 Please ensure that you have filled all of the required sections above, and that the reproduction you have provided is [minimal, complete, and reproducible](https://stackoverflow.com/help/minimal-reproducible-example). Incomplete issues will be closed.

View File

@ -64,6 +64,8 @@ demo.launch()
```
- The `get_api_info` method of `Blocks` now supports layout output components [@freddyaboulton](https://github.com/freddyaboulton) in [PR 4871](https://github.com/gradio-app/gradio/pull/4871)
- Added the support for the new command `gradio environment`to make it easier for people to file bug reports if we shipped an easy command to list the OS, gradio version, and versions of gradio/gradio-client dependencies. bu [@varshneydevansh](https://github.com/varshneydevansh) in [PR 4915](https://github.com/gradio-app/gradio/pull/4915).
## Bug Fixes:
* The `.change()` event is fixed in `Video` and `Image` so that it only fires once by [@abidlabs](https://github.com/abidlabs) in [PR 4793](https://github.com/gradio-app/gradio/pull/4793)

View File

@ -1,5 +1,6 @@
import sys
import gradio.cli_env_info
import gradio.deploy_space
import gradio.reload
@ -8,7 +9,9 @@ def cli():
args = sys.argv[1:]
if len(args) == 0:
raise ValueError("No file specified.")
if args[0] == "deploy":
elif args[0] == "deploy":
gradio.deploy_space.deploy()
elif args[0] == "environment":
gradio.cli_env_info.print_environment_info()
else:
gradio.reload.main()

29
gradio/cli_env_info.py Normal file
View File

@ -0,0 +1,29 @@
""" This file is the part of 'gradio/cli.py' for printing the environment info
for the cli command 'gradio environment'
"""
import platform
import pkg_resources
def print_environment_info():
print("Gradio Environment Information:")
print("Operating System: ", platform.system())
print("\n")
for package_name in ["gradio", "gradio_client"]:
try:
package_dist = pkg_resources.get_distribution(package_name)
package_version = package_dist.version
print(f"{package_name} version: ", package_version)
print(f"\n{package_name} Dependencies:")
for req in package_dist.requires():
print(
f" {req.project_name}: {pkg_resources.get_distribution(req.project_name).version}"
)
print("\n")
except pkg_resources.DistributionNotFound:
print(f"{package_name} package is not installed.")