Skip to content

Commit

Permalink
Merge pull request #516 from pectum83/fix-devcontainer
Browse files Browse the repository at this point in the history
Fix devcontainer
  • Loading branch information
jabesq authored Feb 14, 2025
2 parents efd855f + 7b305ed commit 8f3ab89
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 40 deletions.
31 changes: 11 additions & 20 deletions .devcontainer/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,30 +1,21 @@
ARG VARIANT="3.10"
ARG VARIANT="3.11"

FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT} as builder
FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

WORKDIR /workspaces

COPY Pipfile ./

# Create Python requirements files from pipenv (lockfile)
RUN pip3 install -U pip \
&& pip3 install pipenv \
&& pipenv lock \
&& pipenv requirements > /tmp/requirements.txt \
&& pipenv requirements --dev > /tmp/requirements_dev.txt

FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}

COPY --from=builder /tmp/requirements.txt /tmp/
COPY --from=builder /tmp/requirements_dev.txt /tmp/

# Install Python dependencies from requirements
RUN pip3 install -r /tmp/requirements.txt \
RUN pip3 install --upgrade pip \
&& pip3 install pdbpp \
&& pip3 install -r /tmp/requirements_dev.txt \
&& rm -rf /tmp/requirements.txt /tmp/requirements_dev.txt pyatmo/
&& pip3 install pre-commit \
&& pip3 install time-machine \
&& pip3 install pytest-cov

# Remove any old pytest versions that might conflict
RUN python3 -m pip install --upgrade --force-reinstall pytest \
&& rm -rf /usr/local/py-utils/venvs/pytest/bin/pytest

# Set the default shell to bash instead of sh
ENV SHELL /bin/bash
ENV SHELL="/bin/bash"
6 changes: 3 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"name": "pyatmo Dev",
"context": "..",
"context": ".",
"dockerFile": "./Dockerfile.dev",
"containerEnv": {
"DEVCONTAINER": "1"
},
"postCreateCommand": "pip3 install -e . && pre-commit run flake8",
"postCreateCommand": "pip3 install -e . && pre-commit run ruff",
"runArgs": [
"-e",
"GIT_EDITOR=code --wait"
],
"extensions": [
"ms-python.vscode-pylance",
"visualstudioexptteam.vscodeintellicode",
"visualstudioexptteam.vscodeintellicode"
],
"settings": {
"python.pythonPath": "/usr/local/bin/python",
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Note: don't use this config for your own repositories. Instead, see
# "Version control integration" in README.md.
default_stages: [commit, push]
default_stages: [pre-commit, pre-push]
exclude: ^(fixtures/)

repos:
Expand All @@ -27,7 +27,7 @@ repos:
- types-requests

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0 # Use the ref you want to point at
rev: v5.0.0 # Use the ref you want to point at
hooks:
- id: check-ast
- id: no-commit-to-branch
Expand Down
15 changes: 0 additions & 15 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,6 @@
},
"problemMatcher": []
},
{
"label": "Flake8",
"detail": "Run flake8 style checker",
"type": "shell",
"command": "pre-commit run flake8 --all-files",
"group": {
"kind": "test",
"isDefault": true
},
"presentation": {
"reveal": "always",
"panel": "new"
},
"problemMatcher": []
},
{
"label": "Pylint",
"detail": "Run pylint code analysis",
Expand Down

0 comments on commit 8f3ab89

Please sign in to comment.