Registry / data / importnb

importnb

JSON →
library2023.11.1pypypi✓ verified 83d ago

Import Jupyter Notebooks as Python modules and scripts. Supports Python 3.8+, and allows importing .ipynb files directly. Version 2023.11.1 adds Python 3.12 compatibility, top-level await async support, and improved entry points. Release cadence is sporadic, with minor updates as needed.

pip install importnb
INSTALL
IMPORT
SIG · IMPORTNB
I
importnb
datapythonv2023.11.1
Install
1.6s avg
Import
143ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2023.11.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.150s · 18.1MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.6s · import 0.136s · 19MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Notebook
from importnb import Notebook
from importnb.notebook import Notebook
Notebook is a top-level import, not a submodule.
importnb
import importnb

Basic usage: use Notebook context manager to import .ipynb files as modules.

import os os.environ['SOME_KEY'] = 'test' # placeholder auth import importnb from importnb import Notebook with Notebook(): import my_notebook # my_notebook.ipynb in the same directory
importnb --version
Debug
Known issues
gotchaimporting a notebook with the same name as a standard library module (e.g., `json`) will shadow the standard library. Ensure filenames are unique.
fix
Rename your notebook file to avoid conflicts.
affects: all
deprecatedThe `parameterize` feature (from importnb.parameterize) is optional and may be removed in future versions. It is no longer maintained.
fix
Avoid relying on importnb.parameterize; use pytest or parametrize directly.
affects: >=0.7.0, <2023.11.1
gotchaNotebooks must have a `.ipynb` extension; files with other extensions (e.g., `.py`) are not supported.
fix
Ensure your notebook files end with .ipynb.
affects: all
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'importnb.notebook'
Incorrect import path: trying to import submodule that does not exist.
fix
Use: `from importnb import Notebook`
ValueError: The notebook file 'my_notebook.ipynb' does not exist.
The file is missing or not in the current working directory.
fix
Ensure the .ipynb file is in the same directory as your script or use sys.path.append().
SynaxError: invalid syntax in cell (notebook)
The notebook contains Python code that is not valid Python 3.x (e.g., syntax from a future version).
fix
Check notebook cells for syntax errors and ensure compatibility with your Python version.
Upgrade
Version history
2023.11.1latest on PyPI · released Nov 2, 2023
Audit
Dependencies

No dependency data recorded yet.

Agent activity
10 hits · last 30 days
node
10
Resources
importnb — pip install importnb · libregistry