Skip to content

Commit 77ca422

Browse files
authored
Merge pull request #850 from ConservationInternational/1.2.6
Version bump to 1.2.6
2 parents bcb795e + 0503b6c commit 77ca422

39 files changed

Lines changed: 290 additions & 311 deletions

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ jobs:
2121
- uses: psf/black@stable
2222
with:
2323
options: "--check --verbose"
24-
version: "23.3.0"
24+
version: "25.1.0"

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,3 +138,5 @@ reports
138138
ext-libs/
139139
.vscode
140140
.vscode-extensions
141+
.qgis_theme>
142+
.claude

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ repos:
33
rev: 23.3.0
44
hooks:
55
- id: black
6-
language_version: python3.11
6+
language_version: python3.13
77
exclude: |
88
(?x)^(ext-libs)$

config.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"general": {
3-
"name" : "CPLUS plugin",
3+
"name" : "CPLUS",
44
"qgisMinimumVersion": 3.22,
55
"qgisMaximumVersion": 4.99,
66
"icon": "icon.svg",
@@ -13,11 +13,11 @@
1313
"tags": ["cplus", "maps", "raster", "analytics"],
1414
"category": "Plugins",
1515
"hasProcessingProvider": "no",
16-
"about": "Adds functionality to use the CPLUS decision support tool in making informed decisions, from spatial information such as land cover, carbon stocks, and potential for carbon sequestration, CPLUS enables the identification of key areas for intervention and investment.",
17-
"author": "Kartoza",
16+
"about": "CPLUS decision support tool in making informed decisions, from spatial information such as land cover, carbon stocks, and potential for carbon sequestration, CPLUS enables the identification of key areas for intervention and investment.",
17+
"author": "Kartoza with Conservation International",
1818
"email": "info@kartoza.com",
19-
"description": "QGIS plugin for the CPLUS framework",
20-
"version": "1.1.24",
19+
"description": "Climate Positive Land Use Strategy (CPLUS)",
20+
"version": "1.1.26",
2121
"changelog": ""
2222
}
2323
}

flake.lock

Lines changed: 5 additions & 99 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 188 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,193 @@
1+
# SPDX-FileCopyrightText: Tim Sutton
2+
# SPDX-License-Identifier: MIT
13
{
2-
description = "Run QGIS with extra Python packages";
3-
4-
inputs.geospatial.url = "github:imincik/geospatial-nix.repo";
5-
inputs.nixpkgs.follows = "geospatial/nixpkgs";
6-
7-
outputs = { self, geospatial, nixpkgs }: {
8-
packages.x86_64-linux.default =
9-
let
10-
pkgs = import nixpkgs {
11-
system = "x86_64-linux";
12-
};
13-
qgisWithExtras = geospatial.packages.x86_64-linux.qgis.override {
14-
extraPythonPackages = ps: [
15-
ps.pyqtwebengine
16-
ps.jsonschema
4+
description = "NixOS developer environment for QGIS plugins.";
5+
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
6+
7+
outputs = { self, nixpkgs }:
8+
let
9+
systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
10+
forAllSystems = nixpkgs.lib.genAttrs systems;
11+
12+
pkgsFor = system: import nixpkgs {
13+
inherit system;
14+
config.allowUnfree = true;
15+
};
16+
in
17+
{
18+
packages = forAllSystems (system:
19+
let
20+
pkgs = pkgsFor system;
21+
postgresWithPostGIS = pkgs.postgresql.withPackages (ps: [ ps.postgis ]);
22+
in
23+
{
24+
default = postgresWithPostGIS;
25+
postgres = postgresWithPostGIS;
26+
});
27+
28+
apps = forAllSystems (system:
29+
let
30+
pkgs = pkgsFor system;
31+
in
32+
{
33+
black-check = {
34+
type = "app";
35+
program = toString (pkgs.writeShellScript "black-check" ''
36+
#!/usr/bin/env bash
37+
set -e
38+
echo "🔍 Checking Python files with black..."
39+
find . -type f -name "*.py" -not -path "./.venv/*" -not -path "./build/*" -not -path "./.git/*" | xargs black --check --diff
40+
echo "✅ All Python files are formatted correctly!"
41+
'');
42+
};
43+
44+
black-fix = {
45+
type = "app";
46+
program = toString (pkgs.writeShellScript "black-fix" ''
47+
#!/usr/bin/env bash
48+
set -e
49+
echo "🔧 Fixing Python files with black..."
50+
find . -type f -name "*.py" -not -path "./.venv/*" -not -path "./build/*" -not -path "./.git/*" | xargs black
51+
echo "✅ All Python files have been formatted!"
52+
'');
53+
};
54+
});
55+
56+
57+
devShells = forAllSystems (system:
58+
let
59+
pkgs = pkgsFor system;
60+
postgresWithPostGIS = pkgs.postgresql.withPackages (ps: [ ps.postgis ]);
61+
in
62+
{
63+
default = pkgs.mkShell {
64+
packages = [
65+
66+
pkgs.actionlint # for checking gh actions
67+
pkgs.bandit
68+
pkgs.bearer
69+
pkgs.chafa
70+
pkgs.nixfmt-rfc-style
71+
pkgs.codeql
72+
pkgs.ffmpeg
73+
pkgs.gdb
74+
pkgs.git
75+
pkgs.minio-client # for grabbing ookla data
76+
pkgs.glogg
77+
pkgs.glow # terminal markdown viewer
78+
pkgs.gource # Software version control visualization
79+
pkgs.gum # UX for TUIs
80+
pkgs.isort
81+
pkgs.jq
82+
pkgs.luaPackages.luacheck
83+
pkgs.markdownlint-cli
84+
pkgs.nixfmt-rfc-style
85+
pkgs.pre-commit
86+
pkgs.nixfmt-rfc-style
87+
pkgs.pyprof2calltree # needed to covert cprofile call trees into a format kcachegrind can read
88+
pkgs.python313
89+
# Python development essentials
90+
pkgs.pyright
91+
pkgs.rpl
92+
pkgs.shellcheck
93+
pkgs.shfmt
94+
pkgs.stylua
95+
pkgs.yamlfmt
96+
pkgs.yamllint
97+
postgresWithPostGIS
98+
pkgs.nodePackages.cspell
99+
(pkgs.python313.withPackages (ps: [
100+
# Add these for SQL linting/formatting:
101+
ps.black
102+
ps.click # needed by black
17103
ps.debugpy
18-
ps.future
104+
ps.docformatter
105+
ps.flake8
106+
ps.gdal
107+
ps.httpx
108+
ps.jsonschema
109+
ps.mypy
110+
ps.numpy
111+
ps.odfpy
112+
ps.pandas
113+
ps.paver
114+
ps.pip
19115
ps.psutil
20-
ps.plotly
21-
];
22-
};
23-
in qgisWithExtras;
24-
};
116+
ps.pytest
117+
ps.rich
118+
ps.setuptools
119+
ps.snakeviz # For visualising cprofiler outputs
120+
ps.sqlfmt
121+
ps.toml
122+
ps.typer
123+
ps.wheel
124+
# For autocompletion in vscode
125+
126+
# This executes some shell code to initialize a venv in $venvDir before
127+
# dropping into the shell
128+
ps.venvShellHook
129+
ps.virtualenv
130+
]))
131+
132+
];
133+
shellHook = ''
134+
unset SOURCE_DATE_EPOCH
135+
136+
# Create a virtual environment in .venv if it doesn't exist
137+
if [ ! -d ".venv" ]; then
138+
python -m venv .venv
139+
fi
140+
141+
# Activate the virtual environment
142+
source .venv/bin/activate
143+
144+
# Upgrade pip and install packages from requirements.txt if it exists
145+
pip install --upgrade pip > /dev/null
146+
if [ -f requirements.txt ]; then
147+
echo "Installing Python requirements from requirements.txt..."
148+
pip install -r requirements.txt > .pip-install.log 2>&1
149+
if [ $? -ne 0 ]; then
150+
echo "❌ Pip install failed. See .pip-install.log for details."
151+
fi
152+
else
153+
echo "No requirements.txt found, skipping pip install."
154+
fi
155+
if [ -f requirements-dev.txt ]; then
156+
echo "Installing Python requirements from requirements-dev.txt..."
157+
pip install -r requirements-dev.txt > .pip-install.log 2>&1
158+
if [ $? -ne 0 ]; then
159+
echo "❌ Pip install failed. See .pip-install.log for details."
160+
fi
161+
else
162+
echo "No requirements-dev.txt found, skipping pip install."
163+
fi
164+
165+
echo "Setting up and running pre-commit hooks..."
166+
echo "-------------------------------------"
167+
pre-commit clean > /dev/null
168+
pre-commit install --install-hooks > /dev/null
169+
pre-commit run --all-files || true
170+
171+
# Colors and styling
172+
CYAN='\033[38;2;83;161;203m'
173+
GREEN='\033[92m'
174+
RED='\033[91m'
175+
RESET='\033[0m'
176+
ORANGE='\033[38;2;237;177;72m'
177+
GRAY='\033[90m'
178+
# Clear screen and show welcome banner
179+
clear
180+
echo -e "$RESET$ORANGE"
181+
echo -e " 🌈 Your Dev Environment is prepared."
182+
echo -e ""
183+
echo -e "Quick Commands:$RESET"
184+
echo -e " $GRAY▶$RESET $CYAN nix flake show$RESET - Show available configurations"
185+
echo -e " $GRAY▶$RESET $CYAN nix flake check$RESET - Run all checks"
186+
echo -e "$RESET$ORANGE \n__________________________________________________________________\n"
187+
echo ""
188+
'';
189+
};
190+
});
191+
};
25192
}
26193

0 commit comments

Comments
 (0)