From 69431ef9ad4868dc609372757a04ea54d3aa8dbf Mon Sep 17 00:00:00 2001 From: Savannah Ostrowski Date: Sat, 27 May 2023 18:32:15 +0000 Subject: [PATCH 01/11] add configuration + exclude devcontainer.json from hook --- .devcontainer/Dockerfile | 10 ++++++++++ .devcontainer/devcontainer.json | 30 ++++++++++++++++++++++++++++++ .devcontainer/setup.sh | 4 ++++ .pre-commit-config.yaml | 1 + 4 files changed, 45 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json create mode 100755 .devcontainer/setup.sh diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 00000000000..267fd8fa106 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,10 @@ + +ARG IMAGE="python:3.11" +FROM --platform=amd64 mcr.microsoft.com/vscode/devcontainers/${IMAGE} +RUN apt-get update \ + && export DEBIAN_FRONTEND=noninteractive \ + && apt-get -y install --no-install-recommends build-essential libssl-dev gdb cmake + +ENV POETRY_HOME="/opt/poetry" +ENV PATH="$POETRY_HOME/bin:$PATH" +RUN curl -sSL https://install.python-poetry.org | python3 - diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000000..0ad0adb06dc --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,30 @@ +{ + "name": "Poetry", + "build": { + "dockerfile": "Dockerfile", + "context": "..", + "args": { + "IMAGE": "python:3.11" + } + }, + "postCreateCommand": "bash .devcontainer/setup.sh", + "customizations": { + "vscode": { + "settings": { + "python.formatting.blackPath": "black", + "python.formatting.provider": "black", + "python.testing.pytestEnabled": true, + "python.testing.pytestPath": "pytest", + "python.editor.codeActionsOnSave": {"source.fixAll": true}, + "python.testing.pytestArgs": [ + "tests" + ] + }, + "extensions": [ + "ms-python.python", + "ms-python.black-formatter", + "charliermarsh.ruff" + ] + } + } +} diff --git a/.devcontainer/setup.sh b/.devcontainer/setup.sh new file mode 100755 index 00000000000..678dc96acfa --- /dev/null +++ b/.devcontainer/setup.sh @@ -0,0 +1,4 @@ +poetry install +poetry run pytest +poetry run mypy +poetry run pre-commit install diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5a74e0b8f78..d1da2b21f29 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,6 +15,7 @@ repos: exclude: tests/fixtures/invalid_lock/poetry\.lock - id: check-yaml - id: pretty-format-json + exclude: .devcontainer/devcontainer.json args: [--autofix, --no-ensure-ascii, --no-sort-keys] - id: check-ast - id: debug-statements From 712ab6baed88cf419b293dfcd51f66a784090392 Mon Sep 17 00:00:00 2001 From: Savannah Ostrowski Date: Sat, 27 May 2023 18:39:49 +0000 Subject: [PATCH 02/11] Remove blank line --- .devcontainer/Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 267fd8fa106..e1128f0ae95 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,4 +1,3 @@ - ARG IMAGE="python:3.11" FROM --platform=amd64 mcr.microsoft.com/vscode/devcontainers/${IMAGE} RUN apt-get update \ From 98e917d2bc73799201b49baedabaf2544ebc2838 Mon Sep 17 00:00:00 2001 From: Savannah Ostrowski Date: Sat, 27 May 2023 18:41:08 +0000 Subject: [PATCH 03/11] undo exclude --- .devcontainer/devcontainer.json | 58 +++++++++++++++++---------------- .pre-commit-config.yaml | 1 - 2 files changed, 30 insertions(+), 29 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 0ad0adb06dc..f23b9d6f1ad 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,30 +1,32 @@ { - "name": "Poetry", - "build": { - "dockerfile": "Dockerfile", - "context": "..", - "args": { - "IMAGE": "python:3.11" - } - }, - "postCreateCommand": "bash .devcontainer/setup.sh", - "customizations": { - "vscode": { - "settings": { - "python.formatting.blackPath": "black", - "python.formatting.provider": "black", - "python.testing.pytestEnabled": true, - "python.testing.pytestPath": "pytest", - "python.editor.codeActionsOnSave": {"source.fixAll": true}, - "python.testing.pytestArgs": [ - "tests" - ] - }, - "extensions": [ - "ms-python.python", - "ms-python.black-formatter", - "charliermarsh.ruff" - ] - } - } + "name": "Poetry", + "build": { + "dockerfile": "Dockerfile", + "context": "..", + "args": { + "IMAGE": "python:3.11" + } + }, + "postCreateCommand": "bash .devcontainer/setup.sh", + "customizations": { + "vscode": { + "settings": { + "python.formatting.blackPath": "black", + "python.formatting.provider": "black", + "python.testing.pytestEnabled": true, + "python.testing.pytestPath": "pytest", + "python.editor.codeActionsOnSave": { + "source.fixAll": true + }, + "python.testing.pytestArgs": [ + "tests" + ] + }, + "extensions": [ + "ms-python.python", + "ms-python.black-formatter", + "charliermarsh.ruff" + ] + } + } } diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d1da2b21f29..5a74e0b8f78 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,7 +15,6 @@ repos: exclude: tests/fixtures/invalid_lock/poetry\.lock - id: check-yaml - id: pretty-format-json - exclude: .devcontainer/devcontainer.json args: [--autofix, --no-ensure-ascii, --no-sort-keys] - id: check-ast - id: debug-statements From caf1e7afcb30eb2f131452e0c9f024ef26e4ce6b Mon Sep 17 00:00:00 2001 From: Savannah Ostrowski Date: Sat, 27 May 2023 19:13:17 +0000 Subject: [PATCH 04/11] formatting --- docs/contributing.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/contributing.md b/docs/contributing.md index fabd60d2fb2..4aa5f3f06af 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -145,6 +145,15 @@ You should first fork the Poetry repository and then clone it locally, so that y project. If you are new to Git and pull request based development, GitHub provides a [guide](https://docs.github.com/en/get-started/quickstart/contributing-to-projects) you will find helpful. +{{% note %}} +The Poetry repo includes a [Dev Container](https://containers.dev/) configuration. + +If you already have Visual Studio Code and Docker installed, you can [click here](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/python-poetry/poetry) to get started. This will cause VS Code to automatically install the Dev Containers extension if needed, clone the source code into a container volume, and spin up a Dev Container with all dependencies and tools installed for contributing. Alternatively, you can also open your fork of the repository in Visual Studio Code using the **Dev Containers: Clone Repository in Container Volume...** command. + +If the repo is opened in GitHub Codespaces, the environment will be automatically set up for contributing with all dependencies and tools installed. + +{{% /note %}} + Next, you should install Poetry's dependencies, and run the test suite to make sure everything is working as expected: ```bash From 6cb73a7cc06f59a5a57f797351f8527b9d78deb8 Mon Sep 17 00:00:00 2001 From: Savannah Ostrowski Date: Sat, 27 May 2023 19:14:09 +0000 Subject: [PATCH 05/11] remove newline --- docs/contributing.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/contributing.md b/docs/contributing.md index 4aa5f3f06af..026208fd462 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -151,7 +151,6 @@ The Poetry repo includes a [Dev Container](https://containers.dev/) configuratio If you already have Visual Studio Code and Docker installed, you can [click here](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/python-poetry/poetry) to get started. This will cause VS Code to automatically install the Dev Containers extension if needed, clone the source code into a container volume, and spin up a Dev Container with all dependencies and tools installed for contributing. Alternatively, you can also open your fork of the repository in Visual Studio Code using the **Dev Containers: Clone Repository in Container Volume...** command. If the repo is opened in GitHub Codespaces, the environment will be automatically set up for contributing with all dependencies and tools installed. - {{% /note %}} Next, you should install Poetry's dependencies, and run the test suite to make sure everything is working as expected: From 1c43a32b654f7b8bcbf7a2302c6109087085bde3 Mon Sep 17 00:00:00 2001 From: Savannah Ostrowski Date: Sat, 27 May 2023 19:25:51 +0000 Subject: [PATCH 06/11] remove auto open link as it does not support forks --- docs/contributing.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/contributing.md b/docs/contributing.md index 026208fd462..9a95940cb65 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -146,11 +146,11 @@ project. If you are new to Git and pull request based development, GitHub provid [guide](https://docs.github.com/en/get-started/quickstart/contributing-to-projects) you will find helpful. {{% note %}} -The Poetry repo includes a [Dev Container](https://containers.dev/) configuration. +The Poetry repo includes a [Dev Container](https://containers.dev/) configuration. By opening the repo in a Dev Container, you will have all tools/dependencies, as outlined by this guide, installed for you for easy contributing. -If you already have Visual Studio Code and Docker installed, you can [click here](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/python-poetry/poetry) to get started. This will cause VS Code to automatically install the Dev Containers extension if needed, clone the source code into a container volume, and spin up a Dev Container with all dependencies and tools installed for contributing. Alternatively, you can also open your fork of the repository in Visual Studio Code using the **Dev Containers: Clone Repository in Container Volume...** command. +If you already have Visual Studio Code and Docker installed, you can install the [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) and then use the **Dev Containers: Clone Repository in Container Volume...** command to open your fork. -If the repo is opened in GitHub Codespaces, the environment will be automatically set up for contributing with all dependencies and tools installed. +If you are using GitHub Codespaces, the environment will be automatically set up when the repository is opened. {{% /note %}} Next, you should install Poetry's dependencies, and run the test suite to make sure everything is working as expected: From e287fb97497f28c8ceae33e07b060343c2371811 Mon Sep 17 00:00:00 2001 From: Savannah Ostrowski Date: Sat, 27 May 2023 19:26:56 +0000 Subject: [PATCH 07/11] reword --- docs/contributing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/contributing.md b/docs/contributing.md index 9a95940cb65..67e6c33d1c2 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -150,7 +150,7 @@ The Poetry repo includes a [Dev Container](https://containers.dev/) configuratio If you already have Visual Studio Code and Docker installed, you can install the [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) and then use the **Dev Containers: Clone Repository in Container Volume...** command to open your fork. -If you are using GitHub Codespaces, the environment will be automatically set up when the repository is opened. +If you are using GitHub Codespaces, the environment will be automatically set up for you as the container is built. {{% /note %}} Next, you should install Poetry's dependencies, and run the test suite to make sure everything is working as expected: From 9cbb6b6a7b4da3742eb1d631d2219c12c9719c90 Mon Sep 17 00:00:00 2001 From: Savannah Ostrowski Date: Sat, 27 May 2023 19:36:32 +0000 Subject: [PATCH 08/11] change context --- .devcontainer/devcontainer.json | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index f23b9d6f1ad..736d8c0dad3 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,11 +1,7 @@ { "name": "Poetry", "build": { - "dockerfile": "Dockerfile", - "context": "..", - "args": { - "IMAGE": "python:3.11" - } + "dockerfile": "Dockerfile" }, "postCreateCommand": "bash .devcontainer/setup.sh", "customizations": { From 844f788282ac7d6363ef88ebd0a074e388dafbca Mon Sep 17 00:00:00 2001 From: Savannah Ostrowski Date: Sat, 27 May 2023 20:04:43 +0000 Subject: [PATCH 09/11] format --- .devcontainer/Dockerfile | 11 ++++++----- .devcontainer/devcontainer.json | 6 +++++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index e1128f0ae95..383066eea3c 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,8 +1,9 @@ -ARG IMAGE="python:3.11" -FROM --platform=amd64 mcr.microsoft.com/vscode/devcontainers/${IMAGE} -RUN apt-get update \ - && export DEBIAN_FRONTEND=noninteractive \ - && apt-get -y install --no-install-recommends build-essential libssl-dev gdb cmake +ARG IMAGE=bullseye +FROM --platform=amd64 mcr.microsoft.com/devcontainers/${IMAGE} + +RUN export DEBIAN_FRONTEND=noninteractive \ + && apt-get update && apt-get install -y xdg-utils \ + && apt-get clean -y && rm -rf /var/lib/apt/lists/* ENV POETRY_HOME="/opt/poetry" ENV PATH="$POETRY_HOME/bin:$PATH" diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 736d8c0dad3..be11e60c9c1 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,7 +1,11 @@ { "name": "Poetry", "build": { - "dockerfile": "Dockerfile" + "dockerfile": "Dockerfile", + "args": { + "IMAGE": "python:3.11" + }, + "context": ".." }, "postCreateCommand": "bash .devcontainer/setup.sh", "customizations": { From f3e3d65667fd37364e194f6cde050c7973869ebe Mon Sep 17 00:00:00 2001 From: Savannah Ostrowski Date: Sun, 28 May 2023 02:13:38 +0000 Subject: [PATCH 10/11] use python:3 for latest --- .devcontainer/Dockerfile | 3 +-- .devcontainer/devcontainer.json | 3 --- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 383066eea3c..ed6a9c2ebb3 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,5 +1,4 @@ -ARG IMAGE=bullseye -FROM --platform=amd64 mcr.microsoft.com/devcontainers/${IMAGE} +FROM mcr.microsoft.com/devcontainers/python:3 RUN export DEBIAN_FRONTEND=noninteractive \ && apt-get update && apt-get install -y xdg-utils \ diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index be11e60c9c1..ea1d267cbd5 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -2,9 +2,6 @@ "name": "Poetry", "build": { "dockerfile": "Dockerfile", - "args": { - "IMAGE": "python:3.11" - }, "context": ".." }, "postCreateCommand": "bash .devcontainer/setup.sh", From ff80d374362cf17fcaae34f3b45bc3c0bb60938b Mon Sep 17 00:00:00 2001 From: Savannah Ostrowski Date: Thu, 6 Jul 2023 12:55:31 -0700 Subject: [PATCH 11/11] Apply suggestions from code review Co-authored-by: Josh Spicer --- .devcontainer/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index ed6a9c2ebb3..4d5fb1beb06 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/devcontainers/python:3 +FROM mcr.microsoft.com/devcontainers/python:3-bookworm RUN export DEBIAN_FRONTEND=noninteractive \ && apt-get update && apt-get install -y xdg-utils \