diff --git a/.devcontainer/.dockerignore b/.devcontainer/.dockerignore new file mode 100644 index 000000000..28cf290ab --- /dev/null +++ b/.devcontainer/.dockerignore @@ -0,0 +1,30 @@ +**/.git +**/.gitignore +**/.vscode +**/.idea +**/.DS_Store +**/.pytest_cache +**/.mypy_cache +**/.ruff_cache +**/__pycache__ +**/*.pyc +**/*.pyo +**/*.pyd +**/.Python +**/pip-log.txt +**/pip-delete-this-directory.txt +**/.venv +**/venv +**/ENV +**/env +**/.coverage +**/.coverage.* +**/htmlcov +**/coverage.xml +**/*.cover +**/*.log +**/.hypothesis +**/dist +**/build +**/*.egg-info +**/node_modules diff --git a/.devcontainer/Containerfile b/.devcontainer/Containerfile new file mode 100644 index 000000000..fa05be7cc --- /dev/null +++ b/.devcontainer/Containerfile @@ -0,0 +1,34 @@ +FROM python:3.13-slim + +ARG USERNAME=vscode +ARG USER_UID=1000 +ARG USER_GID=$USER_UID + +RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ + && apt-get -y install --no-install-recommends \ + git \ + curl \ + wget \ + build-essential \ + sudo \ + libffi-dev \ + && groupadd --gid $USER_GID $USERNAME \ + && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ + && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ + && chmod 0440 /etc/sudoers.d/$USERNAME \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +USER $USERNAME + +RUN pip install --user pipx \ + && python -m pipx ensurepath + +ENV PATH="/home/${USERNAME}/.local/bin:${PATH}" + +RUN pipx install hatch \ + && pipx install uv + +WORKDIR /workspace + +CMD ["/bin/bash"] diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..11a53d0b3 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,35 @@ +{ + "name": "Pact Python Development", + "build": { + "dockerfile": "Containerfile", + "context": ".." + }, + "customizations": { + "vscode": { + "extensions": [ + "ms-python.python", + "ms-python.vscode-pylance", + "charliermarsh.ruff" + ], + "settings": { + "python.defaultInterpreterPath": "/usr/local/bin/python3", + "python.testing.pytestEnabled": true, + "python.testing.pytestArgs": ["tests/"], + "editor.formatOnSave": true, + "editor.codeActionsOnSave": { + "source.organizeImports": "explicit" + }, + "[python]": { + "editor.defaultFormatter": "charliermarsh.ruff" + } + } + } + }, + "containerEnv": { + "PYTHONUNBUFFERED": "1" + }, + "postCreateCommand": "git submodule update --init && hatch env create", + "remoteUser": "vscode", + "workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind,consistency=cached", + "workspaceFolder": "/workspace" +}