-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
First go at using a free port instead of defaulting to 8050 #14
base: main
Are you sure you want to change the base?
Conversation
A URL of the form http://127.0.0.1:***** will be printed in the console. | ||
Open in the url in your browser. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A URL of the form http://127.0.0.1:***** will be printed in the console. | |
Open in the url in your browser. | |
A URL of the form `http://127.0.0.1:*****` is printed in the console. | |
Open the URL in your browser. |
Not commenting on the solution just on this particular phrasing :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not clear to me what use case you're addressing with this. Running multiple Dash demos / same app instances?
@@ -307,6 +308,13 @@ def update_score_figure(feature_score_data, data_key): | |||
return children | |||
|
|||
|
|||
def find_free_port(): | |||
with socket.socket() as s: | |||
s.bind(('', 0)) # Bind to a free port provided by the host. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might have unwanted effects in LeapIDE -- depending on (random) port chosen, user might not get a notification about port/service being available (bottom-right pop-up notification).
Yes. When providing demos and talks, it is not uncommon to show more than one demo in a row want to have the apps ready to go. Or even have two different instances of the same app in two windows to not lose visuals when comparing. It has come up in multiple talks for me. However, it may understandably not be a priority outside of edge users like me. |
I see. In that case I would recommend a less random approach (on average) like we do here. Same approach is used by Jupyter, for example. You can set the base port to be around |
This PR is meant to address the issue of most of our Dash demos trying to use port 8050.
Instead, the code looks for a free port and uses that.
Two draw backs are that it makes the readme less clear and requires the user to read console output.
Changing the .yaml file should likely be considered as will