man-group / dtale

Visualizer for pandas data structures
http://alphatechadmin.pythonanywhere.com
GNU Lesser General Public License v2.1
4.62k stars 390 forks source link

Changed behaviour of port and host assignment #853

Open Kaschmiri opened 3 months ago

Kaschmiri commented 3 months ago

Preface: Sorry for being vague - I have a very limited understanding of this. I have jupyterlab running on a VM and have been using it with dtale for a while. No jupyterhub involved. I never managed to get dtale to work "inline", but could reach the instance perfectly fine in a browser tab. A couple of weeks ago, I foolishly updated my conda environments without creating backups/yml-files to fall back to. Since then, a lot of the functionality is lost. I have since created a new VM with fresh installations of everything and a cleaner setup of my environments, to no avail.

Firstly, dtale used to use different ports when creating instances from different kernels/notebooks. For instance, I could start several dtale instances on one kernel/notebook with port 40000, and any instances started on the next kernel/notebook automatically would use port 40001, and so on. This doesn't work anymore. dtale.instances() or ._main_url will return http://localhost:40000/dtale/main/1 as the first instance on any kernel, and opening that will always show the dtale instance of the first kernel. Checking the instances in the dtale menu will only list instances started in that kernel. Any dtale instances opened on other kernels will not show.

If I start instances on a second kernel specifying a different port manually, for e.g. dtale.show(df, port=40001, force=True), I can reach them just fine.

Secondly, the standard behaviour of parameter "host" of dtale.show has changed for me. Before, I could just replace the first part of the url provided by: d= dtale.show() d._main_url (or dtale.instances()) Now, I have to specify: dtale.show(df , host='0.0.0.0', port = 40000, force = True) Is there a way to revert to the previous behaviour? And is there a way to show dtale instances inline, in this situation?

aschonfeld commented 2 months ago

@Kaschmiri so D-Tale will not open a new port for every new piece of data. What is will do is add additional instances to any running port. So say you've loaded one dataframe and it is being displayed on port 40000 with data ID 1. Then you load another dataframe. This will be displayed on port 40000 with data ID 2.

So you'd be able to hit the two pieces of data with these two URLs:

Now if you want to have a different port used everytime then you'll have to specify the port parameter everytime you call dtale.show. This has been the functionality for some time so you must have been working with a very old version.

Here is a pretty good explanation of how data gets routed when you call dtale.show: https://github.com/man-group/dtale?tab=readme-ov-file#startup-behavior

Hope this helps.