Skip to content

Commit

Permalink
Merge pull request #14 from windpioneers/fix/update-config
Browse files Browse the repository at this point in the history
OPS:Update deprecated spaceship configuration values
  • Loading branch information
thclark authored Oct 16, 2022
2 parents 98076ea + 87056d7 commit 19e9839
Show file tree
Hide file tree
Showing 6 changed files with 136 additions and 6 deletions.
1 change: 1 addition & 0 deletions .devcontainer/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.zsh_history
36 changes: 36 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM windpioneers/gdal-python:button-gdal-2.4.1-python-3.9-dev

# Tell zsh where you want to store history
# We leave you to decide, but if you put this into a folder that's been mapped
# into the container, then history will persist over container rebuilds :)
#
# !!!IMPORTANT!!!
# Make sure your .zsh_history file is NOT committed into your repository, as it can contain
# sensitive information. So in this case, you should add
# .devcontainer/.zsh_history
# to your .gitignore file.
#
ENV HISTFILE="workspace/.devcontainer/.zsh_history"

# Install poetry, cache poetry dependencies
#
# Poetry usage in docker: https://stackoverflow.com/a/54763270/3556110
# Caching package downloads with buildkit: https://pythonspeed.com/articles/docker-cache-pip-downloads/
# Using pipx for python development utilities: https://github.com/microsoft/vscode-dev-containers/blob/main/containers/python-3/README.md#installing-or-updating-python-utilities
#
# Why don't we do this for you in the gdal-python image???
# - we may need to move the poetry version quicker than the base image
# - because we can't conditionally mount a cache (for dev/slim images)
# - poetry and dependencies can be agony, so we want per-project control at least for now
# - if a repo is not using poetry, it doesn't make sense for us to force the presence of the tool
USER vscode
RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
ENV PATH "/home/vscode/.poetry/bin:$PATH"
RUN poetry config virtualenvs.create false
#
# It is possible to install dependencies with a cache, like this:
# COPY pyproject.toml poetry.lock ./
# RUN --mount=type=cache,id=dev-cache,target=/home/vscode/.cache \
# poetry install --no-interaction --no-ansi
#
# However, it may be more reliable or convenient to do poetry install as a postcreate command (see devcontainer.json)
79 changes: 79 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.187.0/containers/python-3
{
"name": "gdal-python",
"build": {
"dockerfile": "../Dockerfile",
"context": "..",
"args": {
"BASE_IMAGE": "mcr.microsoft.com/vscode/devcontainers/python:0-3.9",
"GDAL_VERSION": "2.4.1"
}
},
// Set *default* container specific settings.json values on container create.
"settings": {
"austin.mode": "Wall time",
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"jupyter.widgetScriptSources": ["jsdelivr.com", "unpkg.com"],
"prettier.prettierPath": "/usr/local/prettier",
"python.defaultInterpreterPath": "/usr/local/bin/python",
"python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8",
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
"python.formatting.provider": "black",
"python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf",
"python.languageServer": "Pylance",
"python.linting.banditPath": "/usr/local/py-utils/bin/bandit",
"python.linting.enabled": true,
"python.linting.flake8Path": "/usr/local/py-utils/bin/flake8",
"python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",
"python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",
"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
// Line length to match black settings
// Disabling specific messages:
// - To find the details do: /usr/local/py-utils/bin/pylint --list-msgs
// - Disable missing-module-docstring (C0114) because we don't document modules routinely, just their members
// - Disable invalid-name (C0103) because pylint thinks that eg 'x', 'df', 'np' are invalid due to their lengths
"python.linting.pylintArgs": [
"--max-line-length=120",
"--disable=missing-module-docstring,invalid-name"
],
"python.linting.pylintEnabled": true,
"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint",
"python.pythonPath": "/usr/local/bin/python",
"terminal.integrated.defaultProfile.linux": "zsh"
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"esbenp.prettier-vscode",
"irongeek.vscode-env",
"mikestead.dotenv",
"ms-python.python",
"ms-python.vscode-pylance",
"ms-toolsai.jupyter",
"ms-toolsai.jupyter-renderers",
"ms-toolsai.jupyter-keymap",
"ms-vsliveshare.vsliveshare",
"p403n1x87.austin-vscode",
"ritwickdey.liveserver"
],

// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [80, 443, 8000],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": ". .devcontainer/postcreate.sh",

// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode",

// Allow ptrace based debuggers (like austin) to work in the container
"runArgs": [
"--env-file",
"${localWorkspaceFolder}/.env",
"--cap-add=SYS_PTRACE",
"--security-opt",
"seccomp=unconfined"
]
}
7 changes: 7 additions & 0 deletions .devcontainer/postcreate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/zsh

# ..Install dependencies here if required...


# Install precommit hooks
pre-commit install && pre-commit install -t commit-msg
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
.idea/
.idea/

# Environments
.env*
.venv
env/
venv/
ENV/
10 changes: 5 additions & 5 deletions .zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ SPACESHIP_DIR_COLOR="blue"
SPACESHIP_GIT_PREFIX=" "
SPACESHIP_GIT_BRANCH_PREFIX=""
SPACESHIP_GIT_BRANCH_COLOR="green"
SPACESHIP_PYENV_SYMBOL=""
SPACESHIP_PYENV_PREFIX=""
SPACESHIP_PYENV_SUFFIX=" "
SPACESHIP_PYENV_SYMBOL="py v"
SPACESHIP_PYENV_COLOR="magenta"
SPACESHIP_PYTHON_SYMBOL=""
SPACESHIP_PYTHON_PREFIX=""
SPACESHIP_PYTHON_SUFFIX=" "
SPACESHIP_PYTHON_SYMBOL="py v"
SPACESHIP_PYTHON_COLOR="magenta"
SPACESHIP_EXEC_TIME_PREFIX="Took "
SPACESHIP_EXEC_TIME_SUFFIX="\n"

Expand Down

0 comments on commit 19e9839

Please sign in to comment.