Registry / devops / ipynbname

ipynbname

JSON →
library2025.8.0.0pypypi✓ verified 84d ago

The `ipynbname` library (current version 2025.8.0.0) provides a simple utility to retrieve the filename or full path of the current Jupyter notebook when executed within a browser-based Jupyter environment or VS Code. It was created to address the lack of a built-in, reliable method for accessing this information, especially for tasks like automating blog post publishing from notebooks. The project is actively maintained with a release cadence of typically once or twice a year.

pip install ipynbname
INSTALL
IMPORT
SIG · IPYNBNAME
I
ipynbname
devopspythonv2025.8.0.0
Install
7.2s avg
Import
1665ms
Disk
112MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2025.8.0.0 · 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.920 runs
installs and imports cleanly · install 0.0s · import 1.756s · 126.3MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 7.2s · import 1.573s · 110MB
112MB installed
● package 112MB
Code
Verified usage

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

ipynbname
import ipynbname

This quickstart demonstrates how to retrieve the current Jupyter notebook's filename and full path using `ipynbname.name()` and `ipynbname.path()`. It includes basic error handling for common scenarios.

import ipynbname try: # Get the notebook filename (e.g., "MyNotebook.ipynb") nb_fname = ipynbname.name() print(f"Notebook filename: {nb_fname}") # Get the full path to the notebook nb_path = ipynbname.path() print(f"Notebook full path: {nb_path}") except FileNotFoundError as e: print(f"Error: {e}") print("This usually means ipynbname couldn't identify the notebook. Ensure you are running it in a browser-based Jupyter environment or a compatible VS Code setup.") except Exception as e: print(f"An unexpected error occurred: {e}")
Debug
Known issues
gotcha`ipynbname` is primarily designed for interactive Jupyter notebook environments (browser or VS Code). It does not reliably function when notebooks are run programmatically or converted, such as with `nbconvert` or `papermill`.
fix
Avoid using `ipynbname` in non-interactive or programmatic notebook execution workflows. If a notebook's name or path is needed in such contexts, consider passing it as an argument or using environment-specific methods.
affects: All versions
gotchaJupyter server environments secured with a password may prevent `ipynbname` from correctly identifying the notebook's name or path.
fix
If encountering issues in a password-protected Jupyter environment, consult the `ipynbname` GitHub repository for potential workarounds or reported issues. Temporarily disabling the password (for testing purposes) might help diagnose the problem.
affects: All versions
gotchaWhile `ipynbname` generally supports VS Code, specific configurations or versions might require a workaround for reliable operation.
fix
If experiencing inconsistent results in VS Code, refer to the official `ipynbname` GitHub README or PyPI page for the latest recommendations and troubleshooting steps specific to VS Code integration.
affects: All versions
Errors
Common errors & fixes
FileNotFoundError: Can't identify the notebook path.
This error typically occurs when `ipynbname` is unable to communicate with the Jupyter server or retrieve the necessary session information to determine the notebook's location. This can happen in specific JupyterHub setups, non-browser environments (like `nbconvert`), or when running in unsupported IDEs.
fix
Ensure the notebook is being run in a standard browser-based Jupyter environment or a explicitly supported VS Code setup. If using JupyterHub, verify its configuration or check for known compatibility issues on the `ipynbname` GitHub page. Avoid running `ipynbname` in headless or programmatic execution pipelines.
IndexError: list index out of range
This error usually indicates that `ipynbname`'s internal mechanism for querying the Jupyter server for active sessions or notebook information received an unexpected or empty response, preventing it from parsing the expected data structure.
fix
Restarting the Jupyter kernel or the entire Jupyter server can often resolve transient `IndexError` issues. Ensure the notebook is saved and that the Jupyter environment is stable. If the problem persists, check for environment-specific bugs on the `ipynbname` GitHub repository.
Upgrade
Version history
2025.8.0.0latest on PyPI · released Aug 17, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
ipynbname — pip install ipynbname · libregistry