ionitist | 1 year ago | on: Using uv and PEP 723 for Self-Contained Python Scripts
I don't know of a way to do this for jupyter, but marimo (alternative notebook environment to jupyter) does support self declared dependencies, and indeed uses uv to provide that support.