EasyJupyter allows you to effortlessly integrate your Jupyter Notebook code into any Python project or other notebooks.
Project description
EasyJupyter
EasyJupyter allows you to effortlessly integrate your Jupyter Notebook code into any Python project or other notebooks. It intelligently transforms your notebooks into standard Python modules, allowing you to import functions, classes, and variables as if they were regular .py files. This seamless process, managed by a background caching mechanism, lets you leverage the interactive development environment of notebooks for rapid prototyping and analysis, while ensuring your code is modular and reusable.
This is particularly useful for AI/Data science projects. For example, if you are building out a Transformer architecture, you could code and write notes for each layer of the model in its own notebook, and then seamlessly import them into your main project or another notebook.
Key Benefits:
- Native GitHub Rendering: Keep your code in notebooks so plots and markdown render natively on GitHub.
- Zero Clutter: Generated cache files are stored in a hidden
.easyJupyter_cachedirectory, keeping your workspace clean. - Custom ignore syntax to ignore exploratory cells, or lines of code.
How It Works: When EasyJupyter is first imported within a project, it initiates a single, detached background daemon for that specific project. This daemon is tied to your project's root (specifically, the generated .easyJupyter_cache/watcher.pid file) and monitors only the notebooks within it. This per-project design ensures that different projects can have their own daemons completely isolated and do not interfere with each other. If the daemon for a project is not already running, it will be started automatically the next time you import EasyJupyter within that project's environment.
Table of Contents
Ignore Notebook Commands
Use these commands inside notebooks to control what gets compiled into the cache.
- Markdown Cells: Ignored by default.
- Ignore An Entire Cell:
- Add
# @i-cto the very top of the cell.
- Add
- Ignore One Line In A Cell:
- Add
# @i-labove the line you want to ignore.
- Add
Getting Started
Installation
pip install easyjupyter
Usage
In your project's entry point (e.g., main.py) and in any Jupyter Notebooks where you want the daemon to be active or when importing from other notebooks, import the library at the very top of the file:
import EasyJupyter # Import at the very top of the file
from my_notebook import Class, Function_name
- Importing EasyJupyter in many files is not a problem, as only one daemon can run at a time per project, you could import it in all your files if you want.
[!important] Never edit the cache files directly, only edit the notebooks!
If your project has nested folders. Create a
easyJupyterConfigfile in the root of your project!# cd into your project root touch easyJupyterConfig
[!NOTE]
Check out example_nested_project. Note run
main.pyfrom inside ./example_nested_project, also for VSC's Pylance to kick in, open a new VSC window with ./example_nested_project as root, and follow VSC Pylance Intellisense Setup below.You should use Notebook automatic reloading if you are simultaneously working with many notebooks that import each other. Add following to a cell at the top of notebooks!
# @i-c %load_ext autoreload %autoreload 2
Arguments
- Always run
easyjupyter --<argument>from somewhere in a project, where the daemon lives.
Sync All Notebooks
- Sync all notebooks to the cache, run:
-
Do this only if your cache is empty and you have existing notebooks, not every time you update a notebook.
easyjupyter --sync
-
Cache Cleanup
-
If you rename, move, or delete a notebook, the old cache file will remain in the hidden cache directory. To clean up the cache, run:
easyjupyter --clean
Watch Daemon Logs
-
If you incorrectly use EasyJupyter in a notebook (e.g., redundant ignore comments), warnings will be embedded directly into the generated cache file. These warnings will be printed to the console (or notebook output) whenever the cached module is imported and executed, even when importing from another notebook. However, if you want to view the live warnings as the daemon runs, run:
easyjupyter --watch
Stop Daemon
-
The daemon process will terminate by itself, however, if you need to gracefully stop the background daemon process, run:
easyjupyter --stop
VSC Pylance Intellisense Setup
VS Code's Pylance intellisense will not natively work with notebooks, or the hidden cache files generated for the notebooks. But you can tell it where to look for the cache files. Run one of the following commands in the root of your project:
-
If you don't have a
.vscode/settings.jsonfile yet, run:mkdir -p .vscode && echo '{ "python.analysis.extraPaths": [ "./.easyJupyter_cache" ] }' > .vscode/settings.json
-
If you already have a
.vscode/settings.jsonfile, add the following inside the{}brackets:"python.analysis.extraPaths": [ "./.easyJupyter_cache" ]
-
Make sure that in VSC you are selecting the environment that has EasyJupyter installed. For notebooks, VSC will prompt you to select the environment when you run a cell in a notebook. For .py files, you can manually select the environment in the bottom right corner of VSC.
Resolving Errors
If any issues occur with the watcher daemon, manually run it with: python -m EasyJupyter.watcher (note that this spawns the daemon in the foreground for debugging). If the daemon is already running in the background, you will need to delete the .easyJupyter_cache/watcher.pid file first.
You can always check the background daemon logs inside .easyJupyter_cache/watcher.log.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file easyjupyter-0.1.6.tar.gz.
File metadata
- Download URL: easyjupyter-0.1.6.tar.gz
- Upload date:
- Size: 14.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b6cd5883ba082576fdca0cbc75a9c4c3163cf04bbbbf1b2ee2746d54982aaa34
|
|
| MD5 |
88a34c55656a4888973d8f78ccded9fd
|
|
| BLAKE2b-256 |
4807d2a6c199095e512b5a092e897298cac16993dccf50b1a6a17ce0c041f33b
|
Provenance
The following attestation bundles were made for easyjupyter-0.1.6.tar.gz:
Publisher:
release.yaml on t20e/EasyJupyter
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
easyjupyter-0.1.6.tar.gz -
Subject digest:
b6cd5883ba082576fdca0cbc75a9c4c3163cf04bbbbf1b2ee2746d54982aaa34 - Sigstore transparency entry: 1314929835
- Sigstore integration time:
-
Permalink:
t20e/EasyJupyter@5af17d4e6febd1f1ef2fbda805f1bdd886471553 -
Branch / Tag:
refs/tags/0.1.6 - Owner: https://github.com/t20e
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@5af17d4e6febd1f1ef2fbda805f1bdd886471553 -
Trigger Event:
push
-
Statement type:
File details
Details for the file easyjupyter-0.1.6-py3-none-any.whl.
File metadata
- Download URL: easyjupyter-0.1.6-py3-none-any.whl
- Upload date:
- Size: 14.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2a386a7bd1f3c07af4966c4e4c4e11e33619865089502035491c91e3f13b3cc
|
|
| MD5 |
cc3d9e008051a6076fd58b2c974a2d1c
|
|
| BLAKE2b-256 |
8d131d73fe2e8206b04dfb57935034d3aa1cb864829f428017fcfd69620533fe
|
Provenance
The following attestation bundles were made for easyjupyter-0.1.6-py3-none-any.whl:
Publisher:
release.yaml on t20e/EasyJupyter
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
easyjupyter-0.1.6-py3-none-any.whl -
Subject digest:
e2a386a7bd1f3c07af4966c4e4c4e11e33619865089502035491c91e3f13b3cc - Sigstore transparency entry: 1314929963
- Sigstore integration time:
-
Permalink:
t20e/EasyJupyter@5af17d4e6febd1f1ef2fbda805f1bdd886471553 -
Branch / Tag:
refs/tags/0.1.6 - Owner: https://github.com/t20e
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@5af17d4e6febd1f1ef2fbda805f1bdd886471553 -
Trigger Event:
push
-
Statement type: