diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 2921ef46..5b21c9d1 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,3 +1,9 @@ FROM mcr.microsoft.com/devcontainers/python:1-3.12 +COPY --from=ghcr.io/astral-sh/uv:0.5 /uv /usr/local/bin/ + +RUN --mount=type=bind,source=requirements_dev.txt,target=/tmp/requirements_dev.txt \ + --mount=type=bind,source=requirements.txt,target=/tmp/requirements.txt \ + uv pip install -r /tmp/requirements_dev.txt --system + CMD ["sleep", "infinity"] diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index ff415689..b3ef9582 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -24,6 +24,8 @@ "vscode": { "extensions": [ "ms-python.python", + "ms-python.pylint", + "mikoz.black-py", "visualstudioexptteam.vscodeintellicode", "mhutchie.git-graph", "ms-azuretools.vscode-docker", diff --git a/.devcontainer/post_create.sh b/.devcontainer/post_create.sh index ecbe144d..4aa843e9 100755 --- a/.devcontainer/post_create.sh +++ b/.devcontainer/post_create.sh @@ -2,12 +2,4 @@ set -euxo pipefail -pip install --disable-pip-version-check --upgrade pip - -pip install pre-commit - -pip install -r requirements_dev.txt & - -pre-commit install --install-hooks & - -wait +pre-commit install --install-hooks diff --git a/.devcontainer/set_dot_env.sh b/.devcontainer/set_dot_env.sh index 5d6b0582..617d34e2 100755 --- a/.devcontainer/set_dot_env.sh +++ b/.devcontainer/set_dot_env.sh @@ -7,8 +7,8 @@ readonly wanted_line="${wanted_line_key}='${PWD}'" readonly file=".env" echo "Writing ${wanted_line} to ${file}" >&2 -if [[ -f "${file}" ]] && grep --quiet "^${wanted_line_key}=" "${file}"; then - sed "s,^${wanted_line_key}=.*,${wanted_line}," "${file}" +if [[ -f "${file}" ]] && grep -q "^${wanted_line_key}=" "${file}"; then + sed -i "s,^${wanted_line_key}=.*,${wanted_line}," "${file}" else echo "${wanted_line}" >>"${file}" fi diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 7b150f46..f7244639 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,7 +1,7 @@ --- name: Build -on: # yamllint disable-line rule:truthy +on: # yamllint disable-line rule:truthy push: branches: - master @@ -24,10 +24,13 @@ jobs: uses: actions/setup-python@v5.3.0 with: python-version: ${{ env.DEFAULT_PYTHON }} + - name: Install uv + uses: astral-sh/setup-uv@v3 + with: + version: "0.5" - name: Install requirements run: | - pip install pip - pip install -r requirements_dev.txt + uv pip install -r requirements_dev.txt --system - name: Run pre-commit on all files run: | pre-commit run --all-files --show-diff-on-failure --color=always @@ -64,10 +67,13 @@ jobs: uses: "actions/setup-python@v5.3.0" with: python-version: ${{ env.DEFAULT_PYTHON }} + - name: Install uv + uses: astral-sh/setup-uv@v3 + with: + version: "0.5" - name: Install requirements run: | - pip install pip - pip install -r requirements_dev.txt + uv pip install -r requirements_dev.txt --system - name: Tests suite run: | pytest -p no:sugar diff --git a/.vscode/settings.json b/.vscode/settings.json index bd40af61..8da4c9a6 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,8 +1,7 @@ { - "python.linting.pylintEnabled": true, - "python.linting.enabled": true, - "python.formatting.provider": "black", - "python.testing.pytestArgs": ["--no-cov", "-p", "no:sugar", "tests"], - "python.testing.unittestEnabled": false, - "python.testing.pytestEnabled": true + "python.testing.pytestArgs": ["--no-cov", "-p", "no:sugar"], + "python.testing.pytestEnabled": true, + "[python]": { + "editor.defaultFormatter": "mikoz.black-py" + } } diff --git a/docker-compose.yml b/docker-compose.yml index 90c89815..320546ab 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,9 @@ --- services: devcontainer: - build: .devcontainer + build: + context: . + dockerfile: .devcontainer/Dockerfile init: true env_file: - .env