Sometimes you may want to load a Jupyter notebook from your repo to colab and run it there. Other times you may just want to add a colab link to your repository's readme page. Sure, you can download a notebook and then import that to colab. However, that may not always be ideal. The goal of this cli tool is to short-circuit that process so that you don't have to go through the extra clicks.
- The repo containing your notebook is must be public
pip install -U github-to-colab-link
The package currently generates links in two formats, one is a plain string, which you can copy and load in an web browser; another is a markdown embed which you can use in your markdown style docs, e.g. Github readmes.
# for plain string
colab-link-gen --string --gh link_to_notebook
# example
colab-link-gen --string --gh https://github.com/ShawonAshraf/jax_examples/blob/main/playground/palmers_penguins.ipynb
# for markdown embed
colab-link-gen --md --gh link_to_notebook
# example
colab-link-gen --md --gh https://github.com/ShawonAshraf/jax_examples/blob/main/playground/palmers_penguins.ipynb
- Clone the repo
- Create a
virtualenv
- Install the requirements
pip install -r requirements.txt
- The entrypoint for the cli tool is in
cli.py
(therun()
function) link.py
contains the helpers to generate the links
python -m unittest discover -s ./tests -p "*_test.py"