diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..20a1278 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,36 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/debian +{ + "name": "Debian", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "ghcr.io/geocompx/docker:suggests", + "customizations": { + // Configure properties specific to VS Code. + "vscode": { + // Add the IDs of extensions you want installed when the container is created. + "extensions": ["reditorsupport.r", + "GitHub.copilot-chat", + "GitHub.copilot-labs", + "GitHub.copilot", + "yzhang.markdown-all-in-one", + "quarto.quarto" + ] + } + }, + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" + + // Run the script install-additional-dependencies.sh: + "postCreateCommand": "bash .devcontainer/postCreateCommand.sh" + +} diff --git a/.devcontainer/postCreateCommand.sh b/.devcontainer/postCreateCommand.sh new file mode 100644 index 0000000..d24d14f --- /dev/null +++ b/.devcontainer/postCreateCommand.sh @@ -0,0 +1,46 @@ +#!/bin/bash +# Ensure we are running under Bash +if [ -z "$BASH_VERSION" ]; then + echo "This script requires Bash, but it was executed with $SHELL. Exiting." + exit 1 +fi + +# Set debugging and exit on error +set -euxo pipefail + +# Check the Linux distro we're running: +cat /etc/os-release + +# Install Rust: +curl https://sh.rustup.rs -sSf | sh -s -- -y + +# Add cargo to the path both temporarily and permanently: +export PATH="$HOME/.cargo/bin:$PATH" +echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> ~/.profile + +# Ensure cargo command is available +command -v cargo + +# Ensure apt repository is up-to-date and install necessary packages +sudo apt-get update +sudo apt-get install -y software-properties-common python3 python3-pip + +# Install Python dependencies: +# Uncomment and modify if you have a requirements.txt +# pip3 install -r requirements.txt + +# Clone and install tippecanoe if not already installed +cd /tmp +if [ ! -d "tippecanoe" ]; then + git clone https://github.com/felt/tippecanoe.git +fi +cd tippecanoe +make -j$(nproc) +sudo make install +tippecanoe --version + +# Install GitHub CLI +sudo apt install -y gh + +# Make sure there's a newline at the end of the script +echo "Script execution completed successfully." diff --git a/examples/edinburgh/setup.py b/examples/edinburgh/setup.py index ee3a332..b855e79 100644 --- a/examples/edinburgh/setup.py +++ b/examples/edinburgh/setup.py @@ -1,8 +1,13 @@ +import sys +import os import csv import json -from utils import * +# utils.py is symlinked, but this appears broken in dev containers, so add the +# parent directory +sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) +from utils import * def makeOSM(): download(