From 1c6462fb7627dff21fcf16bb559f09fa54bac90f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Odd=20Str=C3=A5b=C3=B8?= Date: Sun, 2 Jul 2023 00:26:27 +0000 Subject: [PATCH 1/4] Add devcontainer config --- .devcontainer/Python 3.11/devcontainer.json | 33 +++++++++++++++++++++ .gitignore | 3 +- .vscode/extensions.json | 5 ++++ requirements-dev.txt | 9 ++++++ 4 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 .devcontainer/Python 3.11/devcontainer.json create mode 100644 .vscode/extensions.json diff --git a/.devcontainer/Python 3.11/devcontainer.json b/.devcontainer/Python 3.11/devcontainer.json new file mode 100644 index 00000000..154e481d --- /dev/null +++ b/.devcontainer/Python 3.11/devcontainer.json @@ -0,0 +1,33 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/python +{ + "name": "Python 3.11", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "mcr.microsoft.com/devcontainers/python:1-3.11-bookworm", + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "pip3 install --user -r requirements-dev.txt", + + // Configure tool-specific properties. + "customizations": { + "vscode": { + "extensions": [ + "mikestead.dotenv", + "EditorConfig.EditorConfig", + "GitHub.vscode-pull-request-github", + "hbenl.vscode-test-explorer", + "redhat.vscode-xml", + "ninoseki.vscode-pylens" + ] + } + } + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} diff --git a/.gitignore b/.gitignore index a3b78682..0dec07e4 100644 --- a/.gitignore +++ b/.gitignore @@ -66,7 +66,8 @@ Thumbs.db .idea/ .DS_Store -.vscode/ +.vscode/* +!.vscode/extensions.json pyinstrument/ # Now managed by templates diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 00000000..894e9d73 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,5 @@ +{ + "recommendations": [ + "ms-vscode-remote.remote-containers" + ] +} diff --git a/requirements-dev.txt b/requirements-dev.txt index d17fb063..a6cd519a 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -15,3 +15,12 @@ coverage >= 5.2 flake8 >= 3.8 flake8-import-order >= 0.18 websocket-client >= 0.57.0 + +types-requests >= 2.31 +types-PyYAML >= 6.0.12 +types-six >= 1.13 +types-python-dateutil >= 2.8.1 +types-setuptools >= 44.1.1 + +types-Pygments +types-colorama From ca4b8c973c9e0961bd7380aae23e0239ca285998 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Odd=20Str=C3=A5b=C3=B8?= Date: Sun, 2 Jul 2023 01:55:17 +0000 Subject: [PATCH 2/4] Add Python 2.7 devcontainer --- .devcontainer/Python 2.7/devcontainer.json | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .devcontainer/Python 2.7/devcontainer.json diff --git a/.devcontainer/Python 2.7/devcontainer.json b/.devcontainer/Python 2.7/devcontainer.json new file mode 100644 index 00000000..ce0f9a92 --- /dev/null +++ b/.devcontainer/Python 2.7/devcontainer.json @@ -0,0 +1,38 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/debian +{ + "name": "Python 2.7", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "mcr.microsoft.com/devcontainers/base:bullseye", + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + "features": { + "ghcr.io/devcontainers-contrib/features/apt-get-packages:1": { + "packages": "python2" + } + }, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "sudo ln -s /usr/bin/python2.7 /usr/bin/python; curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output /tmp/get-pip.py && sudo python /tmp/get-pip.py && pip install --user -r requirements-dev.txt", + + // Configure tool-specific properties. + "customizations": { + "vscode": { + "extensions": [ + "mikestead.dotenv", + "EditorConfig.EditorConfig", + "GitHub.vscode-pull-request-github", + "hbenl.vscode-test-explorer", + "redhat.vscode-xml", + "ninoseki.vscode-pylens" + ] + } + } + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} From e89ed438399da272f90b6123aecdbe412c365727 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Odd=20Str=C3=A5b=C3=B8?= Date: Sun, 2 Jul 2023 16:17:50 +0000 Subject: [PATCH 3/4] Add PyYAML to dev dependencies --- requirements-dev.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index a6cd519a..2649a745 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -3,6 +3,7 @@ six >= 1.13 python-dateutil >= 2.8.1 requests >= 2.22 futures >= 2.2; python_version < '3.0' +PyYAML >= 6.0 Kodistubs ~= 18.0; python_version < '3.0' Kodistubs ~= 20.0; python_version >= '3.6' @@ -17,7 +18,7 @@ flake8-import-order >= 0.18 websocket-client >= 0.57.0 types-requests >= 2.31 -types-PyYAML >= 6.0.12 +types-PyYAML >= 6.0 types-six >= 1.13 types-python-dateutil >= 2.8.1 types-setuptools >= 44.1.1 From 11955e1af236e8e354191cb2fb346df1a0c3ed3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Odd=20Str=C3=A5b=C3=B8?= Date: Sun, 2 Jul 2023 16:32:29 +0000 Subject: [PATCH 4/4] Add base vscode settings --- .gitignore | 1 + .vscode/settings.json | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 .vscode/settings.json diff --git a/.gitignore b/.gitignore index 0dec07e4..7dfead0d 100644 --- a/.gitignore +++ b/.gitignore @@ -68,6 +68,7 @@ Thumbs.db .DS_Store .vscode/* !.vscode/extensions.json +!.vscode/settings.json pyinstrument/ # Now managed by templates diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..9009f569 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,16 @@ +{ + "editor.formatOnSave": true, + "python.formatting.provider": "black", + "python.linting.enabled": true, + "python.linting.flake8Enabled": true, + "python.linting.mypyEnabled": true, + "python.testing.pytestEnabled": true, + "python.analysis.diagnosticMode": "workspace", + "files.associations": { + "requirements-*.txt": "pip-requirements" + }, + "sonarlint.connectedMode.project": { + "connectionId": "jellyfin", + "projectKey": "jellyfin_jellyfin-kodi" + }, +}