takluyver / nbopen

Open a Jupyter notebook in the best available server
BSD 3-Clause "New" or "Revised" License
304 stars 58 forks source link

added entry_point console scripts #3

Closed jkokorian closed 7 years ago

jkokorian commented 10 years ago

The old way of having a console script failed on windows. This is the recommended way anyway, I believe.

jkokorian commented 10 years ago

I didn't yet succeed in automatically setting the file associations for .ipynb file (did it manually though, works perfectly), but I'm working on it. Haven't done that before...

takluyver commented 10 years ago

I think entry_points requires setuptools, which I don't want to rely on (mainly for philosophical reasons - I hate setuptools). I think it should be possible to launch the application using commands like pyw -m nbopen file.ipynb. I use a similar thing to produce shortcuts for applications with Pynsist.

jkokorian commented 10 years ago

Ah ok, I didn't realize. Weird that it works without additional imports though... I'll stick to the 'scripts' method then. Is there an easy distutils way to register the 'nbopen' file on linux, but the 'nbopen.py' file on windows that you know of?

takluyver commented 10 years ago

If you install using pip, it automatically loads setuptools without an explicit import.

I think the simplest way is just to have an if sys.platform == 'win32' check. The existing nbopen.py should be usable directly as a script.

takluyver commented 10 years ago

I've got Windows integration working in my VM - see commit cf0703e0d2a31dee4af86a53add47a5ee6ed5f2a for the new installation script.

For now I've skipped making nbopen work at the command line, and just connected it directly to the GUI, so you can double click on files to open them. I may go back to it and make the command line tool work as well.

jkokorian commented 10 years ago

I didn't get it to work. I had to change import winreg to import _winreg because I have python 2.7, but it still didn't work. Probably because I already messed around with the file association myself...

jkokorian commented 10 years ago

I'll check if it works on a pc that I didn't mess up yet

jkokorian commented 10 years ago

It does work, nice! Now I just have to fix my own messed up registry...

takluyver commented 10 years ago

Thanks for testing. I forgot about the naming difference on Python 2. I'll fix that at some point, or a PR to change it would be welcome.

takluyver commented 7 years ago

Closing because nbopen is now packaged with flit instead.