Skip to main content

ColabShell - Run shell on Colab/Kaggle notebook!

Project description

Access Shell on Colab / Kaggle Notebook server

Installation

Installation is easy!

$ pip install git+https://github.com/sandyz1000/colabshell.git

Run ttyd server on Google Colab or Kaggle Notebooks

Getting Started

ColabShell also has a command-line script. So you can just run colabshell from command line.

colabshell -h will give the following:

usage: colabshell [-h] PORT [--password PASSWORD] [--mount_drive] [--settings_ini kafka-settings.ini]

ColabShell: Run TTYD server On Colab / Kaggle Notebooks to access the GPU machine from SHELL

required arguments:
  port PORT          the port you want to run ttyd server on

optional arguments: 
  --credential CREDENTIAL  username and password to protect your shell from unauthorized access, format username:password
  --mount_drive        if you use --mount_drive, your google drive will be mounted
  --settings_ini       Settings.ini if you want to log to kafka and listen from remote workstation

Your typical settings.ini file will look like this


[DEFAULT]
timeout = 2000000
log_level = DEBUG
log_dir = logs

; General log configuration
[LOG_FORMATTER]
to_json=True
format=%(asctime)s:%(levelname)s:%(name)s:%(message)s
; # format='%(relativeCreated)6.1f %(threadName)12s: %(levelname).1s %(module)8.8s:%(lineno)-4d %(message)s',
log_max_bytes=1024 * 1024 * 10
log_backups=5
relay_stdout=True

; # Kafka Configuration
[KAFKA]
bootstrap_servers = localhost:9094
username =
password =
topics = default,decentlog
timeout=${DEFAULT:timeout}
group_id=default-consumer
sasl_plain_username=
sasl_plain_password=
kafka_retry=5
sasl_mechanism=
security_protocol=PLAINTEXT

Starting ttyd server from SHELL

colabshell 10001 interactive --credential=user:password --settings_ini=kafka-settings.ini

Starting ttyd server from Notebook

from colabshell import ColabShell
shell = ColabShell(
  port=10001, 
  username='colabshell', password='password', 
  mount_drive=/home/gdrive, 
  settings_ini='kafka-settings.ini'
)
shell.run()

For more info about the shell check this link: https://github.com/tsl0922/ttyd

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

colabshell-0.1.0.tar.gz (6.2 kB view details)

Uploaded Source

File details

Details for the file colabshell-0.1.0.tar.gz.

File metadata

  • Download URL: colabshell-0.1.0.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.7

File hashes

Hashes for colabshell-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cd8c13bd347ba1384dbbb9add0093e6b281c7a2a54b389e618ccf37515ab3a39
MD5 929531023d16b4b3036c135d9216febc
BLAKE2b-256 35d44e99db1ecf7bef4d992a1818b70c015bfeb183da70634d57c87896c697df

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