Skip to main content

Simply returns either notebook filename or the full path to the notebook when run from Jupyter notebook in browser.

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ipynbname-2025.8.0.0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ipynbname-2025.8.0.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file ipynbname-2025.8.0.0.tar.gz.

File metadata

  • Download URL: ipynbname-2025.8.0.0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.3

File hashes

Hashes for ipynbname-2025.8.0.0.tar.gz
Algorithm Hash digest
SHA256 dcc8367c64c4a9f0baa6acea3e509fd6696bf5d81c9abceb386e2ad6efcac935
MD5 2341609739ea61158a730717e1b5a536
BLAKE2b-256 b9e9e791d0ec7125a41c5625dc348ee28c2e335bd79ff8b31e9971333f129337

See more details on using hashes here.

File details

Details for the file ipynbname-2025.8.0.0-py3-none-any.whl.

File metadata

  • Download URL: ipynbname-2025.8.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.3

File hashes

Hashes for ipynbname-2025.8.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 66f6249ff26d99b0057db2aac5ced4ca8a2ccaad067b9a66d17cfc1725207966
MD5 9ac00cea5e80d4a44757af02c86be686
BLAKE2b-256 1b93aece384e71b25385bd6a176f09865ee52faa7bda8221acafff8753f3f30a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page