Link to python file in Jupyter notebook markup cell

Suppose the following: I execute the server locally jupyter-notebookin my home directory.

I have the following files in ~/temp/jupyter_link:

index.ipynb  python_file.py

In the markup cell in index.ipynbI want to create a link to python_file.py. This link should open python_file.pyusing the jupyter-notebook editor. I can do this with:

[python_file](https://localhost:8888/edit/temp/jupyter_link/python_file.py)

However, this link contains an absolute path python_file.py. I want to use a relative path (with a base directory, which is one of index.ipynb). I can create a link using a relative path:

[python_file](python_file.py)

However, if I click on this link, I will be asked to download the file and it will not be opened by the jupyter-notebook editor.

, python jupyter-notebook, ? , , :

[python_file](edit:python_file.py)

@Ivan, ,

[python_file](/edit/temp/jupyter_link/python_file.py)

. , .

+4

Source: https://habr.com/ru/post/1657498/


All Articles