From bbc98ddc5a7e2bc8461db27be13c15276473f901 Mon Sep 17 00:00:00 2001 From: Bas Nijholt <bas@nijho.lt> Date: Sat, 6 May 2023 18:37:24 -0700 Subject: [PATCH 01/10] Add a .devcontainer --- .devcontainer/devcontainer.json | 22 ++++++++++++++++++++++ environment.yml | 4 ++-- 2 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..e94fdef7b --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,22 @@ +{ + "name": "Python (Miniconda)", + "image": "mcr.microsoft.com/devcontainers/miniconda:3", + "settings": { + "terminal.integrated.shell.linux": "/bin/bash" + }, + "extensions": [ + "ms-python.python", + "ms-python.vscode-pylance", + "charliermarsh.ruff", + "eamodio.gitlens", + "GitHub.copilot", + "ms-toolsai.jupyter", + "ms-vscode-remote.vscode-remote-extensionpack", + "oderwat.indent-rainbow", + "GitHub.vscode-pull-request-github" + ], + "forwardPorts": [ + 5000 + ], + "postCreateCommand": "cd ${containerWorkspaceFolder} && pip install -e .[other,notebook,testing] && pip install ruff pre-commit && pre-commit install" +} diff --git a/environment.yml b/environment.yml index 3ae91c491..32eddab7b 100644 --- a/environment.yml +++ b/environment.yml @@ -4,7 +4,7 @@ channels: - conda-forge dependencies: - - python=3.9 + - python=3.11 - sortedcontainers - sortedcollections - scipy @@ -17,5 +17,5 @@ dependencies: - jupyter_client>=5.2.2 - ipywidgets - scikit-optimize>=0.8.1 - - scikit-learn<=0.24.2 # https://github.com/scikit-optimize/scikit-optimize/issues/1059 + - scikit-learn - plotly From aed844f9b5b538d36590d4e2ae2ac4bdd16e07b3 Mon Sep 17 00:00:00 2001 From: Bas Nijholt <bas@nijho.lt> Date: Sat, 6 May 2023 19:12:25 -0700 Subject: [PATCH 02/10] Fix name --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index e94fdef7b..da970a8eb 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,5 +1,5 @@ { - "name": "Python (Miniconda)", + "name": "Adaptive", "image": "mcr.microsoft.com/devcontainers/miniconda:3", "settings": { "terminal.integrated.shell.linux": "/bin/bash" From a1dcc6e3f847263a8e1d0c8dfc07097403b83f86 Mon Sep 17 00:00:00 2001 From: Bas Nijholt <bas@nijho.lt> Date: Sat, 6 May 2023 19:30:42 -0700 Subject: [PATCH 03/10] Do not forward ports --- .devcontainer/devcontainer.json | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index da970a8eb..1b003d298 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -7,16 +7,12 @@ "extensions": [ "ms-python.python", "ms-python.vscode-pylance", + "ms-toolsai.jupyter", "charliermarsh.ruff", "eamodio.gitlens", "GitHub.copilot", - "ms-toolsai.jupyter", "ms-vscode-remote.vscode-remote-extensionpack", - "oderwat.indent-rainbow", - "GitHub.vscode-pull-request-github" - ], - "forwardPorts": [ - 5000 + "oderwat.indent-rainbow" ], "postCreateCommand": "cd ${containerWorkspaceFolder} && pip install -e .[other,notebook,testing] && pip install ruff pre-commit && pre-commit install" } From 882bf8aa10c72cdb3896b1ec4a38413f47118ba8 Mon Sep 17 00:00:00 2001 From: Bas Nijholt <bas@nijho.lt> Date: Sat, 6 May 2023 20:20:28 -0700 Subject: [PATCH 04/10] wip --- .devcontainer/devcontainer.json | 54 ++++++++++++++++++++++++--------- 1 file changed, 40 insertions(+), 14 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 1b003d298..65042d0d9 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,18 +1,44 @@ { "name": "Adaptive", - "image": "mcr.microsoft.com/devcontainers/miniconda:3", - "settings": { - "terminal.integrated.shell.linux": "/bin/bash" + "build": { + "dockerfile": "Dockerfile", + "context": ".." }, - "extensions": [ - "ms-python.python", - "ms-python.vscode-pylance", - "ms-toolsai.jupyter", - "charliermarsh.ruff", - "eamodio.gitlens", - "GitHub.copilot", - "ms-vscode-remote.vscode-remote-extensionpack", - "oderwat.indent-rainbow" - ], - "postCreateCommand": "cd ${containerWorkspaceFolder} && pip install -e .[other,notebook,testing] && pip install ruff pre-commit && pre-commit install" + "features": { + "ghcr.io/devcontainers/features/common-utils:2": { + "installZsh": "true", + "username": "vscode", + "userUid": "1000", + "userGid": "1000", + "upgradePackages": "true" + }, + "ghcr.io/devcontainers/features/python:1": "none", + "ghcr.io/devcontainers/features/node:1": "none", + "ghcr.io/devcontainers/features/git:1": { + "version": "latest", + "ppa": "false" + }, + "ghcr.io/devcontainers-contrib/features/pipx-package:1": {}, + "ghcr.io/devcontainers-contrib/features/black:2": {}, + "ghcr.io/devcontainers-contrib/features/pre-commit:2": {} + }, + "customizations": { + "vscode": { + "extensions": [ + "ms-python.python", + "ms-python.vscode-pylance", + "ms-toolsai.jupyter", + "charliermarsh.ruff", + "eamodio.gitlens", + "GitHub.copilot", + "ms-vscode-remote.vscode-remote-extensionpack", + "oderwat.indent-rainbow" + ], + "settings": { + "python.defaultInterpreterPath": "/usr/local/bin/python" + } + } + }, + "remoteUser": "vscode", + "postCreateCommand": "pipx install ruff && pip install -e ".[other,notebook,testing]" && pre-commit install" } From 3e344700852e26da2a3a7478639099cf90d6391c Mon Sep 17 00:00:00 2001 From: Bas Nijholt <bas@nijho.lt> Date: Sat, 6 May 2023 20:32:41 -0700 Subject: [PATCH 05/10] use features --- .devcontainer/devcontainer.json | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 65042d0d9..945f094cd 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,18 +1,18 @@ { "name": "Adaptive", - "build": { - "dockerfile": "Dockerfile", - "context": ".." - }, + "image": "mcr.microsoft.com/devcontainers/python:0-3.11", "features": { "ghcr.io/devcontainers/features/common-utils:2": { - "installZsh": "true", + "configureZshAsDefaultShell": "true", "username": "vscode", "userUid": "1000", "userGid": "1000", "upgradePackages": "true" }, - "ghcr.io/devcontainers/features/python:1": "none", + "ghcr.io/devcontainers/features/python:1": { + "installTools": true, + "installJupyterlab": true + }, "ghcr.io/devcontainers/features/node:1": "none", "ghcr.io/devcontainers/features/git:1": { "version": "latest", @@ -35,10 +35,9 @@ "oderwat.indent-rainbow" ], "settings": { - "python.defaultInterpreterPath": "/usr/local/bin/python" + "python.defaultInterpreterPath": "/usr/local/python/current/bin/python" } } }, - "remoteUser": "vscode", - "postCreateCommand": "pipx install ruff && pip install -e ".[other,notebook,testing]" && pre-commit install" + "postCreateCommand": "pipx install ruff && pip install -e '.[other,notebook,testing]' && pre-commit install" } From 03f3d989656981d03c628f07ce99413fd3834df8 Mon Sep 17 00:00:00 2001 From: Bas Nijholt <bas@nijho.lt> Date: Sat, 6 May 2023 20:34:53 -0700 Subject: [PATCH 06/10] black and pipx already installed --- .devcontainer/devcontainer.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 945f094cd..94b90126a 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -18,8 +18,6 @@ "version": "latest", "ppa": "false" }, - "ghcr.io/devcontainers-contrib/features/pipx-package:1": {}, - "ghcr.io/devcontainers-contrib/features/black:2": {}, "ghcr.io/devcontainers-contrib/features/pre-commit:2": {} }, "customizations": { From 24b00480ddcc98d71377bc570409bac4f449d7f1 Mon Sep 17 00:00:00 2001 From: Bas Nijholt <bas@nijho.lt> Date: Sat, 6 May 2023 20:37:31 -0700 Subject: [PATCH 07/10] do not set pythonpath --- .devcontainer/devcontainer.json | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 94b90126a..4aba238fb 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -31,10 +31,7 @@ "GitHub.copilot", "ms-vscode-remote.vscode-remote-extensionpack", "oderwat.indent-rainbow" - ], - "settings": { - "python.defaultInterpreterPath": "/usr/local/python/current/bin/python" - } + ] } }, "postCreateCommand": "pipx install ruff && pip install -e '.[other,notebook,testing]' && pre-commit install" From d6c909ffada03dea7559e519a6b3cc4aa08ab64b Mon Sep 17 00:00:00 2001 From: Bas Nijholt <bas@nijho.lt> Date: Sun, 7 May 2023 19:05:55 -0700 Subject: [PATCH 08/10] simplify container --- .devcontainer/devcontainer.json | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 4aba238fb..bdbe659e2 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,24 +1,11 @@ { "name": "Adaptive", - "image": "mcr.microsoft.com/devcontainers/python:0-3.11", + "image": "mcr.microsoft.com/devcontainers/python:0-3.11", "features": { "ghcr.io/devcontainers/features/common-utils:2": { "configureZshAsDefaultShell": "true", - "username": "vscode", - "userUid": "1000", - "userGid": "1000", - "upgradePackages": "true" - }, - "ghcr.io/devcontainers/features/python:1": { - "installTools": true, - "installJupyterlab": true - }, - "ghcr.io/devcontainers/features/node:1": "none", - "ghcr.io/devcontainers/features/git:1": { - "version": "latest", - "ppa": "false" - }, - "ghcr.io/devcontainers-contrib/features/pre-commit:2": {} + "username": "vscode" + } }, "customizations": { "vscode": { @@ -34,5 +21,5 @@ ] } }, - "postCreateCommand": "pipx install ruff && pip install -e '.[other,notebook,testing]' && pre-commit install" + "postCreateCommand": "pipx install ruff black pre-commit && pip install -e '.[other,notebook,testing]' && pre-commit install" } From e79a4edeac8f33dcf73f8a1f5f26f8783c9e8d6e Mon Sep 17 00:00:00 2001 From: Bas Nijholt <bas@nijho.lt> Date: Sun, 7 May 2023 19:12:45 -0700 Subject: [PATCH 09/10] Add Dockerfile --- .devcontainer/Dockerfile | 17 +++++++++++++++++ .devcontainer/devcontainer.json | 8 +++++--- 2 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 .devcontainer/Dockerfile diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 000000000..ba421b566 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,17 @@ +# Start from the base image +FROM mcr.microsoft.com/devcontainers/python + +# Install packages +RUN pipx install ruff + +# Copy the project's source code +COPY . /workspace + +# Set the working directory +WORKDIR /workspace + +# Install the project's dependencies +RUN pip install -e ".[other,notebook,testing]" + +# Install pre-commit hooks +RUN pre-commit install diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index bdbe659e2..6c96ed4a8 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,6 +1,9 @@ { "name": "Adaptive", - "image": "mcr.microsoft.com/devcontainers/python:0-3.11", + "build": { + "dockerfile": "Dockerfile", + "context": ".." + }, "features": { "ghcr.io/devcontainers/features/common-utils:2": { "configureZshAsDefaultShell": "true", @@ -20,6 +23,5 @@ "oderwat.indent-rainbow" ] } - }, - "postCreateCommand": "pipx install ruff black pre-commit && pip install -e '.[other,notebook,testing]' && pre-commit install" + } } From 6cda8667a7e0a8748842862d437284472c8a9a0b Mon Sep 17 00:00:00 2001 From: Bas Nijholt <bas@nijho.lt> Date: Mon, 8 May 2023 15:47:23 -0700 Subject: [PATCH 10/10] simplify --- .devcontainer/Dockerfile | 2 +- .devcontainer/devcontainer.json | 3 --- pyproject.toml | 4 ++++ 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index ba421b566..6c5e48d31 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -11,7 +11,7 @@ COPY . /workspace WORKDIR /workspace # Install the project's dependencies -RUN pip install -e ".[other,notebook,testing]" +RUN pip install -e ".[other,notebook,testing,dev]" # Install pre-commit hooks RUN pre-commit install diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 6c96ed4a8..d3f6aa996 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -17,9 +17,6 @@ "ms-python.vscode-pylance", "ms-toolsai.jupyter", "charliermarsh.ruff", - "eamodio.gitlens", - "GitHub.copilot", - "ms-vscode-remote.vscode-remote-extensionpack", "oderwat.indent-rainbow" ] } diff --git a/pyproject.toml b/pyproject.toml index f0ea8eddf..260f97d66 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -57,6 +57,10 @@ testing = [ "pre_commit", "typeguard", ] +dev = [ + "ruff", + "pre-commit", +] [project.urls] homepage = "https://adaptive.readthedocs.io/"