Skip to content

Notebooks on readthedocs #302

Open

Description

@Koncopd

We want notebooks that automatically run through on readthedocs: https://nbsphinx.readthedocs.io/en/0.3.5. So that the basic tutorial (https://nbviewer.jupyter.org/github/theislab/scanpy_usage/blob/master/170505_seurat/seurat.ipynb) can be integrated into the scanpy repository in docs/tutorials as a notebook with all output cleared (no images etc.). It is run on the readthedocs server and will produce exactly the same output, as is guaranteed by this test: https://github.com/theislab/scanpy/blob/master/scanpy/tests/notebooks/pbmc3k.py

Activity

  1. self-assigned this
    on Oct 15, 2018
  2. grst commented on Nov 22, 2018

    @grst
    Contributor

    you could also consider jupytext + sphinx-gallery for this.

  3. falexwolf commented on Nov 25, 2018

    @falexwolf
    Member

    Why not using https://nbsphinx.readthedocs.io? It works completely fine for me. So, I would simply moved forward with it as soon as there is some bandwidth.

  4. grst commented on Nov 26, 2018

    @grst
    Contributor

    Sure, there's nothing wrong with nbsphinx!
    Actually, the only advantage of jupytext is that it provides an elegant way to only keep the input cells of notebooks under version control.

  5. flying-sheep commented on Nov 26, 2018

    @flying-sheep
    Member

    You mean it uses/relies on nbstripout? In that case:

    Pro Con
    Tests the Notebooks by running them Docs need a long time to build
    Only Text under version control
  6. grst commented on Nov 26, 2018

    @grst
    Contributor

    The idea is the same, but it works differently.

    Jupytext allows to save jupyter notebooks as various text formats (e.g. Rmd or plain python with comments). One of the supported formats is sphinx-gallery, that can be directly rendered by readthedocs if I'm not mistaken.

    Using a text-representation of notebooks is great when having them under version control.

    But of course the pros/cons apply as you pointed out.

  7. falexwolf commented on Nov 26, 2018

    @falexwolf
    Member

    There are different ways of stripping output from jupyter notebooks, several of them can be combined with the git commit workflow. I've played around a bit with them. The only thing I need to make sure is if there is a way that people cannot commit notebooks with output in them to the scanpy repo. The latter is an absolute no go. @grst, committing things in sphinx-gallery format could be a new way. I'll check whether this offers some convenience. In general I'd rather prefer to have the stripped .ipynb files in the repo, as it's done in tensorflow.

    @flying-sheep: I'm not worrying about the build time of the docs, that's decently fast in all my tests so far.

    @flying-sheep: After a bit of research I've done some time ago, I also don't consider tests based on notebooks a possibility. I made versions of two notebooks running on subsampled data producing ugly looking low-resolution figures, which ensures small test times and prevents the repo from blowing up. For the tutorials, I want extremely high resolution figures and no subsampled data.

    I think I should be almost there. Hopefully we'll have the first two notebooks in the Scanpy repo this or next week...

  8. grst commented on Nov 27, 2018

    @grst
    Contributor

    The only thing I need to make sure is if there is a way that people cannot commit notebooks with output in them to the scanpy repo. The latter is an absolute no go.

    Should be easy to have that checked by travis

    committing things in sphinx-gallery format could be a new way. I'll check whether this offers some convenience.

    If you have any questions/issues regarding this approach, don't hesitate to open an issue in the jupytext repo. The maintainer is extremely responsive and willing to help.

  9. falexwolf commented on Dec 16, 2018

    @falexwolf
    Member

    @flying-sheep and anyone interested: I started putting the notebooks on scanpy-tutorials: https://github.com/theislab/scanpy-tutorials and https://scanpy.readthedocs.io/en/latest/tutorials.html now links to the docs generated from scanpy-tutorials.

    I'm doing it like this for now as it's quite a bit less work than getting everything to run on readthedocs, there might indeed be problems with the runtime for building the docs and I think this updated solution isn't so bad after all...

    Opinions are welcome!

  10. flying-sheep commented on Aug 27, 2026

    @flying-sheep
    Member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions