Skip to content

Fix: Pass launch kwargs to Gradio's demo.launch()#4

Merged
abidlabs merged 2 commits intogradio-app:mainfrom
Mandark-droid:fix/pass-launch-kwargs
Feb 27, 2026
Merged

Fix: Pass launch kwargs to Gradio's demo.launch()#4
abidlabs merged 2 commits intogradio-app:mainfrom
Mandark-droid:fix/pass-launch-kwargs

Conversation

@Mandark-droid
Copy link
Contributor

Summary

  • Adds **launch_kwargs parameter to Toolset.launch() method
  • Passes kwargs through to launch_gradio_ui() and finally to demo.launch()
  • Enables users to use all standard Gradio launch options

Problem

Previously, calling toolset.launch(share=True) would raise:

TypeError: Toolset.launch() got an unexpected keyword argument 'share'

Solution

The launch() method now accepts and passes through any Gradio launch kwargs:

# Now works!
toolset.launch(mcp_server=True, share=True)
toolset.launch(server_port=8080)
toolset.launch(server_name="0.0.0.0", auth=("user", "pass"))

Changes

  • toolsets/toolset.py: Added **launch_kwargs to launch() method and updated docstring
  • toolsets/gradio_ui.py: Added **launch_kwargs to launch_gradio_ui() and passed to demo.launch()

Test Plan

  • Verify toolset.launch(share=True) creates a public link
  • Verify toolset.launch(server_port=8080) uses custom port
  • Verify existing functionality (mcp_server flag) still works

@abidlabs
Copy link
Member

Thanks @Mandark-droid! This is looks fine, but would it be possible for you to actually explicitly add the arguments you want in launch() as explicit parameters in Toolset.launch()? The benefit of that is that we get type hints, ide autocompletion, etc.

Add explicit share and server_port parameters to Toolset.launch()
and launch_gradio_ui() for type hints and IDE autocompletion.
@abidlabs
Copy link
Member

abidlabs commented Feb 23, 2026

🪼 branch checks and previews

Name Status URL
🦄 Changes failed! Workflow log

@abidlabs
Copy link
Member

🦄 change detected

This Pull Request includes changes to the following packages.

Package Version
toolsets minor

  • Fix: Pass launch kwargs to Gradio's demo.launch()

‼️ Changeset not approved. Ensure the version bump is appropriate for all packages before approving.

  • Maintainers can approve the changeset by checking this checkbox.

Something isn't right?

  • Maintainers can change the version label to modify the version bump.
  • If the bot has failed to detect any changes, or if this pull request needs to update multiple packages to different versions or requires a more comprehensive changelog entry, maintainers can update the changelog file directly.

@Mandark-droid
Copy link
Contributor Author

Hi @abidlabs, thanks for the feedback! I've updated the PR to add share and server_port as explicit parameters in both Toolset.launch() and launch_gradio_ui() — so we get proper type hints and IDE autocompletion.

Copy link
Member

@abidlabs abidlabs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks @Mandark-droid!

@abidlabs abidlabs merged commit f3b8bfe into gradio-app:main Feb 27, 2026
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants