Skip to content

Commit

Permalink
Merge pull request marceloprates#17 from balloob/devcontainer
Browse files Browse the repository at this point in the history
Add devcontainer
  • Loading branch information
marceloprates authored Aug 28, 2021
2 parents f279bd2 9098adb commit 3a609eb
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 3 deletions.
8 changes: 8 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 1,8 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.191.1/containers/python-3/.devcontainer/base.Dockerfile

# [Choice] Python version: 3, 3.9, 3.8, 3.7, 3.6
ARG VARIANT="3.9"
FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}

# vsketch as of Aug 25, 2021
RUN pip3 --disable-pip-version-check --no-cache-dir install https://github.com/abey79/vsketch/archive/6d4b4ea1de27ba563032ce1aee02457c16d4ea60.zip
21 changes: 21 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 1,21 @@
// 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.191.1/containers/python-3
{
"name": "Prettymaps",
"postStartCommand": "script/bootstrap",
"build": {
"dockerfile": "Dockerfile",
"context": "..",
"args": {
"VARIANT": "3.9"
}
},

"settings": {
"python.pythonPath": "/usr/local/bin/python",
},

"extensions": ["ms-python.python", "ms-python.vscode-pylance"],

"remoteUser": "vscode"
}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 1,3 @@
*.py[cod]
*.egg-info
cache
6 changes: 3 additions & 3 deletions prettymaps/draw.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 106,9 @@ def plot_shapes(shapes, ax, vsketch = None, palette = None, **kwargs):

# Parse query (by coordinates, OSMId or name)
def parse_query(query):
if type(query) in([Polygon, MultiPolygon]):
if isinstance(query, (Polygon, MultiPolygon)):
return 'polygon'
elif type(query) == tuple:
elif isinstance(query, tuple):
return 'coordinates'
elif re.match('''[A-Z][0-9] ''', query):
return 'osmid'
Expand Down Expand Up @@ -227,7 227,7 @@ def plot(
ax.add_patch(PolygonPatch(geom, **drawing_kwargs['background']))
else:
vsketch.geometry(geom)

# Adjust bounds
xmin, ymin, xmax, ymax = layers['perimeter'].buffer(max_dilation).bounds
dx, dy = xmax-xmin, ymax-ymin
Expand Down
9 changes: 9 additions & 0 deletions script/bootstrap
Original file line number Diff line number Diff line change
@@ -0,0 1,9 @@
#!/bin/sh
# Resolve all dependencies that the application requires to run.

# Stop on errors
set -e

cd "$(dirname "$0")/.."

pip3 install -e .

0 comments on commit 3a609eb

Please sign in to comment.