Skip to main content

ipynbname

When run in a Jupyter notebook, simply returns the notebook filename or the full path to the notebook. I created this to help with automating posting blog posts written in Jupyter notebooks directly to GitHub Pages.

You would think there was already some built-in way to access the current notebook name, but it took many hours of searching for a way to do it. As it seems many others did, I tried using Javascript, but the async nature of JS meant that it was unreliable. Finally I stumbled on this post. I have refactored the code there so a user can get either the name or path, but credit for most of the code goes to the author of this post, thanks!

Examples

Get the notebook name:

import ipynbname
nb_fname = ipynbname.name()

Get the full path to the notebook:

import ipynbname
nb_path = ipynbname.path()

Limitations

Note that this only reliably works when running a notebook in a browser. So it does not currently work for things like nbconvert or papermill.

For VS Code there is a workaround.

Metadata

Release files for ipynbname 2025.8.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ipynbname 2025.8.0.0
File Size Uploaded
ipynbname-2025.8.0.0.tar.gz 4.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ipynbname 2025.8.0.0
File Interpreter ABI Platform
ipynbname-2025.8.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.9 kB

Release files / ipynbname-2025.8.0.0.tar.gz

Download URL ipynbname-2025.8.0.0.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
dcc8367c64c4a9f0baa6acea3e509fd6696bf5d81c9abceb386e2ad6efcac935
BLAKE2b-256 checksum
How to use checksums
b9e9e791d0ec7125a41c5625dc348ee28c2e335bd79ff8b31e9971333f129337
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.3

Release files / ipynbname-2025.8.0.0-py3-none-any.whl

Download URL ipynbname-2025.8.0.0-py3-none-any.whl
Size 4.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
66f6249ff26d99b0057db2aac5ced4ca8a2ccaad067b9a66d17cfc1725207966
BLAKE2b-256 checksum
How to use checksums
1b93aece384e71b25385bd6a176f09865ee52faa7bda8221acafff8753f3f30a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.3
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page