# Jupyter Hub Link with Python Code Snippet

**URL:** <https://discourse.jupyter.org/t/jupyter-hub-link-with-python-code-snippet/11518>\
**Category:** The Littlest JupyterHub\
**Tags:** jupyterhub, how-to\
**Created:** [November 2, 2021, 5:02pm UTC](https://discourse.jupyter.org/t/jupyter-hub-link-with-python-code-snippet/11518 "2021-11-02T17:02:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![elliotbarlas](https://avatars.discourse-cdn.com/v4/letter/e/a183cd/32.png) [@elliotbarlas](https://discourse.jupyter.org/u/elliotbarlas)\
**Post date:** [November 2, 2021, 5:02pm UTC](https://discourse.jupyter.org/t/jupyter-hub-link-with-python-code-snippet/11518/1 "2021-11-02T17:02:40Z")

</div>

I’m looking for a way to link to a Littlest Jupyter Hub instance with a snippet of Python that gets incorporated into a new notebook file.

The **nbgitpuller** extension works great for content in a Git repo. I’m looking for a similar user experience for arbitrary Python snippets that aren’t in notebook file with a repo.

Does an extension exist for that?

---

<div class="post-metadata">

**Author:** ![fomightez](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/fomightez/32/495_2.png) [@fomightez](https://discourse.jupyter.org/u/fomightez)\
**Post date:** [November 2, 2021, 5:25pm UTC](https://discourse.jupyter.org/t/jupyter-hub-link-with-python-code-snippet/11518/2 "2021-11-02T17:25:16Z")

</div>

Do you need it to be a plugin? Depending on the source of the Python snippet, this is a combination of a wget (or `curl`) command followed by a jupytext command. Python to a notebook is [here](https://jupytext.readthedocs.io/en/latest/using-cli.html#command-line-conversion) as:

```auto
jupytext --to notebook notebook.py  

```

You can add in `--execute` to have the notebook run as well and control the output file name with the `--output` option.

---

<div class="post-metadata">

**Author:** ![elliotbarlas](https://avatars.discourse-cdn.com/v4/letter/e/a183cd/32.png) [@elliotbarlas](https://discourse.jupyter.org/u/elliotbarlas)\
**Post date:** [November 2, 2021, 5:33pm UTC](https://discourse.jupyter.org/t/jupyter-hub-link-with-python-code-snippet/11518/3 "2021-11-02T17:33:50Z")

</div>

That’s a great suggestion, but I’m specifically curious about sharing a snippet of Python not hosted anywhere. I’d like to be able to craft a link without any ahead-of-time preparation.

---

<div class="post-metadata">

**Author:** ![fomightez](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/fomightez/32/495_2.png) [@fomightez](https://discourse.jupyter.org/u/fomightez)\
**Post date:** [November 2, 2021, 5:57pm UTC](https://discourse.jupyter.org/t/jupyter-hub-link-with-python-code-snippet/11518/4 "2021-11-02T17:57:18Z")

</div>

What about the discussion [here](https://discourse.jupyter.org/t/request-for-early-feedback-on-jupyterhub-share-link/1543/13)? Any applicable tech there?  
Or [/hub/user-redirect](https://jupyterhub.readthedocs.io/en/stable/getting-started/faq.html)?  
Or just the now built-in “Copy Shareable Link”? The newer JupyterLab seems to allow that with Python files.

---

<div class="post-metadata">

**Author:** ![elliotbarlas](https://avatars.discourse-cdn.com/v4/letter/e/a183cd/32.png) [@elliotbarlas](https://discourse.jupyter.org/u/elliotbarlas)\
**Post date:** [November 2, 2021, 6:08pm UTC](https://discourse.jupyter.org/t/jupyter-hub-link-with-python-code-snippet/11518/5 "2021-11-02T18:08:55Z")

</div>

No, not at first glance, but thank you!

---

<div class="post-metadata">

**Author:** ![elliotbarlas](https://avatars.discourse-cdn.com/v4/letter/e/a183cd/32.png) [@elliotbarlas](https://discourse.jupyter.org/u/elliotbarlas)\
**Post date:** [November 2, 2021, 6:33pm UTC](https://discourse.jupyter.org/t/jupyter-hub-link-with-python-code-snippet/11518/6 "2021-11-02T18:33:03Z")

</div>

I’m looking for a way to pass a snippet of Python as a query parameter which gets converted into a Python notebook by Jupyter Hub. The idea is conceptually very similar to the [nbgitpuller](https://tljh.jupyter.org/en/latest/howto/content/nbgitpuller.html) extension. To use that, query params including `repo`, `branch`, and others are passed to Jupyter Hub.
