diff --git a/.changeset/clear-walls-unite.md b/.changeset/clear-walls-unite.md new file mode 100644 index 000000000000..9efbc6da367f --- /dev/null +++ b/.changeset/clear-walls-unite.md @@ -0,0 +1,5 @@ +--- +"gradio": minor +--- + +feat:bump to node 20 diff --git a/gradio/blocks.py b/gradio/blocks.py index 11544173c46c..fcf9c1a3052a 100644 --- a/gradio/blocks.py +++ b/gradio/blocks.py @@ -391,7 +391,9 @@ def serve_static_file( return client_utils.synchronize_async( processing_utils.async_move_files_to_cache, data, self ) - except AttributeError: # Can be raised if this function is called before the Block is fully initialized. + except ( + AttributeError + ): # Can be raised if this function is called before the Block is fully initialized. return data @@ -2316,7 +2318,7 @@ def launch( max_file_size: The maximum file size in bytes that can be uploaded. Can be a string of the form "", where value is any positive integer and unit is one of "b", "kb", "mb", "gb", "tb". If None, no limit is set. enable_monitoring: Enables traffic monitoring of the app through the /monitoring endpoint. By default is None, which enables this endpoint. If explicitly True, will also print the monitoring URL to the console. If False, will disable monitoring altogether. strict_cors: If True, prevents external domains from making requests to a Gradio server running on localhost. If False, allows requests to localhost that originate from localhost but also, crucially, from "null". This parameter should normally be True to prevent CSRF attacks but may need to be False when embedding a *locally-running Gradio app* using web components. - ssr_mode: If True, the Gradio app will be rendered using server-side rendering mode, which is typically more performant and provides better SEO, but this requires Node 18+ to be installed on the system. If False, the app will be rendered using client-side rendering mode. If None, will use GRADIO_SSR_MODE environment variable or default to False. + ssr_mode: If True, the Gradio app will be rendered using server-side rendering mode, which is typically more performant and provides better SEO, but this requires Node 20+ to be installed on the system. If False, the app will be rendered using client-side rendering mode. If None, will use GRADIO_SSR_MODE environment variable or default to False. Returns: app: FastAPI app object that is running the demo local_url: Locally accessible link to the demo diff --git a/gradio/node_server.py b/gradio/node_server.py index 816d2b9e7ab3..b6f49e285c6b 100644 --- a/gradio/node_server.py +++ b/gradio/node_server.py @@ -139,7 +139,7 @@ def start_node_process( f"Cannot start Node server on any port in the range {server_ports[0]}-{server_ports[-1]}." ) print( - "Please install Node 18 or higher and set the environment variable GRADIO_NODE_PATH to the path of your Node executable." + "Please install Node 20 or higher and set the environment variable GRADIO_NODE_PATH to the path of your Node executable." ) print( "You can explicitly specify a port by setting the environment variable GRADIO_NODE_PORT." diff --git a/gradio/routes.py b/gradio/routes.py index b88ba89897e1..26a097464459 100644 --- a/gradio/routes.py +++ b/gradio/routes.py @@ -461,7 +461,9 @@ def login(form_data: OAuth2PasswordRequestForm = Depends()): not callable(app.auth) and username in app.auth and compare_passwords_securely(password, app.auth[username]) # type: ignore - ) or (callable(app.auth) and app.auth.__call__(username, password)): # type: ignore + ) or ( + callable(app.auth) and app.auth.__call__(username, password) + ): # type: ignore token = secrets.token_urlsafe(16) app.tokens[token] = username response = JSONResponse(content={"success": True}) @@ -1553,7 +1555,7 @@ def mount_gradio_app( favicon_path: If a path to a file (.png, .gif, or .ico) is provided, it will be used as the favicon for this gradio app's page. show_error: If True, any errors in the gradio app will be displayed in an alert modal and printed in the browser console log. Otherwise, errors will only be visible in the terminal session running the Gradio app. max_file_size: The maximum file size in bytes that can be uploaded. Can be a string of the form "", where value is any positive integer and unit is one of "b", "kb", "mb", "gb", "tb". If None, no limit is set. - ssr_mode: If True, the Gradio app will be rendered using server-side rendering mode, which is typically more performant and provides better SEO, but this requires Node 18+ to be installed on the system. If False, the app will be rendered using client-side rendering mode. If None, will use GRADIO_SSR_MODE environment variable or default to False. + ssr_mode: If True, the Gradio app will be rendered using server-side rendering mode, which is typically more performant and provides better SEO, but this requires Node 20+ to be installed on the system. If False, the app will be rendered using client-side rendering mode. If None, will use GRADIO_SSR_MODE environment variable or default to False. node_server_name: The name of the Node server to use for SSR. If None, will use GRADIO_NODE_SERVER_NAME environment variable or search for a node binary in the system. node_port: The port on which the Node server should run. If None, will use GRADIO_NODE_SERVER_PORT environment variable or find a free port. Example: diff --git a/gradio/utils.py b/gradio/utils.py index f82b6990c731..977695c6425f 100644 --- a/gradio/utils.py +++ b/gradio/utils.py @@ -1550,7 +1550,7 @@ def get_node_path(): print("Unable to find node install path, falling back to SPA mode.") print( - "If you wish to use the node backend, please install node 18 and/ or set the path with the GRADIO_NODE_PATH environment variable." + "If you wish to use the node backend, please install node 20 and/ or set the path with the GRADIO_NODE_PATH environment variable." ) return None diff --git a/guides/08_custom-components/01_custom-components-in-five-minutes.md b/guides/08_custom-components/01_custom-components-in-five-minutes.md index 178bbfd4b278..e3a47f54286e 100644 --- a/guides/08_custom-components/01_custom-components-in-five-minutes.md +++ b/guides/08_custom-components/01_custom-components-in-five-minutes.md @@ -10,7 +10,7 @@ You will need to have: * Python 3.10+ (install here) * pip 21.3+ (`python -m pip install --upgrade pip`) -* Node.js v16.14+ (install here) +* Node.js 20+ (install here) * npm 9+ (install here) * Gradio 5+ (`pip install --upgrade gradio`) diff --git a/guides/08_custom-components/07_pdf-component-example.md b/guides/08_custom-components/07_pdf-component-example.md index 3dfb179d15f1..c40e900a6b06 100644 --- a/guides/08_custom-components/07_pdf-component-example.md +++ b/guides/08_custom-components/07_pdf-component-example.md @@ -7,7 +7,7 @@ This is a sneak preview of what our finished component will look like: ![demo](https://gradio-builds.s3.amazonaws.com/assets/PDFDisplay.png) ## Step 0: Prerequisites -Make sure you have gradio 4.0 or higher installed as well as node 18+. +Make sure you have gradio 5.0 or higher installed as well as node 20+. As of the time of publication, the latest release is 4.1.1. Also, please read the [Five Minute Tour](./custom-components-in-five-minutes) of custom components and the [Key Concepts](./key-component-concepts) guide before starting.