Skip to content

Commit f918e6a

Browse files
authored
Merge pull request #90 from GeoscienceAustralia/uv
Switch to `uv` for Docker pip compile and install
2 parents 169db73 + 049c40b commit f918e6a

7 files changed

+30
-45
lines changed

.github/workflows/dea-intertidal-image.yml

+6-12
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ jobs:
8585
wget --no-verbose https://www.dropbox.com/s/uemd8ib2vfw5nad/tide_models.zip?dl=1 -O tide_models.zip
8686
unzip -q tide_models.zip
8787
88-
# Run integration tests using Docker, setting up datacube access, AWS configuration and
89-
# adding volumes that provide access to tide model data and allow us to export artifacts
90-
# from the run
88+
# Run integration tests using Docker. The command sets up datacube access, AWS configuration,
89+
# and adds volumes to allow access to model outputs outside the container (used to commit outputs
90+
# using git). It also provides access to tide model data for the tests.
9191
docker run \
9292
--net=host \
9393
--env DATACUBE_DB_URL \
@@ -96,18 +96,12 @@ jobs:
9696
--env AWS_ACCESS_KEY_ID \
9797
--env AWS_SECRET_ACCESS_KEY \
9898
--env AWS_SESSION_TOKEN \
99-
--volume ${GITHUB_WORKSPACE}:/code \
99+
--volume ${GITHUB_WORKSPACE}:/app \
100100
--volume ${GITHUB_WORKSPACE}/tide_models:/var/share/tide_models \
101-
--volume ${GITHUB_WORKSPACE}/artifacts:/mnt/artifacts \
102101
dea_intertidal pytest -v --cov=intertidal --cov-report=xml tests
103102
104-
# Copy out validation outputs produced by the integration tests and place them
105-
# in correct output locations so they can be committed back into the repository
106-
cp ./artifacts/validation.jpg ./tests/validation.jpg
107-
cp ./artifacts/validation.csv ./tests/validation.csv
108-
cp ./artifacts/README.md ./tests/README.md
109-
110103
# Commit validation results produced by integration tests back into repo
104+
# (relies on having previously added a volume to access outputs outside of the container)
111105
- name: Commit validation results into repository
112106
uses: stefanzweifel/git-auto-commit-action@v4
113107
if: github.event_name == 'pull_request'
@@ -116,7 +110,7 @@ jobs:
116110
commit_message: Automatically update integration test validation results
117111
file_pattern: 'tests/validation.jpg tests/validation.csv tests/README.md'
118112

119-
# Post validation tesults as comment on PR
113+
# Post validation tesults as a comment on the pull request
120114
- name: Post validation results as comment
121115
uses: mshick/add-pr-comment@v2
122116
if: github.event_name == 'pull_request'

Dockerfile

+14-24
Original file line numberDiff line numberDiff line change
@@ -12,38 +12,28 @@ ENV DEBIAN_FRONTEND=noninteractive \
1212
RUN apt-get update && \
1313
apt-get install -y \
1414
build-essential \
15-
fish \
1615
git \
17-
vim \
18-
htop \
19-
wget \
20-
unzip \
2116
python3-pip \
2217
libpq-dev \
2318
&& apt-get autoclean && \
2419
apt-get autoremove && \
2520
rm -rf /var/lib/{apt,dpkg,cache,log}
2621

27-
# Install pip-tools
28-
RUN pip install pip-tools
22+
# Set up working directory
23+
WORKDIR /app
2924

30-
# Pip installation
31-
RUN mkdir -p /conf
32-
# COPY requirements.in /conf/
33-
# RUN pip-compile --extra-index-url=https://packages.dea.ga.gov.au/ --output-file=/conf/requirements.txt /conf/requirements.in
34-
COPY requirements.txt /conf/
35-
RUN pip install -r /conf/requirements.txt \
36-
&& pip install --no-cache-dir awscli==1.33.37
25+
# Copy requirements file first
26+
COPY requirements.in /app/requirements.in
3727

38-
# Copy source code and install it
39-
RUN mkdir -p /code
40-
WORKDIR /code
41-
ADD . /code
28+
# Install uv and requirements
29+
RUN pip install uv && \
30+
uv pip compile /app/requirements.in -o /app/requirements.txt && \
31+
uv pip install -r /app/requirements.txt --system
4232

43-
RUN echo "Installing dea-intertidal through the Dockerfile."
44-
RUN pip install --extra-index-url="https://packages.dea.ga.gov.au" .
33+
# Now copy the rest of the files
34+
COPY . /app
4535

46-
RUN pip freeze && pip check
47-
48-
# Make sure it's working
49-
RUN dea-intertidal --help
36+
# Install DEA Intertidal and verify installation
37+
RUN uv pip install . --system && \
38+
uv pip check && \
39+
dea-intertidal --help

requirements.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
--extra-index-url=https://packages.dea.ga.gov.au/
21
aiohttp
32
botocore
43
click==8.1.7
4+
dask==2024.3.1
55
datacube[s3,performance]==1.8.19
66
dea-tools==0.3.4
77
eodatasets3==0.30.6

tests/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ Integration tests
1010
1111
This directory contains tests that are run to verify that DEA Intertidal code runs correctly. The ``test_intertidal.py`` file runs a small-scale full workflow analysis over an intertidal flat in the Gulf of Carpentaria using the DEA Intertidal [Command Line Interface (CLI) tools](../notebooks/Intertidal_CLI.ipynb), and compares these results against a LiDAR validation DEM to produce some simple accuracy metrics.
1212

13-
The latest integration test completed at **2024-10-03 15:33**. Compared to the previous run, it had an:
14-
- RMSE accuracy of **0.15 m ( :heavy_minus_sign: no change)**
15-
- MAE accuracy of **0.12 m ( :heavy_minus_sign: no change)**
16-
- Bias of **0.12 m ( :heavy_minus_sign: no change)**
13+
The latest integration test completed at **2025-02-14 11:12**. Compared to the previous run, it had an:
14+
- RMSE accuracy of **0.14 m ( :heavy_check_mark: improved by 0.001)**
15+
- MAE accuracy of **0.12 m ( :heavy_check_mark: improved by 0.002)**
16+
- Bias of **0.12 m ( :heavy_check_mark: improved by 0.002)**
1717
- Pearson correlation of **0.975 ( :heavy_minus_sign: no change)**
1818

1919

tests/test_intertidal.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ def test_dem_accuracy(
6565
val_path="tests/data/lidar_10m_tests.tif",
6666
mod_path="data/processed/ga_s2ls_intertidal_cyear_3/0-0-1/tes/ting/2021--P1Y/ga_s2ls_intertidal_cyear_3_testing_2021--P1Y_final_elevation.tif",
6767
input_csv="tests/validation.csv",
68-
output_csv="artifacts/validation.csv",
69-
output_plot="artifacts/validation.jpg",
70-
output_md="artifacts/README.md",
68+
output_csv="tests/validation.csv",
69+
output_plot="tests/validation.jpg",
70+
output_md="tests/README.md",
7171
):
7272
"""
7373
Compares elevation outputs of the previous CLI step against
@@ -195,7 +195,7 @@ def test_dem_accuracy(
195195
ax2.set_ylabel("Metres (m)")
196196
ax2.set_xlabel(None)
197197

198-
# Write into mounted artifacts directory
198+
# Write output CSV
199199
accuracy_df.to_csv(output_csv)
200200
plt.savefig(output_plot, dpi=100, bbox_inches="tight")
201201

tests/validation.csv

+1
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,4 @@ time,Correlation,RMSE,MAE,R-squared,Bias,Regression slope
6868
2024-09-24 00:07:47.380872+00:00,0.975,0.146,0.125,0.95,0.119,1.112
6969
2024-09-24 05:42:35.688710+00:00,0.975,0.146,0.125,0.95,0.119,1.112
7070
2024-10-03 05:33:20.186227+00:00,0.975,0.146,0.125,0.95,0.119,1.112
71+
2025-02-14 00:12:00.333318+00:00,0.975,0.145,0.123,0.95,0.117,1.118

tests/validation.jpg

-802 Bytes
Loading

0 commit comments

Comments
 (0)