From 3d5bf896a419e3cfa682e64ad63dcbf9fc579819 Mon Sep 17 00:00:00 2001 From: apthagowda97 Date: Thu, 1 Oct 2020 16:19:55 +0530 Subject: [PATCH 1/2] fix mount_drive outside colab --- README.md | 4 ++-- colabcode/code.py | 7 +++++-- scripts/colabcode | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 4378fd8..7f555fe 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ required arguments: optional arguments: --password PASSWORD password to protect your code-server from unauthorized access - --mount_drive if you use --mount_drive, your google drive will be mounted + --mount_drive if you use --mount_drive, your google drive will be mounted (Only in colab) ``` Else, you can do the following: @@ -49,7 +49,7 @@ $ ColabCode() # ColabCode has the following arguments: # - port: the port you want to run code-server on, default 10000 # - password: password to protect your code server from being accessed by someone else. Note that there is no password by default! -# - mount_drive: True or False to mount your Google Drive +# - mount_drive: True or False to mount your Google Drive (Only in colab) $ ColabCode(port=10000, password="abhishek", mount_drive=True) ``` diff --git a/colabcode/code.py b/colabcode/code.py index 6432b83..656f99b 100644 --- a/colabcode/code.py +++ b/colabcode/code.py @@ -43,8 +43,11 @@ def _start_server(self): def _run_code(self): os.system(f"fuser -n tcp -k {self.port}") - if self._mount and colab_env: - drive.mount("/content/drive") + if self._mount: + if colab_env: + drive.mount("/content/drive") + else: + print("Mounting drive is supported only in colab") if self.password: code_cmd = f"PASSWORD={self.password} code-server --port {self.port} --disable-telemetry" else: diff --git a/scripts/colabcode b/scripts/colabcode index 6b7354b..391e448 100644 --- a/scripts/colabcode +++ b/scripts/colabcode @@ -26,7 +26,7 @@ if __name__ == "__main__": optional.add_argument( "--mount_drive", action="store_true", - help="if you use --mount_drive, your google drive will be mounted", + help="if you use --mount_drive, your google drive will be mounted(Only in colab)", ) args = parser.parse_args() From 2f2ea1abe1f5128673eedb4f223112666f1b277b Mon Sep 17 00:00:00 2001 From: apthagowda97 Date: Thu, 1 Oct 2020 16:44:54 +0530 Subject: [PATCH 2/2] add kaggle-starter --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 7f555fe..f1678b7 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,8 @@ $ ColabCode(port=10000, password="abhishek", mount_drive=True) ## How to use it? Colab starter notebook: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/abhishekkrthakur/colabcode/blob/master/colab_starter.ipynb) +Kaggle starter notebook: [![Kaggle](https://kaggle.com/static/images/open-in-kaggle.svg)](https://www.kaggle.com/kernels/fork-version/43820352) + `ColabCode` comes pre-installed with some VS Code extensions. ##### See an example in youtube video [![YouTube Video](https://img.shields.io/youtube/views/7kTbM3D02jU?style=social)](https://youtu.be/7kTbM3D02jU)