Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add devcontainer file and define path for utils.py #76

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -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"

}
46 changes: 46 additions & 0 deletions .devcontainer/postCreateCommand.sh
Original file line number Diff line number Diff line change
@@ -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."
7 changes: 6 additions & 1 deletion examples/edinburgh/setup.py
Original file line number Diff line number Diff line change
@@ -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__), "..")))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be symlinks for all the examples to make utils.py work. Is it not working in the devcontainer for some reason?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ye, this "../utils.py" not working in the devcontainer

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a comment explaining this


from utils import *

def makeOSM():
download(
Expand Down