diff --git a/.github/ISSUE_TEMPLATE/bug_report_template.yml b/.github/ISSUE_TEMPLATE/bug_report_template.yml index bea4cd28f2..852bf06940 100644 --- a/.github/ISSUE_TEMPLATE/bug_report_template.yml +++ b/.github/ISSUE_TEMPLATE/bug_report_template.yml @@ -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. diff --git a/CHANGELOG.md b/CHANGELOG.md index 7303c2ee1e..2e6784bfe1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/gradio/cli.py b/gradio/cli.py index aa8e8b9b09..04b099eacb 100644 --- a/gradio/cli.py +++ b/gradio/cli.py @@ -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() diff --git a/gradio/cli_env_info.py b/gradio/cli_env_info.py new file mode 100644 index 0000000000..5d91718d78 --- /dev/null +++ b/gradio/cli_env_info.py @@ -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.")