diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index ed921870..e2587c63 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,21 +1,28 @@ -# nvidia/cuda:11.4.1-cudnn8-devel-ubuntu20.04 -# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.187.0/containers/python-3/.devcontainer/base.Dockerfile +# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.245.0/containers/python-3/.devcontainer/base.Dockerfile -# [Choice] Python version: 3, 3.9, 3.8, 3.7, 3.6 -ARG VARIANT="3.8" -FROM mcr.microsoft.com/vscode/devcontainers/python:${VARIANT} +# [Choice] Python version (use -bullseye variants on local arm64/Apple Silicon): 3, 3.10, 3.9, 3.8, 3.7, 3.6, 3-bullseye, 3.10-bullseye, 3.9-bullseye, 3.8-bullseye, 3.7-bullseye, 3.6-bullseye, 3-buster, 3.10-buster, 3.9-buster, 3.8-buster, 3.7-buster, 3.6-buster +ARG VARIANT="3.10" +FROM mcr.microsoft.com/devcontainers/python:0-${VARIANT} -# [Option] Install Node.js -ARG INSTALL_NODE="true" -ARG NODE_VERSION="lts/*" -RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi +# [Optional] Uncomment this section to install additional OS packages. +# https://exerror.com/importerror-libgl-so-1-cannot-open-shared-object-file-no-such-file-or-directory/ +RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ + && apt-get -y install --no-install-recommends libgl1-mesa-glx # [Optional] Uncomment this line to install global node packages. # RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g " 2>&1 +# Install poetry RUN pip install --upgrade pip RUN curl -sSL https://install.python-poetry.org | POETRY_HOME=/etc/poetry python - ENV PATH "/etc/poetry/bin:$PATH" RUN poetry completions bash >> ~/.bash_completion -RUN poetry config virtualenvs.create false \ No newline at end of file +RUN poetry config virtualenvs.create false + +# [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 +# COPY pyproject.toml poetry.locl /tmp/pip-tmp/ +# RUN cd /tmp/pip-tmp/ && poetry install \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 0383bbaf..bce8a797 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,115 +1,132 @@ -// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: -// https://github.com/microsoft/vscode-dev-containers/tree/v0.187.0/containers/python-3 +// 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", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + //"image": "mcr.microsoft.com/devcontainers/python:0-3.10", "build": { "dockerfile": "Dockerfile", "context": "..", "args": { - // Update 'VARIANT' to pick a Python version: 3, 3.6, 3.7, 3.8, 3.9, 3.10 - "VARIANT": "3.8", - // Options - "INSTALL_NODE": "true", - "NODE_VERSION": "lts/*" - }, - }, - "remoteEnv": { - "PATH": "${containerEnv:PATH}:/home/vscode/.local/bin" + "VARIANT": "3.8" + } }, "runArgs": [ //"--gpus=all", + // One of the following options is required for torch multiprocessing + //"--ipc=host", "--shm-size=2gb" ], - // Set *default* container specific settings.json values on container create. - "settings": { - "editor.tabSize": 4, - "editor.renderWhitespace": "all", - "editor.formatOnPaste": false, - "editor.formatOnSave": true, - "editor.rulers": [ - 120 - ], - "python.pythonPath": "/usr/local/bin/python", - "python.defaultInterpreterPath": "/usr/local/bin/python", - "python.languageServer": "Pylance", - "python.autoComplete.addBrackets": true, - "python.analysis.autoImportCompletions": true, - "python.analysis.completeFunctionParens": true, - "python.analysis.autoSearchPaths": true, - "python.analysis.useImportHeuristic": true, - "python.analysis.extraPaths": [ - "whos_there", - ], - "python.analysis.typeCheckingMode": "off", - "python.sortImports": true, - "python.sortImports.args": [ - "--src=${workspaceFolder}", - "--profile", - "black", - "--atomic", - "--py", - "37", - "--line-length", - "120" - ], - "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.formatting.provider": "black", - "python.formatting.blackArgs": [ - "--line-length=120" - ], - "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", - "python.linting.enabled": true, - "python.linting.pylintEnabled": false, - "python.linting.flake8Enabled": true, - "python.linting.flake8Args": [ - "--ignore=E24,W504,F401,E203,W503", - "--max-line-length=120", - "--verbose", - "--docstring-convention=google" - ], - "python.testing.autoTestDiscoverOnSaveEnabled": false, - "python.testing.pytestEnabled": true, - "python.testing.cwd": "./tests", - "python.testing.pytestArgs": [ - "-v", - ], - "[python]": { - "editor.codeActionsOnSave": { - "source.organizeImports": true - } - }, - "testExplorer.codeLens": true, - "testExplorer.gutterDecoration": true, - "autoDocstring.docstringFormat": "google", - "autoDocstring.customTemplatePath": "google-notypes.mustache", - "autoDocstring.startOnNewLine": true, - "autoDocstring.guessTypes": true, - "autoDocstring.generateDocstringOnEnter": true, + "remoteEnv": { + "PATH": "${containerEnv:PATH}:/home/vscode/.local/bin" + }, + // Features to add to the dev container. More info: https://containers.dev/features. + "features": { + "ghcr.io/devcontainers/features/git:1": {}, + "ghcr.io/devcontainers-contrib/features/pre-commit:2": {}, + "ghcr.io/dhoeric/features/act:1": {} + }, + // Configure tool-specific properties. + "customizations": { + // Configure properties specific to VS Code. + "vscode": { + // Set *default* container specific settings.json values on container create. + "settings": { + "editor.tabSize": 4, + "editor.renderWhitespace": "all", + "editor.formatOnPaste": false, + "editor.formatOnSave": true, + "editor.rulers": [ + 120 + ], + "python.pythonPath": "/usr/local/bin/python", + "python.envFile": "${workspaceFolder}/.env", + "python.defaultInterpreterPath": "/usr/local/bin/python", + "python.languageServer": "Pylance", + "python.autoComplete.addBrackets": true, + "python.analysis.autoImportCompletions": true, + "python.analysis.completeFunctionParens": true, + "python.analysis.autoSearchPaths": true, + "python.analysis.useImportHeuristic": true, + "python.analysis.typeCheckingMode": "off", + "python.analysis.diagnosticMode": "workspace", + // "python.analysis.extraPaths": [ + // "bbdc2022", + // ], + "python.sortImports": true, + "isort.args": [ + "--src=${workspaceFolder}", + "--profile", + "black", + "--atomic", + "--py", + "38", + "--line-length", + "120" + ], + "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.formatting.provider": "black", + "python.formatting.blackArgs": [ + "--line-length=120" + ], + "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", + "python.linting.enabled": true, + "python.linting.pylintEnabled": false, + "python.linting.flake8Enabled": true, + "python.linting.flake8Args": [ + "--ignore=E24,W504,F401,E203,W503,D100", + "--max-line-length=120", + "--verbose", + "--docstring-convention=google" + ], + "python.testing.autoTestDiscoverOnSaveEnabled": false, + "python.testing.pytestEnabled": true, + "python.testing.cwd": "./tests", + "python.testing.pytestArgs": [ + "-v" + ], + "[python]": { + "editor.codeActionsOnSave": { + "source.organizeImports": true + } + }, + "testExplorer.codeLens": true, + "testExplorer.gutterDecoration": true, + "autoDocstring.docstringFormat": "google-notypes", + "autoDocstring.guessTypes": true, + "autoDocstring.generateDocstringOnEnter": true, + "autoDocstring.startOnNewLine": true, + "http.proxyStrictSSL": false // required for self signed certificates + }, + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "ms-python.python", + "ms-python.vscode-pylance", + "ms-toolsai.jupyter", + "ms-vscode.test-adapter-converter", + "littlefoxteam.vscode-python-test-adapter", + "kevinrose.vsc-python-indent", + "medo64.render-crlf", + "visualstudioexptteam.vscodeintellicode", + "shardulm94.trailing-spaces", + "ms-vscode-remote.vscode-remote-extensionpack", + "njqdev.vscode-python-typehint", + "gruntfuggly.todo-tree", + "njpwerner.autodocstring", + "uctakeoff.vscode-counter", + "nhoizey.gremlins", + "mechatroner.rainbow-csv", + "KevinRose.vsc-python-indent" + ] + } }, - // Add the IDs of extensions you want installed when the container is created. - "extensions": [ - "ms-python.python", - "ms-python.vscode-pylance", - "ms-toolsai.jupyter", - "ms-vscode.test-adapter-converter", - "littlefoxteam.vscode-python-test-adapter", - "kevinrose.vsc-python-indent", - "medo64.render-crlf", - "visualstudioexptteam.vscodeintellicode", - "shardulm94.trailing-spaces", - "ms-vscode-remote.vscode-remote-extensionpack", - "njqdev.vscode-python-typehint", - "gruntfuggly.todo-tree", - "njpwerner.autodocstring", - "nhoizey.gremlins", - ], // Use 'forwardPorts' to make a list of ports inside the container available locally. // "forwardPorts": [], // Use 'postCreateCommand' to run commands after the container is created. diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0e9bfce8..43e730fb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.7", "3.8", "3.9"] + python-version: ["3.8", "3.9", "3.10"] steps: - name: Checkout