Skip to content

Commit edfd217

Browse files
committed
Add devcontainer
Signed-off-by: Thomas Keller <[email protected]>
1 parent 5aecc36 commit edfd217

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed

.devcontainer/Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# https://github.com/devcontainers/images/tree/main/src/python
2+
FROM mcr.microsoft.com/devcontainers/python:1-3.12-bookworm
3+
4+
# Install additional packages.
5+
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
6+
# && apt-get -y install --no-install-recommends \
7+
# <your-package-list-here> \
8+
# && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/*
9+
10+
# Install UV / UVX
11+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
12+
ENV UV_COMPILE_BYTECODE=1
13+
ENV UV_LINK_MODE=copy
14+
15+
# Install project dependencies
16+
RUN --mount=type=bind,source=pyproject.toml,target=pyproject.toml \
17+
--mount=type=bind,source=uv.lock,target=uv.lock \
18+
uv sync --frozen --no-install-project --all-extras

.devcontainer/devcontainer.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/python
3+
{
4+
"name": "Python 3",
5+
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6+
"build": {
7+
// Path is relative to the devcontainer.json file.
8+
"dockerfile": "Dockerfile",
9+
"context": ".."
10+
},
11+
// Features to add to the dev container. More info: https://containers.dev/features.
12+
// "features": {},
13+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
14+
// "forwardPorts": [],
15+
// Use 'postCreateCommand' to run commands after the container is created.
16+
"postCreateCommand": "uv pip install -e ."
17+
// Configure tool-specific properties.
18+
// "customizations": {},
19+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
20+
// "remoteUser": "root"
21+
}

.vscode/settings.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"python.testing.pytestArgs": [
3+
"tests"
4+
],
5+
"python.testing.unittestEnabled": false,
6+
"python.testing.pytestEnabled": true
7+
}

0 commit comments

Comments
 (0)