Skip to content

Commit

Permalink
Merge pull request #13 from SchmidtDSE/debug/env
Browse files Browse the repository at this point in the history
Solved env issues using new mesa-geo and pixi(!) - plus much better logging and some basic veg debug
  • Loading branch information
GondekNP authored Jan 8, 2025
2 parents 65aab7d + 55a2867 commit 77a5283
Show file tree
Hide file tree
Showing 29 changed files with 6,995 additions and 277 deletions.
3 changes: 3 additions & 0 deletions .devcontainer/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# GitHub syntax highlighting
pixi.lock linguist-language=YAML

3 changes: 3 additions & 0 deletions .devcontainer/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# pixi environments
.pixi

17 changes: 10 additions & 7 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
# First, grab a Unix image with Python / Conda installed
FROM condaforge/miniforge3
# First, grab a Unix image with pixi installed
FROM ghcr.io/prefix-dev/pixi:0.18.0

# Copy over install scripts - this is a good way to keep the Dockerfile clean and readable
COPY .devcontainer/scripts .devcontainer/scripts

# Install git and ssh (note that you could also put this in a .sh for better readability)
# Install git, ssh
RUN .devcontainer/scripts/install_git_and_ssh.sh

# Then, copy the .devcontainer contents of the repo into the image - note we do this later so that we can avoid re-installing sys dependencies if the python deps change
COPY .devcontainer/python_environment.yml .devcontainer/python_environment.yml
RUN conda env create -f .devcontainer/python_environment.yml
# Copy over pixi toml and pyproject.toml
COPY pixi.toml pixi.toml
COPY pixi.lock pixi.lock

# Install pixi dependencies
RUN pixi install

# Now, copy python source code into the image - by doing this last, we can avoid re-installing ALL dependencies if just the source code changes
COPY rainfall rainfall
COPY vegetation vegetation

# Finally, keep the container running so that we can attach to it
CMD tail -f /dev/null
10 changes: 8 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@
"context": "../"
},
"mounts": [
"source=${localEnv:HOME}/.ssh,target=/root/.ssh,type=bind" // SSH keys
"source=${localEnv:HOME}/.ssh,target=/root/.ssh,type=bind", // SSH keys
"source=/local_dev_data,target=/local_dev_data,type=bind" // Local development cache
],
"extensions": ["ms-python.flake8", "ms-python.python", "ms-python.debugpy"]
"extensions": [
"ms-python.flake8",
"ms-python.python",
"ms-python.debugpy",
"ms-python.black-formatter"
]
}
20 changes: 0 additions & 20 deletions .devcontainer/python_environment.yml

This file was deleted.

4 changes: 4 additions & 0 deletions .devcontainer/scripts/install_pixi.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

curl -fsSL https://pixi.sh/install.sh | bash
export "eval "$(pixi completion --shell bash)" >> ~/.bashrc
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# GitHub syntax highlighting
pixi.lock linguist-language=YAML

27 changes: 27 additions & 0 deletions .github/workflows/todos_to_issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: "Run TODO to Issue"
on: ["push"]
jobs:
build:
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v4"
- name: "TODO to Issue"
uses: "alstr/todo-to-issue-action@v5"
with:
INSERT_ISSUE_URLS: "true"
CLOSE_ISSUES: "true"

- name: Set Git user
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Commit and Push Changes
run: |
git add -A
if [[ `git status --porcelain` ]]; then
git commit -m "Automatically added GitHub issue links to TODOs"
git push
else
echo "No changes to commit"
fi
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
*.csv
.env
__pycache__/
*.pyc
*.pyc
tst*.*
vegetation/profile_output.prof# pixi environments
.pixi

4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
"name": "Solara: Launch",
"type": "debugpy",
"request": "launch",
"cwd": "${workspaceFolder}/rainfall",
"cwd": "${workspaceFolder}/vegetation",
"module": "solara",
"args": ["run", "app.py"],
"console": "integratedTerminal",
"justMyCode": false,
"pythonPath": "/opt/conda/envs/mesa/bin/python"
"pythonPath": "/workspaces/mesa_abm_poc/.pixi/envs/default/bin/python"
}
]
}
6,132 changes: 6,132 additions & 0 deletions pixi.lock

Large diffs are not rendered by default.

37 changes: 37 additions & 0 deletions pixi.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[project]
name = "mesa"
version = "0.1.0"
description = "Add a short description here"
authors = ["GondekNP <[email protected]>"]
channels = ["main", "r", "msys2", "conda-forge"]
platforms = ["linux-64"]

[tasks]

[dependencies]

[target.linux-64.dependencies]
python = "3.11.*"
debugpy = "*"
ipython = "*"
python-dotenv = "*"
planetary-computer = "*"
pystac-client = "*"
scipy = "*"
numpy = "1.24.*"
pandas = "*"
stackstac = "*"
geopandas = "*"
rioxarray = "*"
rasterio = "1.3.*"
networkx = "3.3"
matplotlib = "*"
typing-extensions = ">=4.12.0rc1"
sqlite = "*"
pip = "*"

[target.linux-64.pypi-dependencies]
mesa = { version = "==3.1.1" }
mesa-geo = { version = "==0.9.0" }
networkx = { version = "==3.1" }
solara = "*"
47 changes: 0 additions & 47 deletions rainfall/app.py

This file was deleted.

Binary file removed rainfall/data/elevation.asc.gz
Binary file not shown.
117 changes: 0 additions & 117 deletions rainfall/rainfall/model.py

This file was deleted.

Loading

0 comments on commit 77a5283

Please sign in to comment.