Skip to main content

colab_everything

Install

pip install colab_everything

Introduction

We cannot access the localhost on Google Colab, as we do on our local machine because Google Colab provides a VM(virtual machine). Hence, we will have to expose it to a public URL to access it. We can use ngrok. Ngrok exposes local servers behind NATs and firewalls to the public internet over secure tunnels.

This library hides away all the complexity and provides you simple interface to run your webapps on colab. The library can be used in the following scenario:

To test your web app before deploying it into production. To share the app with peers, friends, and clients; so that they can use/test your app and provide feedbacks.

How to use

Note: The library is only responsible for port tunneling. So, you will have setup everything required to run your web app. For example; installing all the dependecies, setting up all the environment varibles, etc.

Streamlit

from colab_everything import ColabStreamlit
ColabStreamlit('app.py') # streamlit app path

Flask

from colab_everything import ColabFlask
ColabFlask('app.py') # Flask app path

FastAPI

Note: FastAPI uses uvicorn, so the syntax is a bit different. You will have to pass only the file name (without extention). For example, pass main if your app is main.py.

from colab_everything import ColabFastapi
ColabFastapi('app') # FastAPI app file name

Any other Custom app or command

You can use ColabCustom to easily run an other app or command.

To be very honest, you will never have to use http.server because colab already provides a file explorer. The example below is just for demonstration purposes.

Note: The default port is 9999. If you are using any other port then you will have specify it twice; in the command and also in the argument.

## Using default port
from colab_everything import ColabCustom
cmd = 'python -m http.server 9999'
ColabCustom(cmd)
## Using non-default port
from colab_everything import ColabCustom
cmd = 'python -m http.server 10000'
ColabCustom(cmd, port=10000)

I am actively looking for feedbacks and contributions. Feel free to contact me at as.ankursingh3.1@gmail.com.

Release files for colab-everything 0.0.13

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for colab-everything 0.0.13
File Size Uploaded
colab_everything-0.0.13.tar.gz 8.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for colab-everything 0.0.13
File Interpreter ABI Platform
colab_everything-0.0.13-py3-none-any.whl Python 3 none any Details

Total release size: 17.5 kB

Release files / colab_everything-0.0.13.tar.gz

Download URL colab_everything-0.0.13.tar.gz
Size 8.9 kB
Tags Source
SHA-256 checksum
How to use checksums
56203e7cb18d16609f1a08c546f3c7a2384e1b15b72a596518fc195ff673a899
BLAKE2b-256 checksum
How to use checksums
06583051879792bd2f856978e5cb88dc51b8f9f92586a5cab2c75e2485a13afc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release files / colab_everything-0.0.13-py3-none-any.whl

Download URL colab_everything-0.0.13-py3-none-any.whl
Size 8.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bb6de60938ee14947886816f098c602b97e93699e5ebe06d8ed884087d443aac
BLAKE2b-256 checksum
How to use checksums
2ec2288c4eeb3748cc1bcab2d3f4b83a7d521cfd38710faa2611d0ee6c4818a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release history Release notifications | RSS feed

This release

0.0.13 This release

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page