Skip to main content

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_cache directory, 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.

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-c to the very top of the cell.
  • Ignore One Line In A Cell:
    • Add # @i-l above the line you want to ignore.

Getting Started

Installation

pip install easyjupyter

Usage

In your project's entry point (e.g., main.py), or in Jupyter 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.

🚨 Note: If your project has nested folders, you need to tell EasyJupyter where your root folder is, by creating a easyJupyterConfig file in the root of your project.

touch easyJupyterConfig

Check out example_nested_project. Note run main.py from ./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.

Arguments

  • Always run easyjupyter --<argument> in the root of your project.

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:

  1. If you don't have a .vscode/settings.json file yet, run:

    mkdir -p .vscode && echo '{
        "python.analysis.extraPaths": [
            "./.easyJupyter_cache"
        ]
    }' > .vscode/settings.json
    
  2. If you already have a .vscode/settings.json file, add the following inside the {} brackets:

    "python.analysis.extraPaths": [
        "./.easyJupyter_cache"
    ]
    

Other

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

easyjupyter-0.1.5.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

easyjupyter-0.1.5-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file easyjupyter-0.1.5.tar.gz.

File metadata

  • Download URL: easyjupyter-0.1.5.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for easyjupyter-0.1.5.tar.gz
Algorithm Hash digest
SHA256 fe6508c784241d22f3a871311b76c3bfd123d024685cf915497b007fa5cd9610
MD5 c36665562c27c306a418a3640585df06
BLAKE2b-256 9ef76be6e311fae0d29a0ddcda05c2c00c5714ad2ac7fd884d4841944767a462

See more details on using hashes here.

Provenance

The following attestation bundles were made for easyjupyter-0.1.5.tar.gz:

Publisher: release.yaml on t20e/EasyJupyter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file easyjupyter-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: easyjupyter-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 13.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for easyjupyter-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 2b8776be42c0fd196d5d6071bc125e511d91122713a2d439a40f5f71bd65c139
MD5 d7a2918840fe42185dc3d0f498916485
BLAKE2b-256 9c755933442a2366c45fe563a2b502d41fa0172e25ea9e258ba58db67589d6c5

See more details on using hashes here.

Provenance

The following attestation bundles were made for easyjupyter-0.1.5-py3-none-any.whl:

Publisher: release.yaml on t20e/EasyJupyter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page