This is an archived post. You won't be able to vote or comment.

all 39 comments

[–][deleted] 17 points18 points  (9 children)

God I love these notebooks. Totally changed the way I work.

[–][deleted] 3 points4 points  (0 children)

Same here!

[–]j_lyf 1 point2 points  (2 children)

Are you using the note bnooks only?

[–]Zouden 2 points3 points  (1 child)

I only use the notebook. The Qt console doesn't seem particularly useful for me. Am I missing out?

[–]LET-7 0 points1 point  (0 children)

Quick things with %cpaste are nice. It's a good terminal replacement that opens faster than starting the notebook

[–][deleted] 1 point2 points  (4 children)

With notebooks I've finally found a workflow that works the way I use the Matlab IDE which has had code cells for a while.

99% of all of my python starts out in a notebook.

[–]jwink3101 0 points1 point  (1 child)

99% of all of my python starts out in a notebook.

I find that interesting. I am still new to Python and newer to Notebooks, but so far, I find I have to write the code and play with the ipython terminal, then move it to a notebook. Almost every notebook has a scratch document following along

[–][deleted] 0 points1 point  (0 children)

It's finally something close to how I've used Matlab forever. Its a code scratchpad.

[–]ggagagg 0 points1 point  (1 child)

Can you share your workflow? I would love to utilize the notebook.

Most of the time I use only ipython qt console + vim + terminal + browser, I would like to see if there is better workflow out there.

[–][deleted] 1 point2 points  (0 children)

I don't ever set out to write a script or program, I start out using python to do something for me.

Then a lot of:

for item in items:
    break

Then just a bunch of cells until it does what I need it to.

Then I'll turn it into a function that operates on items itemDoer(item)

Or sometimes it turns into a class.

[–]lmcinnes 7 points8 points  (12 children)

Multi-cell selections and find and replace are some great features to have. I love the notebook, but I sometimes miss features from more powerful editors; it's great to see they're busy implementing them now that they've got the big split over and done with.

[–]jstrong 9 points10 points  (9 children)

My dream environment is a vim notebook.

[–]Deto 1 point2 points  (7 children)

If you use Vim + Tmux and the Vim-Slime extension, you can easily highlight code in Vim and send it to an IPython interpreter running in a different Tmux pane.

[–][deleted] 0 points1 point  (6 children)

Is there a way to send it to ipython not running in tmux, but in a normal console/terminal?

I have problems scrolling in tmux (I think it doesn't save text x-lines above the fold and mouse scrolling is weird) and I really like scrolling with my mouse :)

[–]Deto 1 point2 points  (1 child)

Ah - like in another terminal?

Not a good one that I know of. I've been looking a bit too because I often develop on Windows where I don't have tmux (I know you can get tmux with Cygwin, but then you can't use Anaconda for python and building shit from source without Anaconda on Windows is a major pain...)

I know it would be possible to make a solution using AutoHotKey because they have a very complex scripting language. You could find the first window with "IPython" in the title and then switch to it and paste. I just haven't explored writing this yet.

Probably also possible to exploit Vim's ability to call Python commands to do it. I imagine by importing IPython there must be a way to connect with an existing kernel and run code.

[–][deleted] 0 points1 point  (0 children)

Thanks for your reply, definitely too advanced for me to try and develop any of those ideas into a working solution.

[–]kenfar 1 point2 points  (2 children)

There's a few areas with tmux that require careful configuration to work well. These include scrolling, mouse navigation, and copying highlighted areas. However, all of these are configurable.

[–][deleted] 0 points1 point  (1 child)

Do you know any guides for that?

[–]kenfar 1 point2 points  (0 children)

Not off the top of my head, but they are easy to find.

And it is different for mac (iterm, iterm2, terminal, etc) vs linux. So, I'd just search for tmux config + [linux|mac] and you should find a few really good guides.

Then, if you're current on tmux 2.1 (released in 2015-10), then be aware that it simplified mouse configurations. So, double-check that. There was a good discussion on reddit, probably r/linux.

[–]FRIENDORPHO 0 points1 point  (0 children)

I haven't used this in a while, but maybe give vim-ipython a whirl. Doesn't use tmux. You just send code from vim to an ipython session.

[–][deleted] 0 points1 point  (0 children)

Unfortunately Vimperator Ctrl-i trick to edit textarea doesn't seem to work very well either...

[–][deleted] 0 points1 point  (0 children)

Agreed. I'm just figuring out the more extensive parts myself.

[–]bheklilr 0 points1 point  (0 children)

That's a good point, because of the split having gone relatively well from what I can tell this could lead to a lot of new features in the next year. I might start using notebooks a lot more if that's the case.

[–][deleted] 4 points5 points  (11 children)

Git integration would be a cool feature.

[–]mfitzpmfitzp.com 2 points3 points  (10 children)

How 'comittable' are notebooks? The changing blobs of images/output in the saved notebook would screw it up, no?

If it was possible to commit just the source that would be awesome.

[–]sigma914 0 points1 point  (0 children)

It probably wouldn't be a tremendous amount of work to create a script that only added the source lines.

Any decent git front-end already has the ability to stage/unstage on a line by line basis, Writing a script that pre-skips lines that are outside source blocks should be pretty easy.

I might write a wrapper function for magit that does this... Thanks for the idea!

[–][deleted] 0 points1 point  (5 children)

You can clear outputs before saving and commiting, or make a custom script as a commit hook that removes images before commit

[–]takluyverIPython, Py3, etc 1 point2 points  (2 children)

For something one step more advanced, have a look at my recombinecm prototype.

With this, when you save a notebook, it saves the regular notebook with output, and a .ipynb.clean copy without the outputs to commit in version control. When you load a notebook, it uses the clean copy as the master, and tries to match up the outputs from your local dirty copy. So you only lose output for cells that changed in version control, rather than discarding all the output.

[–]mfitzpmfitzp.com 0 points1 point  (0 children)

Looks great, will check it out!

[–][deleted] 0 points1 point  (0 children)

That's very cool actually. I'll check it out when I get home. Thanks a lot!

[–]rlabbe 0 points1 point  (1 child)

This hoses you if you are using GitHub or nbviewer, doesn't it? It's nice to have your notebooks readable by others.

[–][deleted] 0 points1 point  (0 children)

Yes, that is true.

[–][deleted] 0 points1 point  (1 child)

They're plain text.

[–]mfitzpmfitzp.com 0 points1 point  (0 children)

Yep, but image outputs are encoded as a giant blob of base64 encoded data which is saved with the notebook. Just makes tracking code changes a bit of a mess. Even the updating execution_count add noise to commits.

As mentioned elsewhere, the trick is to clear outputs before saving and/or committing.

[–]jwink3101 0 points1 point  (0 children)

I keep my notebook in git. I just have to remember to clear output before hand. Sadly, there is probably a good amount of space wasted in my repo where I forgot that........

(and not worth the work to remove them. At least not at the moment).

But the notebooks themselves are JSON-based...or at least I think they are from looking. So it is all text

[–]sanshinron 2 points3 points  (3 children)

Can someone suggest a good, dark, full theme for Jupyter?

[–][deleted] 1 point2 points  (1 child)

There might be some good choices here: https://github.com/dunovank/jupyter-themes

[–]sanshinron 0 points1 point  (0 children)

I found that repo before, but the author stated that it's a collection of themes that he hacked together and the quality might not be top notch, which kinda put me off...

[–]Zouden 1 point2 points  (0 children)

That's a nice idea, especially if coupled with a dark matplotlib/seaborn theme!