From fec09a5f4455b7711d41cc24612ad451ba7a7891 Mon Sep 17 00:00:00 2001 From: Wietse van Gerwen <41104904+wvangerwen@users.noreply.github.com> Date: Thu, 15 May 2025 17:07:38 +0000 Subject: [PATCH 1/6] add linux support postinstall --- bin/install_hrt.sh | 13 +++++++++++++ bin/install_htt.sh | 10 ++++++++++ pixi.toml | 13 +++++++++++-- 3 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 bin/install_hrt.sh create mode 100644 bin/install_htt.sh diff --git a/bin/install_hrt.sh b/bin/install_hrt.sh new file mode 100644 index 0000000..a2043a8 --- /dev/null +++ b/bin/install_hrt.sh @@ -0,0 +1,13 @@ +#!/bin/bash +set -e # Exit on error + +# Optional: echo commands for debugging +# set -x + +# Check if the directory ../hhnk-research-tools exists +if [ ! -d "../hhnk-research-tools" ]; then + git clone https://github.com/HHNK/hhnk-research-tools/ ../hhnk-research-tools +fi + +# Install the package in editable mode without dependencies +pip install --no-deps -e ../hhnk-research-tools \ No newline at end of file diff --git a/bin/install_htt.sh b/bin/install_htt.sh new file mode 100644 index 0000000..66d82e5 --- /dev/null +++ b/bin/install_htt.sh @@ -0,0 +1,10 @@ +#!/bin/bash +set -e # Exit on any error + +# Clone the repo if it doesn't exist +if [ ! -d "../hhnk-threedi-tools" ]; then + git clone https://github.com/threedi/hhnk-threedi-tools/ ../hhnk-threedi-tools +fi + +# Install with the same pip flags as in the Windows script +pip install --no-build-isolation --no-deps --disable-pip-version-check -e ../hhnk-threedi-tools diff --git a/pixi.toml b/pixi.toml index 0be5092..6184642 100644 --- a/pixi.toml +++ b/pixi.toml @@ -5,6 +5,15 @@ platforms = ["win-64", "linux-64"] version = "2025.1" # repository = "https://github.com/HHNK/spoc_hhnk" + +[target.win-64.tasks] +hrt-install = "bin/install_hrt.cmd" +htt-install = "bin/install_htt.cmd" + +[target.linux-64.tasks] +hrt-install = "bash bin/install_hrt.sh" +htt-install = "bash bin/install_htt.sh" + [tasks] #Styling sort_imports = "python -m ruff check ./**/*.py --select I --fix --force-exclude" @@ -13,10 +22,9 @@ style = {depends-on = ["sort_imports", "fmt"]} # `pixi run style` lab = "jupyter lab" -htt-install = "bin/install_htt.cmd" hrt-install = "bin/install_hrt.cmd" pre-commit-install = "pre-commit install --install-hooks -t=pre-push" #-t=pre-commit -postinstall = { depends-on = ["htt-install", "hrt-install", "pre-commit-install"] } +postinstall = { depends-on = ["hrt-install", "htt-install", "pre-commit-install"] } pre-commit-run = "pre-commit run --all-files" @@ -24,6 +32,7 @@ pre-commit-run = "pre-commit run --all-files" code = "code" code_insiders = "code-insiders" + [feature.test.tasks] tests = "python -m pytest tests_demo/" From 96237b6f520f8b85b45683169b9aa8d493748086 Mon Sep 17 00:00:00 2001 From: Wietse van Gerwen <41104904+wvangerwen@users.noreply.github.com> Date: Thu, 15 May 2025 17:08:38 +0000 Subject: [PATCH 2/6] add codespaces readme --- README.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ed9e67c..9c5203c 100644 --- a/README.md +++ b/README.md @@ -198,4 +198,14 @@ De resultaten zijn op de repo te zien onder [Actions](https://github.com/HHNK/py # AI helpers -Zelf thuis een [Ollama](https://ollama.com/) installatie draaien waarmee je lokaal AI kan draaien. Met de [Continue](https://docs.continue.dev/getting-started/install) extension zijn code-hints mogelijk zonder de limieten van de free-tier van [Copilot](https://code.visualstudio.com/docs/copilot/overview). Hiervoor is wel een redelijke GPU nodig. Ervaring tot nu is net iets minder dan de online tools. \ No newline at end of file +Zelf thuis een [Ollama](https://ollama.com/) installatie draaien waarmee je lokaal AI kan draaien. Met de [Continue](https://docs.continue.dev/getting-started/install) extension zijn code-hints mogelijk zonder de limieten van de free-tier van [Copilot](https://code.visualstudio.com/docs/copilot/overview). Hiervoor is wel een redelijke GPU nodig. Ervaring tot nu is net iets minder dan de online tools. + + +# Codespaces +Github Codespace geven een platform om zonder installties in de cloud ook te werken met een github branch en vs-code. Via de hoofdpagina van de repo https://github.com/HHNK/python-workflow-demo klikken op de groene `Code` rechtsboven en vanuit daar een Codespace aanmaken. + +Vervolgens moet de environment geinstalleerd worden en enkele vs-code extensions (zie boven). Verdere stappen +- `curl -fsSL https://pixi.sh/install.sh | sh` in terminal vs-code -> install pixi +- ctrl+shift+` -> restart shell +- `pixi install` +- `pixi run postinstall` \ No newline at end of file From de0fcf4c46090b342c51bd3b7593da3c8afafd30 Mon Sep 17 00:00:00 2001 From: wietsevangerwen <41104904+wvangerwen@users.noreply.github.com> Date: Thu, 15 May 2025 19:11:06 +0200 Subject: [PATCH 3/6] add hrt deps (fixees tests) --- pixi.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pixi.toml b/pixi.toml index 6184642..875ad4b 100644 --- a/pixi.toml +++ b/pixi.toml @@ -60,6 +60,8 @@ urllib3 = "<2.0" #threedi-api-client pytest = "*" pytest-cov = "*" pre-commit = "*" +seaborn = "*" +rasterstats = "*" [pypi-dependencies] python-dotenv = "*" From 73cec164cb5190fd5576cf1d01b45c76b57e359c Mon Sep 17 00:00:00 2001 From: wietsevangerwen <41104904+wvangerwen@users.noreply.github.com> Date: Thu, 15 May 2025 19:12:36 +0200 Subject: [PATCH 4/6] remove duplicate task --- pixi.lock | 154 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ pixi.toml | 1 - 2 files changed, 154 insertions(+), 1 deletion(-) diff --git a/pixi.lock b/pixi.lock index 74444e8..7d7961e 100644 --- a/pixi.lock +++ b/pixi.lock @@ -242,6 +242,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/linux-64/pandas-2.2.3-py312hf9745cd_1.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pandocfilters-1.5.0-pyhd8ed1ab_0.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/noarch/parso-0.8.4-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/patsy-1.0.1-pyhd8ed1ab_1.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/pcre2-10.44-hba22ea6_2.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pexpect-4.9.0-pyhd8ed1ab_1.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pickleshare-0.7.5-pyhd8ed1ab_1004.conda @@ -282,6 +283,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/linux-64/pyzmq-26.3.0-py312hbf22597_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/qhull-2020.2-h434a139_5.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/rasterio-1.4.3-py312h021bea1_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/rasterstats-0.20.0-pyhd8ed1ab_1.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/rav1e-0.6.6-he8a937b_2.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/re2-2024.07.02-h9925aae_3.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/readline-8.2-h8c095d6_2.conda @@ -299,10 +301,13 @@ environments: - conda: https://conda.anaconda.org/conda-forge/linux-64/s2n-1.5.14-h6c98b2b_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/scikit-learn-1.6.1-py312h7a48858_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/scipy-1.15.2-py312ha707e6e_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/seaborn-0.13.2-hd8ed1ab_3.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/seaborn-base-0.13.2-pyhd8ed1ab_3.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/secretstorage-3.3.3-py312h7900ff3_3.conda - conda: https://conda.anaconda.org/conda-forge/noarch/send2trash-1.8.3-pyh0d859eb_1.conda - conda: https://conda.anaconda.org/conda-forge/noarch/setuptools-75.8.2-pyhff2d567_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/shapely-2.0.7-py312h21f5128_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/simplejson-3.20.1-py312h66e93f0_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/six-1.17.0-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/snappy-1.2.1-h8bd8927_1.conda - conda: https://conda.anaconda.org/conda-forge/noarch/sniffio-1.3.1-pyhd8ed1ab_1.conda @@ -310,6 +315,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/noarch/soupsieve-2.5-pyhd8ed1ab_1.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/sqlite-3.49.1-h9eae976_2.conda - conda: https://conda.anaconda.org/conda-forge/noarch/stack_data-0.6.3-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/statsmodels-0.14.4-py312hc0a28a1_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/svt-av1-3.0.1-h5888daf_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/terminado-0.18.1-pyh0d859eb_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/threadpoolctl-3.6.0-pyhecae5ae_0.conda @@ -587,6 +593,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/win-64/pandas-2.2.3-py312h72972c8_1.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pandocfilters-1.5.0-pyhd8ed1ab_0.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/noarch/parso-0.8.4-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/patsy-1.0.1-pyhd8ed1ab_1.conda - conda: https://conda.anaconda.org/conda-forge/win-64/pcre2-10.44-h3d7b363_2.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pickleshare-0.7.5-pyhd8ed1ab_1004.conda - conda: https://conda.anaconda.org/conda-forge/win-64/pillow-11.1.0-py312h078707f_0.conda @@ -627,6 +634,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/win-64/pyzmq-26.3.0-py312hd7027bb_0.conda - conda: https://conda.anaconda.org/conda-forge/win-64/qhull-2020.2-hc790b64_5.conda - conda: https://conda.anaconda.org/conda-forge/win-64/rasterio-1.4.3-py312ha172ac9_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/rasterstats-0.20.0-pyhd8ed1ab_1.conda - conda: https://conda.anaconda.org/conda-forge/win-64/rav1e-0.6.6-h975169c_2.conda - conda: https://conda.anaconda.org/conda-forge/win-64/re2-2024.07.02-haf4117d_3.conda - conda: https://conda.anaconda.org/conda-forge/noarch/readme_renderer-44.0-pyhd8ed1ab_1.conda @@ -642,9 +650,12 @@ environments: - conda: https://conda.anaconda.org/conda-forge/win-64/ruff-0.11.0-py312hc33538c_0.conda - conda: https://conda.anaconda.org/conda-forge/win-64/scikit-learn-1.6.1-py312h816cc57_0.conda - conda: https://conda.anaconda.org/conda-forge/win-64/scipy-1.15.2-py312h451d5c4_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/seaborn-0.13.2-hd8ed1ab_3.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/seaborn-base-0.13.2-pyhd8ed1ab_3.conda - conda: https://conda.anaconda.org/conda-forge/noarch/send2trash-1.8.3-pyh5737063_1.conda - conda: https://conda.anaconda.org/conda-forge/noarch/setuptools-75.8.2-pyhff2d567_0.conda - conda: https://conda.anaconda.org/conda-forge/win-64/shapely-2.0.7-py312h3f81574_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/simplejson-3.20.1-py312h4389bb4_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/six-1.17.0-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/win-64/snappy-1.2.1-h500f7fa_1.conda - conda: https://conda.anaconda.org/conda-forge/noarch/sniffio-1.3.1-pyhd8ed1ab_1.conda @@ -652,6 +663,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/noarch/soupsieve-2.5-pyhd8ed1ab_1.conda - conda: https://conda.anaconda.org/conda-forge/win-64/sqlite-3.49.1-h2466b09_2.conda - conda: https://conda.anaconda.org/conda-forge/noarch/stack_data-0.6.3-pyhd8ed1ab_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/statsmodels-0.14.4-py312h1a27103_0.conda - conda: https://conda.anaconda.org/conda-forge/win-64/svt-av1-3.0.1-he0c23c2_0.conda - conda: https://conda.anaconda.org/conda-forge/win-64/tbb-2021.13.0-h62715c5_1.conda - conda: https://conda.anaconda.org/conda-forge/noarch/terminado-0.18.1-pyh5737063_0.conda @@ -891,6 +903,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/linux-64/orc-2.1.1-h17f744e_1.conda - conda: https://conda.anaconda.org/conda-forge/noarch/packaging-24.2-pyhd8ed1ab_2.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/pandas-2.2.3-py312hf9745cd_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/patsy-1.0.1-pyhd8ed1ab_1.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/pcre2-10.44-hba22ea6_2.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/pillow-11.1.0-py312h80c1187_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pip-25.0.1-pyh8b19718_0.conda @@ -918,6 +931,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/linux-64/pyyaml-6.0.2-py312h178313f_2.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/qhull-2020.2-h434a139_5.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/rasterio-1.4.3-py312h021bea1_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/rasterstats-0.20.0-pyhd8ed1ab_1.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/rav1e-0.6.6-he8a937b_2.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/re2-2024.07.02-h9925aae_3.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/readline-8.2-h8c095d6_2.conda @@ -927,12 +941,16 @@ environments: - conda: https://conda.anaconda.org/conda-forge/linux-64/s2n-1.5.14-h6c98b2b_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/scikit-learn-1.6.1-py312h7a48858_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/scipy-1.15.2-py312ha707e6e_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/seaborn-0.13.2-hd8ed1ab_3.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/seaborn-base-0.13.2-pyhd8ed1ab_3.conda - conda: https://conda.anaconda.org/conda-forge/noarch/setuptools-75.8.2-pyhff2d567_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/shapely-2.0.7-py312h21f5128_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/simplejson-3.20.1-py312h66e93f0_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/six-1.17.0-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/snappy-1.2.1-h8bd8927_1.conda - conda: https://conda.anaconda.org/conda-forge/noarch/snuggs-1.4.7-pyhd8ed1ab_2.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/sqlite-3.49.1-h9eae976_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/statsmodels-0.14.4-py312hc0a28a1_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/svt-av1-3.0.1-h5888daf_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/threadpoolctl-3.6.0-pyhecae5ae_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/tk-8.6.13-noxft_h4845f30_101.conda @@ -1122,6 +1140,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/win-64/orc-2.1.1-h35764e3_1.conda - conda: https://conda.anaconda.org/conda-forge/noarch/packaging-24.2-pyhd8ed1ab_2.conda - conda: https://conda.anaconda.org/conda-forge/win-64/pandas-2.2.3-py312h72972c8_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/patsy-1.0.1-pyhd8ed1ab_1.conda - conda: https://conda.anaconda.org/conda-forge/win-64/pcre2-10.44-h3d7b363_2.conda - conda: https://conda.anaconda.org/conda-forge/win-64/pillow-11.1.0-py312h078707f_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/pip-25.0.1-pyh8b19718_0.conda @@ -1148,6 +1167,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/win-64/pyyaml-6.0.2-py312h31fea79_2.conda - conda: https://conda.anaconda.org/conda-forge/win-64/qhull-2020.2-hc790b64_5.conda - conda: https://conda.anaconda.org/conda-forge/win-64/rasterio-1.4.3-py312ha172ac9_1.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/rasterstats-0.20.0-pyhd8ed1ab_1.conda - conda: https://conda.anaconda.org/conda-forge/win-64/rav1e-0.6.6-h975169c_2.conda - conda: https://conda.anaconda.org/conda-forge/win-64/re2-2024.07.02-haf4117d_3.conda - conda: https://conda.anaconda.org/conda-forge/noarch/requests-2.32.3-pyhd8ed1ab_1.conda @@ -1155,12 +1175,16 @@ environments: - conda: https://conda.anaconda.org/conda-forge/win-64/ruff-0.11.0-py312hc33538c_0.conda - conda: https://conda.anaconda.org/conda-forge/win-64/scikit-learn-1.6.1-py312h816cc57_0.conda - conda: https://conda.anaconda.org/conda-forge/win-64/scipy-1.15.2-py312h451d5c4_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/seaborn-0.13.2-hd8ed1ab_3.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/seaborn-base-0.13.2-pyhd8ed1ab_3.conda - conda: https://conda.anaconda.org/conda-forge/noarch/setuptools-75.8.2-pyhff2d567_0.conda - conda: https://conda.anaconda.org/conda-forge/win-64/shapely-2.0.7-py312h3f81574_1.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/simplejson-3.20.1-py312h4389bb4_0.conda - conda: https://conda.anaconda.org/conda-forge/noarch/six-1.17.0-pyhd8ed1ab_0.conda - conda: https://conda.anaconda.org/conda-forge/win-64/snappy-1.2.1-h500f7fa_1.conda - conda: https://conda.anaconda.org/conda-forge/noarch/snuggs-1.4.7-pyhd8ed1ab_2.conda - conda: https://conda.anaconda.org/conda-forge/win-64/sqlite-3.49.1-h2466b09_2.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/statsmodels-0.14.4-py312h1a27103_0.conda - conda: https://conda.anaconda.org/conda-forge/win-64/svt-av1-3.0.1-he0c23c2_0.conda - conda: https://conda.anaconda.org/conda-forge/win-64/tbb-2021.13.0-h62715c5_1.conda - conda: https://conda.anaconda.org/conda-forge/noarch/threadpoolctl-3.6.0-pyhecae5ae_0.conda @@ -6411,6 +6435,18 @@ packages: - pkg:pypi/parso?source=hash-mapping size: 75295 timestamp: 1733271352153 +- conda: https://conda.anaconda.org/conda-forge/noarch/patsy-1.0.1-pyhd8ed1ab_1.conda + sha256: ab52916f056b435757d46d4ce0a93fd73af47df9c11fd72b74cc4b7e1caca563 + md5: ee23fabfd0a8c6b8d6f3729b47b2859d + depends: + - numpy >=1.4.0 + - python >=3.9 + license: BSD-2-Clause AND PSF-2.0 + license_family: BSD + purls: + - pkg:pypi/patsy?source=hash-mapping + size: 186594 + timestamp: 1733792482894 - conda: https://conda.anaconda.org/conda-forge/linux-64/pcre2-10.44-hba22ea6_2.conda sha256: 1087716b399dab91cc9511d6499036ccdc53eb29a288bebcb19cf465c51d7c0d md5: df359c09c41cd186fffb93a2d87aa6f5 @@ -7331,6 +7367,25 @@ packages: - pkg:pypi/rasterio?source=hash-mapping size: 7869724 timestamp: 1742429400145 +- conda: https://conda.anaconda.org/conda-forge/noarch/rasterstats-0.20.0-pyhd8ed1ab_1.conda + sha256: 2d549a6cbb14d076e123e9e97c79c347cc0c5b82d55771be1fde86001a14ef4b + md5: d0bf36963569fa8b1843cb4c3e5cd74b + depends: + - affine + - click >7.1 + - cligj >=0.4 + - fiona + - numpy >=1.9 + - python >=3.9 + - rasterio >=1.0 + - shapely + - simplejson + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/rasterstats?source=hash-mapping + size: 20855 + timestamp: 1734603044778 - conda: https://conda.anaconda.org/conda-forge/linux-64/rav1e-0.6.6-he8a937b_2.conda sha256: 91b3c1ced90d04ee2eded1f72cf3cbc19ff05a25e41876ef0758266a5bab009f md5: 77d9955b4abddb811cb8ab1aa7d743e4 @@ -7680,6 +7735,35 @@ packages: - pkg:pypi/scipy?source=hash-mapping size: 15350553 timestamp: 1739793319263 +- conda: https://conda.anaconda.org/conda-forge/noarch/seaborn-0.13.2-hd8ed1ab_3.conda + noarch: python + sha256: ea29a69b14dd6be5cdeeaa551bf50d78cafeaf0351e271e358f9b820fcab4cb0 + md5: 62afb877ca2c2b4b6f9ecb37320085b6 + depends: + - seaborn-base 0.13.2 pyhd8ed1ab_3 + - statsmodels >=0.12 + license: BSD-3-Clause + license_family: BSD + purls: [] + size: 6876 + timestamp: 1733730113224 +- conda: https://conda.anaconda.org/conda-forge/noarch/seaborn-base-0.13.2-pyhd8ed1ab_3.conda + sha256: f209c9c18187570b85ec06283c72d64b8738f825b1b82178f194f4866877f8aa + md5: fd96da444e81f9e6fcaac38590f3dd42 + depends: + - matplotlib-base >=3.4,!=3.6.1 + - numpy >=1.20,!=1.24.0 + - pandas >=1.2 + - python >=3.9 + - scipy >=1.7 + constrains: + - seaborn =0.13.2=*_3 + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/seaborn?source=hash-mapping + size: 227843 + timestamp: 1733730112409 - conda: https://conda.anaconda.org/conda-forge/linux-64/secretstorage-3.3.3-py312h7900ff3_3.conda sha256: c6d5d0bc7fb6cbfa3b8be8f2399a3c1308b3392a4e20bd1a0f29a828fda5ab20 md5: 4840da9db2808db946a0d979603c6de4 @@ -7764,6 +7848,35 @@ packages: - pkg:pypi/shapely?source=hash-mapping size: 537509 timestamp: 1741167468116 +- conda: https://conda.anaconda.org/conda-forge/linux-64/simplejson-3.20.1-py312h66e93f0_0.conda + sha256: 22041442f0659ef55073ca8536708115cdf6ac19d461a4db6840dc9b4d534ced + md5: d1c95aa4908e88bd4216f04b6bb7e297 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=13 + - python >=3.12,<3.13.0a0 + - python_abi 3.12.* *_cp312 + license: MIT + license_family: MIT + purls: + - pkg:pypi/simplejson?source=hash-mapping + size: 130844 + timestamp: 1739781086613 +- conda: https://conda.anaconda.org/conda-forge/win-64/simplejson-3.20.1-py312h4389bb4_0.conda + sha256: c99159e7837a7bcf1ef1681d9a0dd048837934f55e4b5bbf98769e775a879b00 + md5: a19810af5f435a998f79cc9be7285955 + depends: + - python >=3.12,<3.13.0a0 + - python_abi 3.12.* *_cp312 + - ucrt >=10.0.20348.0 + - vc >=14.2,<15 + - vc14_runtime >=14.29.30139 + license: MIT + license_family: MIT + purls: + - pkg:pypi/simplejson?source=hash-mapping + size: 129076 + timestamp: 1739781332359 - conda: https://conda.anaconda.org/conda-forge/noarch/six-1.17.0-pyhd8ed1ab_0.conda sha256: 41db0180680cc67c3fa76544ffd48d6a5679d96f4b71d7498a759e94edc9a2db md5: a451d576819089b0d672f18768be0f65 @@ -8084,6 +8197,47 @@ packages: - pkg:pypi/stack-data?source=hash-mapping size: 26988 timestamp: 1733569565672 +- conda: https://conda.anaconda.org/conda-forge/linux-64/statsmodels-0.14.4-py312hc0a28a1_0.conda + sha256: 6cc65ba902b32207e8a697b0e0408a28d6cc166be04f1882c40739a86a253d22 + md5: 97dc960f3d9911964d73c2cf240baea5 + depends: + - __glibc >=2.17,<3.0.a0 + - libgcc >=13 + - numpy <3,>=1.22.3 + - numpy >=1.19,<3 + - packaging >=21.3 + - pandas !=2.1.0,>=1.4 + - patsy >=0.5.6 + - python >=3.12,<3.13.0a0 + - python_abi 3.12.* *_cp312 + - scipy !=1.9.2,>=1.8 + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/statsmodels?source=hash-mapping + size: 12103203 + timestamp: 1727987129263 +- conda: https://conda.anaconda.org/conda-forge/win-64/statsmodels-0.14.4-py312h1a27103_0.conda + sha256: f4324d64753363e31b673379de0f6a6223f6b2d52d30b5b5993392c1b96ac8ee + md5: 328f5cc12ebb18fb7739478c33285b03 + depends: + - numpy <3,>=1.22.3 + - numpy >=1.19,<3 + - packaging >=21.3 + - pandas !=2.1.0,>=1.4 + - patsy >=0.5.6 + - python >=3.12,<3.13.0a0 + - python_abi 3.12.* *_cp312 + - scipy !=1.9.2,>=1.8 + - ucrt >=10.0.20348.0 + - vc >=14.2,<15 + - vc14_runtime >=14.29.30139 + license: BSD-3-Clause + license_family: BSD + purls: + - pkg:pypi/statsmodels?source=hash-mapping + size: 11693380 + timestamp: 1727987685496 - conda: https://conda.anaconda.org/conda-forge/linux-64/svt-av1-3.0.1-h5888daf_0.conda sha256: 43a914e4b8f413d0327dd0eb98425b7c84d9dff6642a90bdae00e60dcc11a26d md5: 83ae590ee23da54c162d1f0fbf05bef0 diff --git a/pixi.toml b/pixi.toml index 875ad4b..71a9ce4 100644 --- a/pixi.toml +++ b/pixi.toml @@ -22,7 +22,6 @@ style = {depends-on = ["sort_imports", "fmt"]} # `pixi run style` lab = "jupyter lab" -hrt-install = "bin/install_hrt.cmd" pre-commit-install = "pre-commit install --install-hooks -t=pre-push" #-t=pre-commit postinstall = { depends-on = ["hrt-install", "htt-install", "pre-commit-install"] } From a5d6b074d9a0d25901ea5ecad228d50c68977977 Mon Sep 17 00:00:00 2001 From: wietsevangerwen <41104904+wvangerwen@users.noreply.github.com> Date: Thu, 15 May 2025 19:13:16 +0200 Subject: [PATCH 5/6] pixi run style --- python_workflow_demo/assignment_geochecks.py | 51 +++++++++++--------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/python_workflow_demo/assignment_geochecks.py b/python_workflow_demo/assignment_geochecks.py index 9ff12c9..3c9e51c 100644 --- a/python_workflow_demo/assignment_geochecks.py +++ b/python_workflow_demo/assignment_geochecks.py @@ -1,9 +1,11 @@ # %% -import random -import requests import json +import random + import pandas as pd +import requests + def fetch_temperature_data(): """ @@ -20,15 +22,15 @@ def fetch_temperature_data(): "AquoMetadata": { "Compartiment": {"Code": "OW"}, "Grootheid": {"Code": "CONCTTE"}, - "Parameter": {"Code": "Cd"} + "Parameter": {"Code": "Cd"}, } }, "Periode": { "Begindatumtijd": "2000-01-01T00:00:00.000+01:00", - "Einddatumtijd": "2030-01-01T00:00:00.000+01:00" - } + "Einddatumtijd": "2030-01-01T00:00:00.000+01:00", + }, } - headers = {'Content-Type': 'application/json'} + headers = {"Content-Type": "application/json"} try: response = requests.post(url, data=json.dumps(api_payload), headers=headers) @@ -38,6 +40,7 @@ def fetch_temperature_data(): print(f"Error while fetching data: {e}") return None + def extract_measurements(data): """ Extract measurements from the fetched JSON data. @@ -48,15 +51,16 @@ def extract_measurements(data): Returns: list: A list of measurement dictionaries. """ - if not data or 'WaarnemingenLijst' not in data: + if not data or "WaarnemingenLijst" not in data: print("Invalid or empty data received.") return [] measurements = [] - for row in data['WaarnemingenLijst']: - measurements.extend(row.get('MetingenLijst', [])) + for row in data["WaarnemingenLijst"]: + measurements.extend(row.get("MetingenLijst", [])) return measurements + def process_measurements(measurements): """ Process the extracted measurements into a pandas DataFrame. @@ -72,11 +76,12 @@ def process_measurements(measurements): return pd.DataFrame() df = pd.DataFrame(measurements) - if 'Meetwaarde' in df.columns: - df['waardes'] = df['Meetwaarde'].apply(lambda x: x.get('Waarde_Numeriek') if isinstance(x, dict) else None) - df.drop(columns=['Meetwaarde', 'WaarnemingMetadata'], inplace=True, errors='ignore') + if "Meetwaarde" in df.columns: + df["waardes"] = df["Meetwaarde"].apply(lambda x: x.get("Waarde_Numeriek") if isinstance(x, dict) else None) + df.drop(columns=["Meetwaarde", "WaarnemingMetadata"], inplace=True, errors="ignore") return df + def add_validation_errors(df): """ Adds random validation errors to the Tijdstip and waardes columns in the DataFrame. @@ -87,12 +92,13 @@ def add_validation_errors(df): Returns: pd.DataFrame: DataFrame with introduced validation errors. """ + def introduce_error_tijdstip(tijdstip): # Randomly return invalid date formats errors = [ - "INVALID_DATE", # Completely invalid - "2080-10-100 28:28:28", # Invalid format and impossible date - "2025-05-12T25:61:00.000+01:00" # Invalid time + "INVALID_DATE", # Completely invalid + "2080-10-100 28:28:28", # Invalid format and impossible date + "2025-05-12T25:61:00.000+01:00", # Invalid time ] return random.choice(errors) if random.random() < 0.5 else tijdstip @@ -100,17 +106,18 @@ def introduce_error_waardes(waarde): # Randomly return invalid values errors = [ "STRING_INSTEAD_OF_NUMBER", # Invalid type - random.uniform(1001, 5000), # Weird large numbers - None # Missing value + random.uniform(1001, 5000), # Weird large numbers + None, # Missing value ] return random.choice(errors) if random.random() < 0.5 else waarde # Apply errors to Tijdstip and waardes columns - df['Tijdstip'] = df['Tijdstip'].apply(lambda x: introduce_error_tijdstip(x) if random.random() < 0.2 else x) - df['waardes'] = df['waardes'].apply(lambda x: introduce_error_waardes(x) if random.random() < 0.2 else x) - + df["Tijdstip"] = df["Tijdstip"].apply(lambda x: introduce_error_tijdstip(x) if random.random() < 0.2 else x) + df["waardes"] = df["waardes"].apply(lambda x: introduce_error_waardes(x) if random.random() < 0.2 else x) + return df + def main(): """ Main function to fetch, process, and display the temperature data. @@ -125,7 +132,7 @@ def main(): # Write test to check your function # df = dateformat_validation(df) - # Assignment 2 + # Assignment 2 # Create validation of dataformat, add as function and push to branch # Write test to check your function # df = value_validation(df) @@ -133,6 +140,6 @@ def main(): print(df.columns) print(df) + if __name__ == "__main__": main() - From 01187c9ee5e9d6aaf97a77c718caf1e53349fca5 Mon Sep 17 00:00:00 2001 From: wietsevangerwen <41104904+wvangerwen@users.noreply.github.com> Date: Fri, 16 May 2025 13:51:37 +0200 Subject: [PATCH 6/6] move codespace to install --- README.md | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 9c5203c..38eb26f 100644 --- a/README.md +++ b/README.md @@ -6,11 +6,21 @@ Standaard setup voor python-projects bij HHNK. In de repo staan een aantal voorb Onderstaand staat uitgewerkt welke software wordt gebruikt, hoe testen opgezet kunnen worden, projectopzet en meer. # Installatie +## Lokaal Om deze repo goed neer te zetten moeten een aantal stappen worden genomen: -- `git clone` -> Clone de repo +- `git clone https://github.com/HHNK/python-workflow-demo` -> Clone de repo - `pixi install` -> installeer de python environment (draai dit in de repo;`cd python-workflow-demo`) - `pixi run postinstall` +## Codespaces +Github Codespace geven een platform om zonder installaties in de cloud ook te werken met een github branch en vs-code. Via de hoofdpagina van de repo https://github.com/HHNK/python-workflow-demo klikken op de groene `Code` rechtsboven en vanuit daar een Codespace aanmaken. + +Vervolgens moet de environment geinstalleerd worden en enkele vs-code extensions (zie (# IDE )). Verdere stappen +- `curl -fsSL https://pixi.sh/install.sh | sh` in terminal vs-code -> install pixi +- ctrl+shift+` -> restart shell +- `pixi install` +- `pixi run postinstall` + # IDE Voor de developer environment zijn er veel opties, we gebruiken [Visual Studio Code](https://code.visualstudio.com/download). Dit biedt goede integratie van notebooks en tal van andere extensions. Uiteindelijk zal persoonlijke voorkeur ook meespelen in de keuze. Om samenwerking binnen het team te bevorderen maken we alleen gebruik van vs-code. @@ -201,11 +211,3 @@ De resultaten zijn op de repo te zien onder [Actions](https://github.com/HHNK/py Zelf thuis een [Ollama](https://ollama.com/) installatie draaien waarmee je lokaal AI kan draaien. Met de [Continue](https://docs.continue.dev/getting-started/install) extension zijn code-hints mogelijk zonder de limieten van de free-tier van [Copilot](https://code.visualstudio.com/docs/copilot/overview). Hiervoor is wel een redelijke GPU nodig. Ervaring tot nu is net iets minder dan de online tools. -# Codespaces -Github Codespace geven een platform om zonder installties in de cloud ook te werken met een github branch en vs-code. Via de hoofdpagina van de repo https://github.com/HHNK/python-workflow-demo klikken op de groene `Code` rechtsboven en vanuit daar een Codespace aanmaken. - -Vervolgens moet de environment geinstalleerd worden en enkele vs-code extensions (zie boven). Verdere stappen -- `curl -fsSL https://pixi.sh/install.sh | sh` in terminal vs-code -> install pixi -- ctrl+shift+` -> restart shell -- `pixi install` -- `pixi run postinstall` \ No newline at end of file