Skip to content

Commit

Permalink
Adding the dev containers configuration (#21)
Browse files Browse the repository at this point in the history
Adding the dev container configuration and updating the PDM config file
to include all dependencies

resolves #19
  • Loading branch information
pvandervelde authored Aug 29, 2024
2 parents f1b0e61 + daf457d commit 7ad2bd6
Show file tree
Hide file tree
Showing 17 changed files with 321 additions and 100 deletions.
30 changes: 30 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
FROM mcr.microsoft.com/devcontainers/base:ubuntu-24.04

ARG DEBIAN_FRONTEND=noninteractive
ARG USER=vscode
RUN apt update \
&& apt install -y --no-install-recommends curl wget git sudo build-essential libssl-dev zlib1g-dev libjpeg-dev libpng-dev libbz2-dev libreadline-dev libsqlite3-dev libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev \
&& apt autoremove -y \
&& rm -rf /var/lib/apt/lists/* \
&& usermod -s /usr/bin/zsh ${USER}

USER ${USER}
ARG HOME="/home/${USER}"
WORKDIR ${HOME}

ARG PYTHON_VERSION=3.12
ENV PYENV_ROOT=${HOME}/.pyenv
ARG PYENV_PATH="${PYENV_ROOT}/bin:${PYENV_ROOT}/shims"
ARG PDM_PATH="${HOME}/.local/bin"
ENV PATH="${PYENV_PATH}:${PDM_PATH}:$PATH"
RUN set -x \
&& curl http://pyenv.run | bash \
&& echo 'eval "$(pyenv init -)"' >>${HOME}/.zshrc \
&& pyenv install -v ${PYTHON_VERSION} \
&& pyenv global ${PYTHON_VERSION}

ARG ZSH_CUSTOM=${HOME}/.oh-my-zsh/custom
RUN curl -sSL https://pdm.fming.dev/install-pdm.py | python - \
&& mkdir ${ZSH_CUSTOM}/plugins/pdm \
&& pdm completion zsh > ${ZSH_CUSTOM}/plugins/pdm/_pdm \
&& sed -i "s|^plugins=(|&pdm |" ${HOME}/.zshrc
55 changes: 55 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/python
{
"name": "Python 3",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
//"image": "mcr.microsoft.com/devcontainers/python:1-3.12-bullseye",
"build": {
"dockerfile": "Dockerfile"
},
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Add customizations for the editor
"customizations": {
"vscode": {
"extensions": [
"bierner.markdown-mermaid",
"bpruitt-goddard.mermaid-markdown-syntax-highlighting",
"DavidAnson.vscode-markdownlint",
"donjayamanne.githistory",
"eamodio.gitlens",
"formulahendry.auto-close-tag",
"GitHub.copilot-chat",
"GitHub.copilot",
"mhutchie.git-graph",
"ms-python.debugpy",
"ms-python.isort",
"ms-python.python",
"ms-python.vscode-pylance",
"redhat.vscode-yaml",
"tamasfe.even-better-toml"
],
"settings": {
"debugpy.debugJustMyCode": true,
"python.analysis.autoFormatStrings": true,
"python.analysis.inlayHints.functionReturnTypes": true,
"python.analysis.inlayHints.pytestParameters": true,
"python.analysis.inlayHints.variableTypes": true,
"python.formatting.provider": "black",
"python.linting.enabled": true,
"python.linting.mypyEnabled": true,
"python.testing.pytestArgs": [
"."
],
"python.testing.pytestEnabled": true,
"python.testing.unittestEnabled": false
}
}
},
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "bash .devcontainer/post-create.sh"
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
2 changes: 2 additions & 0 deletions .devcontainer/post-create.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#! /usr/bin/env bash
pdm sync
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
__pycache__/
.vscode/
.pytest_cache/
.venv/

verification/linear_module_first/verification_results.xlsx
verification/linear_module_first/~$verification_results.xlsx
verification/linear_body_first/~$verification_simple_4w_steering.xlsx
Expand Down
2 changes: 1 addition & 1 deletion .pdm-python
Original file line number Diff line number Diff line change
@@ -1 +1 @@
D:/dev/languages/miniforge3/python.exe
/workspaces/basic-swerve-sim/.venv/bin/python
Loading

0 comments on commit 7ad2bd6

Please sign in to comment.