From d8eacf7c5fa2164cbb29bf2a7c80d291f3a66e93 Mon Sep 17 00:00:00 2001 From: Ram Date: Thu, 19 Nov 2020 13:51:13 +0000 Subject: [PATCH 1/6] specify code server version --- colabcode/code.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/colabcode/code.py b/colabcode/code.py index 9fae39e..2c67205 100644 --- a/colabcode/code.py +++ b/colabcode/code.py @@ -14,21 +14,26 @@ class ColabCode: - def __init__(self, port=10000, password=None, authtoken=None, mount_drive=False): + def __init__(self, port=10000, password=None, authtoken=None, mount_drive=False, code_server='latest'): self.port = port self.password = password self.authtoken = authtoken self._mount = mount_drive + self._code_server = code_server self._install_code() self._install_extensions() self._start_server() self._run_code() - def _install_code(self): + def _install_code(self): subprocess.run( ["wget", "https://code-server.dev/install.sh"], stdout=subprocess.PIPE ) - subprocess.run(["sh", "install.sh"], stdout=subprocess.PIPE) + if self._code_server = 'latest': + subprocess.run(["sh", "install.sh"], stdout=subprocess.PIPE) + else: + subprocess.run(["sh", "install.sh", "--version", str(self._code_server)], stdout=subprocess.PIPE) + def _install_extensions(self): for ext in EXTENSIONS: @@ -61,4 +66,3 @@ def _run_code(self): ) as proc: for line in proc.stdout: print(line, end="") - From d46c5a8d9c9adf489ce82191a5884b7947a8856c Mon Sep 17 00:00:00 2001 From: Ram Date: Thu, 19 Nov 2020 13:55:33 +0000 Subject: [PATCH 2/6] specify code server version --- scripts/colabcode | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/colabcode b/scripts/colabcode index 6b7354b..eb98f2e 100644 --- a/scripts/colabcode +++ b/scripts/colabcode @@ -28,7 +28,14 @@ if __name__ == "__main__": action="store_true", help="if you use --mount_drive, your google drive will be mounted", ) + optional.add_argument( + "--code_server", + action="store_true", + default="latest", + type=str + help="if you use --code_server, specify code server version in the format X.X.X", + ) args = parser.parse_args() - ColabCode(port=args.port, password=args.password, mount_drive=args.mount_drive) + ColabCode(port=args.port, password=args.password, mount_drive=args.mount_drive, code_server=args.code_server) From ecb2e6d8085960f97b6c9fa8a7b56f12b5447a31 Mon Sep 17 00:00:00 2001 From: Ram Date: Thu, 19 Nov 2020 14:14:33 +0000 Subject: [PATCH 3/6] typo --- colabcode/code.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/colabcode/code.py b/colabcode/code.py index 2c67205..4460c71 100644 --- a/colabcode/code.py +++ b/colabcode/code.py @@ -29,10 +29,10 @@ def _install_code(self): subprocess.run( ["wget", "https://code-server.dev/install.sh"], stdout=subprocess.PIPE ) - if self._code_server = 'latest': + if self._code_server == 'latest': subprocess.run(["sh", "install.sh"], stdout=subprocess.PIPE) else: - subprocess.run(["sh", "install.sh", "--version", str(self._code_server)], stdout=subprocess.PIPE) + subprocess.run(["sh", "install.sh", "--version", f"{self._code_server}"], stdout=subprocess.PIPE) def _install_extensions(self): From 91127da7f40fe67682d452a8efdca7a81ced23be Mon Sep 17 00:00:00 2001 From: Ram Date: Thu, 19 Nov 2020 14:25:44 +0000 Subject: [PATCH 4/6] inconsistency b/w setup.py and requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 967b103..6dd4e56 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -pyngrok==4.1.12 +pyngrok>=5.0.0 \ No newline at end of file From 4b0333d83223d34dd024f6eda859a1061fc71252 Mon Sep 17 00:00:00 2001 From: Ram Date: Thu, 19 Nov 2020 19:36:31 +0000 Subject: [PATCH 5/6] update readme --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4378fd8..8d9fccf 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,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 + --code_server code server version you want to use default is the latest ``` Else, you can do the following: @@ -50,14 +51,17 @@ $ ColabCode() # - 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 - -$ ColabCode(port=10000, password="abhishek", mount_drive=True) +# - code_server: code server version in the form X.X.X , default latest +$ ColabCode(port=10000, password="abhishek", mount_drive=True, code_server=3.6.0) ``` ## 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) `ColabCode` comes pre-installed with some VS Code extensions. +You can find code server release versions [here](https://github.com/cdr/code-server/releases). +>Do note you may find some versions not working, so skip them. + ##### See an example in youtube video [![YouTube Video](https://img.shields.io/youtube/views/7kTbM3D02jU?style=social)](https://youtu.be/7kTbM3D02jU) ## License From ab7058911f3a367696da47593a8d6b447e69fa4f Mon Sep 17 00:00:00 2001 From: Ramkumar M <48557182+ram-kumar-m@users.noreply.github.com> Date: Fri, 20 Nov 2020 01:10:18 +0530 Subject: [PATCH 6/6] Updated version in setup.py Updated version in setup.py from version="0.1.0" -> version="0.1.1" --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index d02f3f6..cba5027 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ setup( name="colabcode", scripts=["scripts/colabcode"], - version="0.1.0", + version="0.1.1", description="ColabCode - Run codeserver on Colab!", long_description=long_description, long_description_content_type="text/markdown",