Skip to main content

ColabGeek is designed to help run useful tools on Google Colab, including port forwarding, web IDE and so on. It is worth noting that this package is also compatible with other Ubuntu operating system servers, so try on other platforms as well.

Project description

ColabGeek

License: MIT PyPI version

ColabGeek Python package is designed to help run useful tools on Google Colab, including web IDE, port forwarding and so on. It is worth noting that this package is also compatible with other Ubuntu operating system based servers, so try this package on other platforms as well.

Installation

pip install ColabGeek

Get started

First load the ColabGeek module and update all the packages and dependencies in the system.

import ColabGeek

ColabGeek.update_environment()

Initiate the Colab session by adding linux users and mounting Google Drive.

main = ColabGeek.ColabSession(user='Knight',password='midnight',mount_GD=True)

Web IDE methods

As a cloud computing platform based on Jupyter notebooks, Google Colab does not provide a top-notch comfortable environment for R language data analysis and other non-Python programming. Therefore, this project provides methods for quickly installing other web IDEs on Google Colab, enabling it to expand its range of capabilities.

Run code server

code server is a web IDE provided by Coder that enables developers to write, run and debug code from a web browser. It is built on the open-source Visual Studio Code editor and offers many of the same features, such as code highlighting, auto completion, and debugging.

# ColabGeek.Run_code_server has the following parameters:
# - port The port you want to run code server on, set to None to use the default port.
# - password The code server login password, set to None and use the linux user password by default.
# - verbose Show the running logs.

main.Run_code_server()

You can also install code server extension by providing extension id or the path of the VSIX file downloaded from vscode marketplace.

# ColabGeek.Install_code_server_extension has the following parameters:
# - extension The extension id or the path of the VSIX file.
# - verbose Show the running logs.

main.Install_code_server_extension(extension='ms-python.anaconda-extension-pack')

You can also config code server through ColabGeek.Config_code_server method.

# ColabGeek.Config_code_server has the following parameters:
# - property Matching the key in settings.json config file.
# - value Matching the value in settings.json config file.

main.Config_code_server(property='workbench.colorTheme',value='Default Dark+')
main.Config_code_server(property='editor.fontSize',value=18)
main.Config_code_server(property='terminal.integrated.fontSize',value=18)
main.Config_code_server(property='files.autoSave',value='off')

Run Rstudio server

Rstudio server is a web IDE for R programming. With Rstudio server, users can run R scripts, create and manage R projects, develop and test code, and share their work with others. Rstudio server also offers powerful features such as syntax highlighting, code completion, debugging and data visualization.

# ColabGeek.Run_Rstudio_server has the following parameters:
# - port The port you want to run Rstudio server on, set to None to use the default port.
# - verbose Show the running logs.

main.Run_Rstudio_server()

Run JupyterLab

JupyterLab is an interactive web IDE for working with Jupyter notebooks, code, and data. It is a flexible and extensible platform designed to support the entire workflow in data science, scientific computing, and machine learning projects. ColabGeek pulls the mrdoge/jupyterlab docker image from Docker Hub and execute the docker container using udocker. Notice that it is not recommended to run udocker and JupyterLab under user root.

# ColabGeek.Run_JupyterLab has the following parameters:
# - port The port you want to run JupyterLab on, set to None to use the default port.
# - password The JupyterLab login password, set to None and use the linux user password by default.
# - mount_Colab Whether map the Colab /content directory to the JupyterLab container /content directory.
# - verbose Show the running logs.

main.Run_JupyterLab()

Port forwarding methods

Google Colab does not allow any internet connections to their servers except the official web interface. So, port forwarding methods are required to proxy the web IDE installed.

localtunnel

# ColabGeek.Run_localtunnel has the following parameters:
# - port The port you want to expose to localtunnel, set to None and you will use the default port.
# - host Check the localtunnel document.
# - subdomain The customized localtunnel URL, check the localtunnel document. (Do not include '_' in the subdomain!)
# - verbose Show the running logs.

main.Run_localtunnel()

ngrok

# ColabGeek.Run_ngrok has the following parameters:
# - token The token of your personal ngrok account. Sign up one, it is free.
# - port The port you want to expose to ngrok, set to None and you will use the default port.
# - domain The customized ngrok URL, check the ngrok document.
# - verbose Show the running logs.

main.Run_ngrok()

Cloudflare Tunnel

# ColabGeek.Run_Cloudflare_Tunnel has the following parameters:
# - token The token of your tunnels created on Cloudflare.
# - verbose Show the running logs.

main.Run_Cloudflare_Tunnel(token='replace with your own tunnel token!')

Other methods

shadowsocks

Although not allowed by Google and not recommended by myself, building a proxy server using Colab sounds pretty 'Geek'. However, this function only helps to install and run shadowsocks on Colab, and I have no clue how to connect to the shadowsocks server. Just use this method on your own Ubuntu servers, that should work. If you have any good ideas, leave an issue please!

# ColabGeek.Run_shadowsocks has the following parameters:
# - port The server port of shadowsocks, set to None and you will use the default port.
# - password The shadowsocks password.
# - encrypt The shadowsocks encrypt method.
# - verbose Show the running logs.

main.Run_shadowsocks()

Jekyll

Jekyll is a simple, blog-aware, static site generator that allows users to create their own websites or blogs without the need for databases or server-side programming languages. It takes text written in Markdown, processes it through a template engine, and generates a ready-to-publish static website. ColabGeek now provides a method to automatically install Jekyll and all of its dependencies. Users can easily access their Jekyll sites using tunneling methods, also provided by ColabGeek.

# ColabGeek.Install_Jekyll has the following parameters:
# - Ruby_version Which version of Ruby you would like to install? The latest stable version is recommended.
# - verbose Show the running logs.

main.Install_Jekyll(Ruby_version='3.2.2',verbose=True)

Stable Diffusion WebUI

Stable Diffusion is a deep learning, text-to-image model released in 2022 based on diffusion techniques. It is primarily used to generate detailed images conditioned on text descriptions, though it can also be applied to other tasks such as inpainting, outpainting, and generating image-to-image translations guided by a text prompt. Stable Diffusion WebUI is a browser interface for Stable Diffusion that allows to create beautiful art much more easily. Stable Diffusion WebUI can be easily installed through ColabGeek and conveniently accessed using the tunneling method also provided by ColabGeek.

# ColabGeek.Run_stable_diffusion_webui has the following parameters:
# - path The installation path for Stable Diffusion WebUI, which is defaulted to /tmp.
# - port The port you want to run the browser interface on, set to None to use the default port.
# - verbose Show the running logs.
# - args Custom parameters for installing and running Stable Diffusion WebUI.
# - **kwargs Custom parameters for installing and running Stable Diffusion WebUI. Cannot be used in conjunction with the args parameter.

main.Run_stable_diffusion_webui()

# Use tunneling method built in Stable Diffusion WebUI:
# main.Run_stable_diffusion_webui(args='--share --gradio-auth username:password')
# main.Run_stable_diffusion_webui(share='')

Statement

ColabGeek violated numerous community rules of Google Colab. But still, I developed ColabGeek, because the simple Jupyter interface just does not meet the requirements of many software applications and is not user-friendly for coding in non-Python languages. I recommend all ColabGeek users purchase Colab Pro or Pro+ to support the excellent services provided by Google. Keep in mind, avoid misuse and Don't Be Evil.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

colabgeek-1.3.7.tar.gz (15.6 kB view details)

Uploaded Source

Built Distribution

ColabGeek-1.3.7-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

File details

Details for the file colabgeek-1.3.7.tar.gz.

File metadata

  • Download URL: colabgeek-1.3.7.tar.gz
  • Upload date:
  • Size: 15.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.12

File hashes

Hashes for colabgeek-1.3.7.tar.gz
Algorithm Hash digest
SHA256 930d1b0e3670474452c89146f859fcad1ad3f380705c9ab0c494392ec35ab6c0
MD5 d99fe2c43b1eb161fc7516785d6c33f1
BLAKE2b-256 4648e755a49926a9ab49c08be1d7b43ce5cd11c68d9717e29166338f5cfcc880

See more details on using hashes here.

File details

Details for the file ColabGeek-1.3.7-py3-none-any.whl.

File metadata

  • Download URL: ColabGeek-1.3.7-py3-none-any.whl
  • Upload date:
  • Size: 14.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.12

File hashes

Hashes for ColabGeek-1.3.7-py3-none-any.whl
Algorithm Hash digest
SHA256 5faba1210d1880f56f6e3d9f4a51b53e7de4fe3843e39df500481ab1b2b05b1b
MD5 d898fafffbeeb70e4c704138d85a2a31
BLAKE2b-256 83dfe0e289b3d3488d9fc86a58d50aa1ad26262a99424ae142b4c7c432668cc4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page