diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 00000000000..4d5fb1beb06 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,9 @@ +FROM mcr.microsoft.com/devcontainers/python:3-bookworm + +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" +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..ea1d267cbd5 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,29 @@ +{ + "name": "Poetry", + "build": { + "dockerfile": "Dockerfile", + "context": ".." + }, + "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/docs/contributing.md b/docs/contributing.md index 791c4f684b6..efcf12ad2e8 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -145,6 +145,14 @@ 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. 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 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 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: ```bash