Skip to content
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

open multiple notebooks with one call to nbopen? #53

Open
jeisner opened this issue Mar 26, 2018 · 5 comments
Open

open multiple notebooks with one call to nbopen? #53

jeisner opened this issue Mar 26, 2018 · 5 comments

Comments

@jeisner
Copy link

jeisner commented Mar 26, 2018

Thanks very much for nbopen.
Simple suggestion: It would be nice to permit opening multiple files (in separate browser tabs) with one call to nbopen, like this:

nbopen foo.ipynb bar.ipynb
nbopen *.ipynb

I expected this to work and was surprised when it gave an error.

While it might seem almost as easy to write

nbopen foo.ipynb; nbopen bar.ipynb
for f in *.ipynb; do nbopen $f; done

these don't actually work because the first call to nbopen may have to open a notebook server, in which case it doesn't terminate until that server is closed. One would have to run the first call in the background.

Also, it is sometimes convenient to have a single command running that mentions a group of related filenames. This can make it easier to use commands like jobs and ps -f and pgrep -f and pkill -f, which list or match the full command.

@takluyver
Copy link
Owner

Thanks, I think that makes sense. It may take a bit of working out, because of the behaviour that uses an existing server if one is available that can reach the files in question, or starts a new one if necessary. So for multiple files, it needs a bit more smarts to figure out whether and where to launch new servers.

@jeisner
Copy link
Author

jeisner commented Mar 26, 2018

Is it possible that one call to nbopen (on multiple files) would have to launch multiple new servers?
If so, then their messages would be mingled on stdout/stderr -- not sure if that's a problem.

@takluyver
Copy link
Owner

Possibly - it depends on how it chooses the directories. At present, if it can't find an existing server to use, it will start a new one either at your home directory, or (for notebooks outside that) at the directory containing the notebook.

If it's passed notebooks in different directories, it would have to choose one of:

  1. Launch multiple servers
  2. Launch one server in the common ancestor directory (doesn't work for different drives on Windows, but I imagine almost no-one would ever pass paths to different drives in one command).
  3. Error out and ask the user to split up commands.

@jeisner
Copy link
Author

jeisner commented Apr 9, 2018

Could it launch a server in the directory of the first file, and use relative or absolute pathnames for the other files? (This is a variant of 2 -- use the first file instead of the common ancestor. I think that's more intuitive.)

When this is not possible, I guess it would have to fall back on 1. or 3.

@takluyver
Copy link
Owner

The limitation is that a notebook server can only open notebooks below the directory it's started at - it can't look up to higher directories, or across to sibling directories.

But I imagine that most of the times when someone would try to open multiple notebooks, they'd be in the same folder. So maybe we could avoid most of the complexity, at least at first.

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

No branches or pull requests

2 participants