diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 29dde7e..9c8d1cd 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -5,22 +5,58 @@ ARG USERNAME=builder ARG USER_UID=1000 ARG USER_GID=$USER_UID -FROM ${BASE_IMAGE} -ENV DEBIAN_FRONTENT=noninteractive +FROM ${BASE_IMAGE} AS packages -RUN apt-get update && apt-get upgrade -y && apt-get install libffi-dev +ENV DEBIAN_FRONTEND=noninteractive -ARG GO_URL USERNAME USER_UID USER_GID +RUN apt-get update && apt-get upgrade -y && apt-get install -y \ + build-essential clang-format gdb libffi-dev valgrind \ + curl ca-certificates gnupg2 tar g++ gcc libc6-dev make pkg-config + + +FROM packages AS go_install + +ARG GO_URL ADD ${GO_URL} /usr/src/go.tar.gz RUN tar -C /opt -xvf /usr/src/go.tar.gz + +FROM packages AS builder + +COPY --from=go_install /opt/go/ /opt/go/ ENV PATH=/opt/go/bin:$PATH +ARG USERNAME USER_UID USER_GID + RUN groupadd -g ${USER_GID} ${USERNAME} && useradd -m -u ${USER_UID} -g ${USERNAME} -s /bin/bash ${USERNAME} USER ${USERNAME} WORKDIR /home/${USERNAME} -ENV USER=${USERNAME} SHELL=/bin/bash +ENV USER=${USERNAME} SHELL=/bin/bash GOPATH=/home/${USERNAME}/go + + +FROM builder AS go_tools + +RUN go install golang.org/x/tools/gopls@latest +RUN go install github.com/go-delve/delve/cmd/dlv@latest +RUN go install github.com/ramya-rao-a/go-outline@latest +RUN go install github.com/josharian/impl@latest +RUN go install github.com/fatih/gomodifytags@latest +RUN go install github.com/haya14busa/goplay/cmd/goplay@latest +RUN go install github.com/cweill/gotests/...@latest +RUN go install honnef.co/go/tools/cmd/staticcheck@latest +RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.45.2 + + +FROM builder AS devcontainer + +ARG USERNAME + +COPY --from=go_tools /home/${USERNAME}/go/bin/ /home/${USERNAME}/go/bin + +RUN python3.10 -m pip install --user black isort tox + +ENV PATH=/home/${USERNAME}/go/bin:/home/${USERNAME}/.local/bin:$PATH diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 14b0f36..459aa19 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -10,13 +10,20 @@ "path": "/bin/bash" } }, - "python.defaultInterpreterPath": "/opt/python/cp36-cp36/bin/python3", + "python.defaultInterpreterPath": "/opt/python/cp310-cp310/bin/python3", + "go.toolsEnvVars": { + "CGO_CFLAGS": "-I/opt/python/cp310-cp310/include/python3.10", + "CGO_LDFLAGS": "-Wl,--unresolved-symbols=ignore-all" + }, + "C_Cpp.default.includePath": ["/opt/python/cp310-cp310/include/python3.10"] }, "extensions": [ "bierner.github-markdown-preview", "eamodio.gitlens", + "golang.go", "ms-python.python", "ms-python.vscode-pylance", + "ms-vscode.cpptools", "oderwat.indent-rainbow", ], } diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..b0997bf --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[tool.isort] +profile = "black" +lines_between_types = 1 diff --git a/setup.cfg b/setup.cfg index ad29aab..97b0e70 100644 --- a/setup.cfg +++ b/setup.cfg @@ -11,3 +11,7 @@ python = [testenv] deps = -r development.txt commands = pytest -v + +[flake8] +max-line-length = 180 +extend-ignore = E203, W503