From b9e51f108b86873fa0744fc705a274094fd40b72 Mon Sep 17 00:00:00 2001 From: Mark Vandersteen Date: Fri, 13 May 2022 09:50:34 +1000 Subject: [PATCH] Addition of devcontainer for vscode --- .devcontainer/Dockerfile | 22 ++++++++++++++++ .devcontainer/devcontainer.json | 42 +++++++++++++++++++++++++++++++ sungrowinverter/configs/string.py | 2 +- 3 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..1eebb75 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,22 @@ +# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.134.0/containers/python-3/.devcontainer/base.Dockerfile +ARG VARIANT="3" +FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT} + +# [Optional] Allow the vscode user to pip install globally w/o sudo +ENV PIP_TARGET=/usr/local/pip-global +ENV PYTHONPATH=${PIP_TARGET}:${PYTHONPATH} +ENV PATH=${PIP_TARGET}/bin:${PATH} +RUN mkdir -p ${PIP_TARGET} \ + && chown vscode:root ${PIP_TARGET} \ + && echo "if [ \"\$(stat -c '%U' ${PIP_TARGET})\" != \"vscode\" ]; then chown -R vscode:root ${PIP_TARGET}; fi" \ + | tee -a /root/.bashrc /home/vscode/.bashrc /root/.zshrc >> /home/vscode/.zshrc + +# [Optional] If your pip requirements rarely change, uncomment this section to add them to the image. +COPY requirements.txt /tmp/pip-tmp/ +RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \ + && rm -rf /tmp/pip-tmp + +# [Optional] Uncomment this section to install additional OS packages. +# RUN apt-get update \ +# && export DEBIAN_FRONTEND=noninteractive \ +# && apt-get -y install --no-install-recommends \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..b57bfae --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,42 @@ +// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.134.0/containers/python-3 +{ + "name": "Python 3", + "build": { + "dockerfile": "Dockerfile", + "context": "..", + // Update 'VARIANT' to pick a Python version: 3, 3.6, 3.7, 3.8 + "args": { "VARIANT": "3.9" } + }, + + // Set *default* container specific settings.json values on container create. + "settings": { + "terminal.integrated.shell.linux": "/bin/bash", + "python.pythonPath": "/usr/local/bin/python", + "python.linting.enabled": true, + "python.linting.pylintEnabled": true, + "python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8", + "python.formatting.blackPath": "/usr/local/py-utils/bin/black", + "python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf", + "python.linting.banditPath": "/usr/local/py-utils/bin/bandit", + "python.linting.flake8Path": "/usr/local/py-utils/bin/flake8", + "python.linting.mypyPath": "/usr/local/py-utils/bin/mypy", + "python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle", + "python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle", + "python.linting.pylintPath": "/usr/local/py-utils/bin/pylint" + }, + + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "ms-python.python" + ], + + // 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", + + // Comment out to connect as root instead. + "remoteUser": "vscode" +} \ No newline at end of file diff --git a/sungrowinverter/configs/string.py b/sungrowinverter/configs/string.py index 279cfce..a380509 100644 --- a/sungrowinverter/configs/string.py +++ b/sungrowinverter/configs/string.py @@ -3,7 +3,7 @@ # Sungrow Grid Connect String Inverter Series # # Valid device types: -# SG3.0RT, SG4.0RT, SG5.0RT, SG6.0RT, SG7.0RT,SG8.0RT, SG10RT, SG12RT, SG15RT, SG17RT, SG20RT +# SG3.0RT, SG4.0RT, SG5.0RT, SG6.0RT, SG7.0RT, SG8.0RT, SG10RT, SG12RT, SG15RT, SG17RT, SG20RT # SG30KTL-M, SG30KTL-M-V31, SG33KTL-M, SG36KTL-M, SG33K3J, SG49K5J, SG34KJ, LP_P34KSG, # SG50KTL-M-20, SG60KTL, G80KTL, SG80KTL-20, SG60KU-M # SG5KTL-MT, SG6KTL-MT, SG8KTL-M, SG10KTL-M, SG10KTL-MT, SG12KTL-M, SG15KTL-M,