jupyter / jupyter/notebook

Workflow for moving notebook code to importable modules

Open
#1,052 4 comments 2 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
13.3k
Forks
5.8k
Avg merge
6d 11h
Merged PRs (30d)
7

Description

[Opening an issue from a google groups thread](https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/jupyter/V2knsyBCUYU/qwk8OumZBwAJ).

Long-time notebook user. After many years of using notebooks to do data analysis in my PhD, and now handing the project over to others to continue the work, it's been pointed out quite rightly and clearly to me that much of what I've written is redundantly spread across many notebooks, and that some code which should be in importable modules is instead in a "copy and paste and reuse" state.

Is there any ongoing work on making this "modularization" process easier? Especially when working remotely, this is a pretty high-friction process -- find where in the file system the notebook is, ssh in, open up a new module file in a remote editor, selectively copy/paste code, try to import, fix import errors, try to import, succeed, try to use functions, fix errors, etc.

For instance, having `%edit` open up a text web-based editor would greatly speed up this process. One cell has `%edit mymodule.py`, the cell below is used for testing and debugging the contents of `mymodule.py`. I understand this would be very difficult to implement well, but I just wanted to check if there's anything like this on the horizon.

Although it is ultimately my responsibility to write reusable and maintainable code, the lure of notebooks for prototyping into creating a copy/paste mentality has been a source of frustration, and a pain point for the continued use of notebooks in our laboratory.

Contributor guide

Open the contributing guide

Research direction

The issue names no repository files, entry points, or tests. Start by reviewing the proposed `%edit mymodule.py` workflow and the surrounding discussion, then define a concrete modularization workflow and acceptance criteria for remote notebook users.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter-notebook
Domain
developer-experience
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.