importnb
import jupyter notebooks as python modules and scripts.
Decision gist · record as of 2026-08-14
Yes. Low install friction, no required dependencies, active maintenance, and a permissive license make it a safe choice. Install if you work regularly with Jupyter notebooks and want to reuse code across them without manual extraction. The fuzzy finder and pytest integration add real value for notebook-heavy workflows. Not necessary if you rarely share code between notebooks or prefer exporting to .py files.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low friction: single pure-Python dependency (importlib-metadata) and no required build dependencies.
- Actively maintained with recent commits; repo shows ongoing activity.
License · maintenance · safety
permissive license (permissive) — Permissive license (BSD) imposes no restrictions on use, modification, or distribution in proprietary or open-source projects.
last release 2023-11-02 (1016 days) · last repo commit 2026-02-26 · 72 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 79,521 downloads/mo, #14,351 on PyPI
Alternatives
Verify before relying
pip install importnb
from importnb import imports
with imports("ipynb"):
pass # imports notebook files with .ipynb extension- Whether fuzzy finding performance degrades significantly with large numbers of notebooks in a directory
- Compatibility with notebooks containing complex cell dependencies or circular imports
- Whether the line-for-line JSON parser handles all edge cases in real-world notebook structures
- Real-world performance and reliability of the pytest integration for notebook-based test suites
What it is and what it does
importnb is a Python import hook that lets you treat Jupyter notebook files (.ipynb) as importable Python modules. Instead of manually extracting code from notebooks, you can use standard Python import syntax to load a notebook's code directly. The package translates notebook JSON into executable Python line-for-line, preserving error messages and line numbers. It works with top-level await, supports pytest integration for testing notebooks, and includes a CLI to run notebooks as scripts.
The package is designed for code reuse in notebook-heavy workflows. It offers customization through parameters like lazy loading, fuzzy name matching (to handle notebooks with non-Python-compatible names), and markdown-to-docstring conversion. It has no required dependencies at runtime and supports Python 3.8, 3.9, 3.10, 3.11, and 3.12 on CPython and PyPy.
Use it for
- Reuse analysis or utility code written in one notebook across multiple other notebooks without copy-paste
- Organize notebook-based projects by importing helper notebooks as modules from a main analysis notebook
- Write unit tests in notebooks using pytest, importing the code under test from other notebooks
- Run notebooks as command-line scripts with the importnb CLI, treating them like regular Python modules
- Build extensible systems where notebooks serve as plugins or configuration modules loaded dynamically
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
Low install friction, no required dependencies, active maintenance, and a permissive license make it a safe choice. Install if you work regularly with Jupyter notebooks and want to reuse code across them without manual extraction. The fuzzy finder and pytest integration add real value for notebook-heavy workflows. Not necessary if you rarely share code between notebooks or prefer exporting to .py files.
Install
importnb on PyPI
Before you install
Low friction: single pure-Python dependency (importlib-metadata) and no required build dependencies. Actively maintained with recent commits; repo shows ongoing activity.
License in practice
Permissive license (BSD) imposes no restrictions on use, modification, or distribution in proprietary or open-source projects.
Quickstart
pip install importnb
from importnb import imports
with imports("ipynb"):
pass # imports notebook files with .ipynb extension
Verify before relying
- Whether fuzzy finding performance degrades significantly with large numbers of notebooks in a directory
- Compatibility with notebooks containing complex cell dependencies or circular imports
- Whether the line-for-line JSON parser handles all edge cases in real-world notebook structures
- Real-world performance and reliability of the pytest integration for notebook-based test suites
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release >=3.8 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packageimportlib-metadata |
| Maintenance | Actively maintained 1,016 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 79,521 / month, #14,351 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 4 - BetaFramework :: IPythonFramework :: JupyterLicense :: OSI Approved :: BSD LicenseNatural Language :: EnglishProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPy |
Evidence: importnb-2023.11.1-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “import jupyter notebooks as modules”
- importnbimportnb lets you import Jupyter notebooks as Python modules, making…
- ipynbImports Jupyter Notebook (.ipynb) files as Python modules, executing…
- testbooktestbook lets you write unit tests for Jupyter Notebooks in separate…
Give your agent the search over MCP, or paste the wish link into any chat.
More Software Development packages
Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.
See also ipynb · testbook · myst-nb · nbconvert · mkdocs-jupyter · nbsphinx · session-info2 · nbsphinx-link · pyprojroot · pipreqs-fivetran