{"id":23882,"library":"importnb","title":"importnb","description":"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.","status":"active","version":"2023.11.1","language":"python","source_language":"en","source_url":"https://github.com/deathbeds/importnb","tags":["jupyter","notebook","import","module","ipynb"],"install":[{"cmd":"pip install importnb","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"Notebook is a top-level import, not a submodule.","wrong":"from importnb.notebook import Notebook","symbol":"Notebook","correct":"from importnb import Notebook"},{"note":"","wrong":null,"symbol":"importnb","correct":"import importnb"}],"quickstart":{"code":"import os\nos.environ['SOME_KEY'] = 'test'  # placeholder auth\nimport importnb\nfrom importnb import Notebook\nwith Notebook():\n    import my_notebook  # my_notebook.ipynb in the same directory","lang":"python","description":"Basic usage: use Notebook context manager to import .ipynb files as modules."},"warnings":[{"fix":"Rename your notebook file to avoid conflicts.","message":"importing a notebook with the same name as a standard library module (e.g., `json`) will shadow the standard library. Ensure filenames are unique.","severity":"gotcha","affected_versions":"all"},{"fix":"Avoid relying on importnb.parameterize; use pytest or parametrize directly.","message":"The `parameterize` feature (from importnb.parameterize) is optional and may be removed in future versions. It is no longer maintained.","severity":"deprecated","affected_versions":">=0.7.0, <2023.11.1"},{"fix":"Ensure your notebook files end with .ipynb.","message":"Notebooks must have a `.ipynb` extension; files with other extensions (e.g., `.py`) are not supported.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use: `from importnb import Notebook`","cause":"Incorrect import path: trying to import submodule that does not exist.","error":"ModuleNotFoundError: No module named 'importnb.notebook'"},{"fix":"Ensure the .ipynb file is in the same directory as your script or use sys.path.append().","cause":"The file is missing or not in the current working directory.","error":"ValueError: The notebook file 'my_notebook.ipynb' does not exist."},{"fix":"Check notebook cells for syntax errors and ensure compatibility with your Python version.","cause":"The notebook contains Python code that is not valid Python 3.x (e.g., syntax from a future version).","error":"SynaxError: invalid syntax in cell (notebook)"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}