From a8a25f8a10bf15091a9afa3cbd4e47bffeef2cc1 Mon Sep 17 00:00:00 2001 From: bamurtaugh Date: Fri, 16 Apr 2021 20:16:19 +0000 Subject: [PATCH 1/4] Update port info, Pylance --- .devcontainer/devcontainer.json | 16 ++++++++++++---- README.md | 4 ++-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 4228328..e96e675 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -18,6 +18,7 @@ "settings": { "terminal.integrated.shell.linux": "/bin/bash", "python.pythonPath": "/usr/local/bin/python", + "python.languageServer": "Pylance", "python.linting.enabled": true, "python.linting.pylintEnabled": true, "python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8", @@ -33,16 +34,15 @@ // Add the IDs of extensions you want installed when the container is created. "extensions": [ - "ms-python.python" + "ms-python.python", + "ms-python.vscode-pylance" ], // Use 'forwardPorts' to make a list of ports inside the container available locally. // "forwardPorts": [9000], - // Use 'postCreateCommand' to run commands after the container is created. - "postCreateCommand": "pip3 install -r requirements.txt", - // Use 'portsAttributes' to set default properties for specific forwarded ports. + // You can use a port number (i.e. 3000), range of numbers, or a regex to match the running process. "portsAttributes": { "9000": { "label": "Hello Remote World", @@ -50,6 +50,14 @@ } }, + // Use 'otherPortsAttributes' to configure any ports that aren't configured using 'portsAttributes'. + // "otherPortsAttributes": { + // "onAutoForward": "silent" + // }, + + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "pip3 install -r requirements.txt", + // Comment out to connect as root instead. "remoteUser": "vscode" } diff --git a/README.md b/README.md index 661f47b..c496283 100644 --- a/README.md +++ b/README.md @@ -68,12 +68,12 @@ Some things to try: You may want to make changes to your container, such as installing a different version of a software or forwarding a new port. You'll rebuild your container for your changes to take effect. - **Forward a port statically:** As an example change, let's forward a port statically in the `.devcontainer/devcontainer.json` file. + **Open browser automatically:** As an example change, let's update the `portsAttributes` in the `.devcontainer/devcontainer.json` file to open a browser when our port is automatically forwarded. > **Note:** Remote-Containers and Codespaces also take care of dynamic port forwarding, but there may be instances in which we want to statically declare a forwarded port. - Open the `.devcontainer/devcontainer.json` file. - - Uncomment the `forwardedPorts` attribute and adjust the port number as needed. + - Modify the `"onAutoForward"` attribute in your `portsAttributes` to `"openBrowser"`. - Press F1 and select the **Remote-Containers: Rebuild Container** or **Codespaces: Rebuild Container** command so the modifications are picked up. ### More samples From 84ad4752b3a9c1a7b1acbb99632182701cfe3c63 Mon Sep 17 00:00:00 2001 From: Brigit Murtaugh Date: Fri, 16 Apr 2021 13:24:28 -0700 Subject: [PATCH 2/4] Remove unnecessary note --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index c496283..2a4f34d 100644 --- a/README.md +++ b/README.md @@ -69,8 +69,6 @@ Some things to try: You may want to make changes to your container, such as installing a different version of a software or forwarding a new port. You'll rebuild your container for your changes to take effect. **Open browser automatically:** As an example change, let's update the `portsAttributes` in the `.devcontainer/devcontainer.json` file to open a browser when our port is automatically forwarded. - - > **Note:** Remote-Containers and Codespaces also take care of dynamic port forwarding, but there may be instances in which we want to statically declare a forwarded port. - Open the `.devcontainer/devcontainer.json` file. - Modify the `"onAutoForward"` attribute in your `portsAttributes` to `"openBrowser"`. From 660123582c3490797f2814b54dd0ed1b519ef41d Mon Sep 17 00:00:00 2001 From: Brigit Murtaugh Date: Fri, 16 Apr 2021 13:31:17 -0700 Subject: [PATCH 3/4] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2a4f34d..4d0242f 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ Some things to try: **Open browser automatically:** As an example change, let's update the `portsAttributes` in the `.devcontainer/devcontainer.json` file to open a browser when our port is automatically forwarded. - Open the `.devcontainer/devcontainer.json` file. - - Modify the `"onAutoForward"` attribute in your `portsAttributes` to `"openBrowser"`. + - Modify the `"onAutoForward"` attribute in your `portsAttributes` from `"notify"` to `"openBrowser"`. - Press F1 and select the **Remote-Containers: Rebuild Container** or **Codespaces: Rebuild Container** command so the modifications are picked up. ### More samples From 1a598aa15aa4fdb7f82ebd0f61be6b92c2f18aba Mon Sep 17 00:00:00 2001 From: bamurtaugh Date: Mon, 19 Apr 2021 08:43:13 -0700 Subject: [PATCH 4/4] Update comments --- .devcontainer/devcontainer.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index e96e675..8b697f9 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -41,8 +41,7 @@ // Use 'forwardPorts' to make a list of ports inside the container available locally. // "forwardPorts": [9000], - // Use 'portsAttributes' to set default properties for specific forwarded ports. - // You can use a port number (i.e. 3000), range of numbers, or a regex to match the running process. + // Use 'portsAttributes' to set default properties for specific forwarded ports. More info: https://code.visualstudio.com/docs/remote/devcontainerjson-reference. "portsAttributes": { "9000": { "label": "Hello Remote World", @@ -58,6 +57,6 @@ // Use 'postCreateCommand' to run commands after the container is created. "postCreateCommand": "pip3 install -r requirements.txt", - // Comment out to connect as root instead. + // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. "remoteUser": "vscode" }