Skip to content

Commit fc18f0f

Browse files
Add earth2grid as optional dependency of fme (#1520)
Alternative to #1301 to specify earth2grid as an optional 'healpix' dependency. Also adds the healpix requirements to our CI environments *except* the `cpu-very-fast` tests which we can use to ensure `fme` can still be installed and used without the healpix extra. Resolve #1542 --------- Co-authored-by: Anna Dodson <[email protected]>
1 parent 5368610 commit fc18f0f

File tree

5 files changed

+33
-10
lines changed

5 files changed

+33
-10
lines changed

.github/workflows/docs.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,17 @@ jobs:
3737
- uses: actions/cache@v4
3838
with:
3939
path: ${{ env.pythonLocation }}
40-
key: ${{ env.CURRENT_WEEK }}-${{ env.pythonLocation }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('docs/requirements.txt') }}-${{ hashFiles('constraints.txt') }}
40+
key: ${{ env.CURRENT_WEEK }}-${{ env.pythonLocation }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('docs/requirements.txt') }}-${{ hashFiles('healpix-requirements.txt') }}-${{ hashFiles('constraints.txt') }}
4141
- name: Install dependencies
4242
run: |
4343
python -m pip install uv
44-
uv pip install --system -c constraints.txt -e .[docs]
44+
# can't use --system here because it doesn't work with --no-build-isolation and a healpix dependency
45+
uv venv --python 3.10
46+
uv pip install -c constraints.txt -e .[docs]
47+
uv pip install --no-build-isolation -c constraints.txt -e .[docs,healpix]
4548
- name: Build docs
4649
run: |
50+
source .venv/bin/activate
4751
cd docs && make doctest html
4852
- name: Upload to GitHub Pages
4953
uses: actions/upload-pages-artifact@v3

.github/workflows/tests.yaml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,19 @@ jobs:
2525
- uses: actions/cache@v4
2626
with:
2727
path: ${{ env.pythonLocation }}
28-
key: ${{ env.CURRENT_WEEK }}-${{ env.pythonLocation }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('dev-requirements.txt') }}-${{ hashFiles('constraints.txt') }}
28+
key: ${{ env.CURRENT_WEEK }}-${{ env.pythonLocation }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('dev-requirements.txt') }}-${{ hashFiles('healpix-requirements.txt') }}-${{ hashFiles('constraints.txt') }}
2929
- name: Install dependencies
3030
run: |
3131
python -m pip install uv
32-
uv pip install --system -c constraints.txt -e .[dev]
32+
# can't use --system here because it doesn't work with --no-build-isolation and a healpix dependency
33+
uv venv --python 3.10
34+
uv pip install -c constraints.txt -e .[dev]
35+
uv pip install --no-build-isolation -c constraints.txt -e .[dev,healpix]
3336
- name: Run pytest
3437
run: |
38+
source .venv/bin/activate
3539
make test
36-
cpu-very-fast:
40+
cpu-very-fast-no-healpix:
3741
runs-on: ubuntu-latest
3842
steps:
3943
- uses: actions/checkout@v3
@@ -69,15 +73,19 @@ jobs:
6973
- uses: actions/cache@v4
7074
with:
7175
path: ${{ env.pythonLocation }}
72-
key: ${{ env.CURRENT_WEEK }}-${{ env.pythonLocation }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('dev-requirements.txt') }}-${{ hashFiles('constraints.txt') }}
76+
key: ${{ env.CURRENT_WEEK }}-${{ env.pythonLocation }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('dev-requirements.txt') }}-${{ hashFiles('healpix-requirements.txt') }}-${{ hashFiles('constraints.txt') }}
7377
- name: Install dependencies
7478
run: |
7579
sudo apt-get update
76-
sudo apt-get install -y make git
80+
sudo apt-get install -y make git build-essential
7781
python -m pip install uv
78-
uv pip install --system -c constraints.txt -e .[dev]
82+
# can't use --system here because it doesn't work with --no-build-isolation and a healpix dependency
83+
uv venv --python 3.10
84+
uv pip install -c constraints.txt -e .[dev]
85+
uv pip install --no-build-isolation -c constraints.txt -e .[dev,healpix]
7986
- name: Run CUDA check and pytest
8087
run: |
88+
source .venv/bin/activate
8189
export PATH=/usr/local/nvidia/bin:${PATH}
8290
export LD_LIBRARY_PATH=/usr/local/nvidia/lib64:${LD_LIBRARY_PATH}
8391
python3 fme/require_gpu.py

Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ DEPLOY_TARGET ?= pypi
77
BEAKER_WORKSPACE = ai2/ace
88
CURRENT_DATE = $(shell date +'%Y-%m-%d')
99

10+
ifeq ($(shell uname), Linux)
11+
CONDA_PACKAGES=gxx_linux-64 pip
12+
else
13+
CONDA_PACKAGES=pip
14+
endif
15+
1016
build_docker_image:
1117
DOCKER_BUILDKIT=1 docker build --platform=linux/amd64 -f docker/Dockerfile -t $(IMAGE):$(VERSION) --target production .
1218

@@ -37,9 +43,10 @@ test_image:
3743

3844
# recommended to deactivate current conda environment before running this
3945
create_environment:
40-
conda create -n $(ENVIRONMENT_NAME) python=3.10 pip
46+
conda create -n $(ENVIRONMENT_NAME) python=3.10 $(CONDA_PACKAGES)
4147
conda run --no-capture-output -n $(ENVIRONMENT_NAME) python -m pip install uv
4248
conda run --no-capture-output -n $(ENVIRONMENT_NAME) uv pip install -c constraints.txt -e .[dev,docs]
49+
conda run --no-capture-output -n $(ENVIRONMENT_NAME) uv pip install --no-build-isolation -c constraints.txt -e .[dev,docs,healpix]
4350
conda run --no-capture-output -n $(ENVIRONMENT_NAME) uv pip install -r analysis-deps.txt
4451

4552
test:

docker/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.c
1212
# install python deps
1313
COPY requirements.txt /tmp/requirements.txt
1414
RUN python3 -m pip install -r /tmp/requirements.txt
15+
COPY healpix-requirements.txt /tmp/healpix-requirements.txt
16+
RUN python3 -m pip install --no-build-isolation -r /tmp/healpix-requirements.txt
1517

1618
FROM base AS production
1719

1820
# copy local code and install
19-
COPY fme ${FME_DIR}/fme
21+
COPY . ${FME_DIR}
2022
RUN cd $FME_DIR && pip install --no-deps -e .
2123

2224
# copy after install so editing scripts does not trigger reinstall

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ dependencies = { file = "requirements.txt" }
3030
optional-dependencies.dev = { file = "dev-requirements.txt" }
3131
optional-dependencies.docs = { file = "docs/requirements.txt" }
3232
optional-dependencies.deploy = { file = "deploy-requirements.txt" }
33+
optional-dependencies.healpix = { file = "healpix-requirements.txt" }
3334

3435
[tool.setuptools.packages]
3536
find = {}
@@ -39,6 +40,7 @@ cache-keys = [
3940
{ file = "requirements.txt" },
4041
{ file = "dev-requirements.txt" },
4142
{ file = "docs/requirements.txt" },
43+
{ file = "healpix-requirements.txt" },
4244
]
4345

4446
[tool.ruff.lint]

0 commit comments

Comments
 (0)