Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .devcontainer/.dockerignore
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Thank you for using the more generic Containerfile file. To align with this, this file should probably be renamed to .containerignore

Original file line number Diff line number Diff line change
@@ -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
34 changes: 34 additions & 0 deletions .devcontainer/Containerfile
Original file line number Diff line number Diff line change
@@ -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
Comment on lines +24 to +30
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit: I would make this a bit more straightforward:

  1. Install uv (probably easiest through their curl ... | sh script)
  2. Install hatch through uv with: uv tool install hatch


WORKDIR /workspace

CMD ["/bin/bash"]
35 changes: 35 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -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"
}