Pagination in Jupyter Notebooks

1,537 views
Skip to first unread message

Safia Abdalla

unread,
Sep 4, 2015, 2:42:55 PM9/4/15
to jup...@googlegroups.com
Folks,

I'm migrating this conversation over from the jupyter/notebook gitter for wider discussion.

I'm currently working on creating a set of notebooks for a data analytics workshop series I am teaching at PyLadies Chicago. My goal is to produce a notebook for each class and have "pages" within the notebook for different parts of the lesson. For example, my vision for the first Notebook, which covers the basics of Python, would contain a page each for things like variables and data types, iteration, functions, and interfacing with the standard library.

Visually, I was imagining the pagination being fulfilled by "Previous Page" and "Next Page" button at the bottom of every page. I imagine checking a box that says "Use Header 1 As Page Break" and every time I create a Markdown or Heading cell with a header 1, that cell and any content after it would be included in a new page.

Min mentioned that discussions have been had about this before. Does anyone recall what ideas were tossed around?

I would like to take on or help with implementing this as I have a very personal use case and programming is fun. :)

Thoughts? Comments? Concerns? Impassioned rants?

Thanks!

Safia Abdalla
http://safia.rocks | @captainsafia

Brian Granger

unread,
Sep 9, 2015, 11:51:04 AM9/9/15
to Project Jupyter
Safia,

Thanks for bringing this up!

> I'm migrating this conversation over from the jupyter/notebook gitter for
> wider discussion.
>
> I'm currently working on creating a set of notebooks for a data analytics
> workshop series I am teaching at PyLadies Chicago. My goal is to produce a
> notebook for each class and have "pages" within the notebook for different
> parts of the lesson. For example, my vision for the first Notebook, which
> covers the basics of Python, would contain a page each for things like
> variables and data types, iteration, functions, and interfacing with the
> standard library.
>
> Visually, I was imagining the pagination being fulfilled by "Previous Page"
> and "Next Page" button at the bottom of every page. I imagine checking a box
> that says "Use Header 1 As Page Break" and every time I create a Markdown or
> Heading cell with a header 1, that cell and any content after it would be
> included in a new page.
>
> Min mentioned that discussions have been had about this before. Does anyone
> recall what ideas were tossed around?

Sure!

The notebook is a flat linear sequence of cells. However, based on the
headings (#, ##, ###) in Markdown cells, a formal structural document
hierarchy can be inferred. What we have talked about in the past is
this:

* Adding an API to the Notebook JS class that allows that inferred
hierarchy to be introspected and manipulated.
* This inferred hierarchy would probably be computed on the fly to
allow the document to change freely without having to also maintain
the hidden state of the hierarchy.
* Using that API, add new UI that allows a user to perform actions
with that hierarchy:
- Hide/show entire sections and subsections.
- Show one section at a time (paging)
- Cut/copy/paste/move entire sections
- Promote/unpromote sections.

We don't have concrete ideas about that the UI would look like, but
now that we have some designers working with us, they could help in
that area. While this type of approach doesn't exactly address pages
(defined by a fixed length) I think it would allow a semantic
equivalent of that idea.

>
> I would like to take on or help with implementing this as I have a very
> personal use case and programming is fun. :)

For something like this I would submit a JEP (enhancement proposal) to
work out the API and UI. Please ping @cameronoelsen on the UI design
aspects of this. More that willing to work on this with you next week
while you are here.

Cheers,

Brian

>
> Thoughts? Comments? Concerns? Impassioned rants?
>
> Thanks!
>
> Safia Abdalla
> http://safia.rocks | @captainsafia
>
> --
> You received this message because you are subscribed to the Google Groups
> "Project Jupyter" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jupyter+u...@googlegroups.com.
> To post to this group, send email to jup...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jupyter/CAJ2PXeM8qgfo8uC4KrphiMpagsKS8_7LCyewqocQPLeiwy72Lw%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.



--
Brian E. Granger
Associate Professor of Physics and Data Science
Cal Poly State University, San Luis Obispo
@ellisonbg on Twitter and GitHub
bgra...@calpoly.edu and elli...@gmail.com

Safia Abdalla

unread,
Sep 9, 2015, 10:05:23 PM9/9/15
to jup...@googlegroups.com
Brian,

Thanks for the response and the detailed description of previous proposed implementations.

I went ahead and added a JEP for this to my fork of jupyter/enhancement-proposals. I'll be filling it in throughout the next week with UI details and details about the technical implementation based on the information you provided.

If anyone else is interested in fleshing this out, feel free to submit a PR to my fork!

Safia Abdalla
http://safia.rocks | @captainsafia

Brian Granger

unread,
Sep 9, 2015, 10:15:08 PM9/9/15
to Project Jupyter
Reply all
Reply to author
Forward
0 new messages