Skip to content

Commit 013368d

Browse files
committed
dee project setup.
Adding basic CI and a release process. Mimicing the project setup of Xee. Tried as much as possible to be careful about respecting Google's license and copyright.
1 parent 2c98ac6 commit 013368d

File tree

7 files changed

+324
-1
lines changed

7 files changed

+324
-1
lines changed

.github/workflows/ci-build.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Taken from Xee and minimally modified: https://github.com/google/Xee/blob/main/.github/workflows/ci-build.yml
2+
#
3+
# Copyright 2023 Google LLC
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
# ==============================================================================
17+
name: ci
18+
19+
on:
20+
# Triggers the workflow on push or pull request events but only for the main branch
21+
push:
22+
branches: [ main ]
23+
pull_request:
24+
branches: [ main ]
25+
# Allows you to run this workflow manually from the Actions tab
26+
workflow_dispatch:
27+
28+
jobs:
29+
build:
30+
name: "python ${{ matrix.python-version }} tests"
31+
runs-on: ubuntu-latest
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
python-version: [
36+
"3.8",
37+
"3.9",
38+
"3.10",
39+
"3.11",
40+
"3.12",
41+
]
42+
permissions:
43+
id-token: write # This is required for requesting the JWT.
44+
steps:
45+
- name: Cancel previous
46+
uses: styfle/cancel-workflow-action@0.7.0
47+
with:
48+
access_token: ${{ github.token }}
49+
if: ${{github.ref != 'refs/head/main'}}
50+
- uses: actions/checkout@v2
51+
- name: Set up Python ${{ matrix.python-version }}
52+
uses: actions/setup-python@v4
53+
with:
54+
python-version: ${{ matrix.python-version }}
55+
cache: 'pip'
56+
- name: Install dee
57+
run: |
58+
pip install -e .[tests]
59+
- uses: 'actions/checkout@v4'
60+
- id: 'auth'
61+
name: 'Authenticate to Google Cloud'
62+
uses: 'google-github-actions/auth@v1'
63+
with:
64+
service_account: ${{ secrets.SERVICE_ACCOUNT }}
65+
workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITY_PROVIDER }}
66+
- name: Run unit tests
67+
run: |
68+
pytest dee

.github/workflows/lint.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Taken from Xee and minimally modified: https://github.com/google/Xee/blob/main/.github/workflows/lint.yml
2+
#
3+
# Copyright 2023 Google LLC
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
# ==============================================================================
17+
name: lint
18+
19+
on:
20+
# Triggers the workflow on push or pull request events but only for the main branch
21+
push:
22+
branches: [ main ]
23+
pull_request:
24+
branches: [ main ]
25+
# Allows you to run this workflow manually from the Actions tab
26+
workflow_dispatch:
27+
28+
jobs:
29+
build:
30+
name: "python ${{ matrix.python-version }} lint"
31+
runs-on: ubuntu-latest
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
python-version: ["3.9", "3.10", "3.11"]
36+
steps:
37+
- name: Cancel previous
38+
uses: styfle/cancel-workflow-action@0.7.0
39+
with:
40+
access_token: ${{ github.token }}
41+
if: ${{github.ref != 'refs/head/main'}}
42+
- uses: actions/checkout@v2
43+
- name: Set up Python ${{ matrix.python-version }}
44+
uses: actions/setup-python@v2
45+
with:
46+
python-version: ${{ matrix.python-version }}
47+
- name: Get pip cache dir
48+
id: pip-cache
49+
run: |
50+
python -m pip install --upgrade pip wheel
51+
echo "::set-output name=dir::$(pip cache dir)"
52+
- name: pip cache
53+
uses: actions/cache@v2
54+
with:
55+
path: ${{ steps.pip-cache.outputs.dir }}
56+
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
57+
- name: Install dee
58+
run: |
59+
pip install -e .[tests]
60+
- name: Lint with pyink
61+
run: |
62+
pyink --check .

.github/workflows/publish.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# Taken from Xee and minimally modified: https://github.com/google/Xee/blob/main/.github/workflows/publish.yml
2+
#
3+
# Copyright 2023 Google LLC
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
name: Publish to PyPi
17+
18+
on:
19+
release:
20+
types: [published]
21+
22+
jobs:
23+
build-artifacts:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@v2
27+
- name: Set up Python
28+
uses: actions/setup-python@v2.3.1
29+
with:
30+
python-version: 3.9
31+
32+
- name: Install dependencies
33+
run: |
34+
python -m pip install --upgrade pip
35+
python -m pip install setuptools setuptools-scm wheel twine check-manifest
36+
37+
- name: Build tarball and wheels
38+
run: |
39+
git clean -xdf
40+
git restore -SW .
41+
python -m build --sdist --wheel .
42+
- name: Check built artifacts
43+
run: |
44+
python -m twine check dist/*
45+
pwd
46+
- uses: actions/upload-artifact@v2
47+
with:
48+
name: releases
49+
path: dist
50+
51+
test-built-dist:
52+
needs: build-artifacts
53+
runs-on: ubuntu-latest
54+
steps:
55+
- uses: actions/setup-python@v2.3.1
56+
name: Install Python
57+
with:
58+
python-version: 3.9
59+
- uses: actions/download-artifact@v2
60+
with:
61+
name: releases
62+
path: dist
63+
- name: List contents of built dist
64+
run: |
65+
ls -ltrh
66+
ls -ltrh dist
67+
- name: Publish package to TestPyPI
68+
if: github.event_name == 'push'
69+
uses: pypa/gh-action-pypi-publish@v1.4.2
70+
with:
71+
user: __token__
72+
password: ${{ secrets.TESTPYPI_TOKEN }}
73+
repository_url: https://test.pypi.org/legacy/
74+
verbose: true
75+
76+
- name: Check uploaded package
77+
if: github.event_name == 'push'
78+
run: |
79+
sleep 3
80+
python -m pip install --upgrade pip
81+
python -m pip install --extra-index-url https://test.pypi.org/simple --upgrade dee
82+
python -c "import dee; print(dee.__version__)"
83+
upload-to-pypi:
84+
needs: test-built-dist
85+
if: github.event_name == 'release'
86+
runs-on: ubuntu-latest
87+
steps:
88+
- uses: actions/download-artifact@v2
89+
with:
90+
name: releases
91+
path: dist
92+
- name: Publish package to PyPI
93+
uses: pypa/gh-action-pypi-publish@v1.4.2
94+
with:
95+
user: __token__
96+
password: ${{ secrets.PYPI_TOKEN }}
97+
verbose: true

README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,24 @@
11
# dee
2-
Earth Engine Feature Collections via Dask Dataframes
2+
3+
Earth Engine FeatureCollections via Dask Dataframes
4+
5+
## License
6+
```
7+
Copyright 2024 Alexander S Merose
8+
9+
Licensed under the Apache License, Version 2.0 (the "License");
10+
you may not use this file except in compliance with the License.
11+
You may obtain a copy of the License at
12+
13+
https://www.apache.org/licenses/LICENSE-2.0
14+
15+
Unless required by applicable law or agreed to in writing, software
16+
distributed under the License is distributed on an "AS IS" BASIS,
17+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18+
See the License for the specific language governing permissions and
19+
limitations under the License.
20+
```
21+
22+
Some sources are re-distributed from Google LLC via https://github.com/google/Xee (also Apache-2.0 License) with and
23+
without modification. These files are subject to the original copyright; they include the original license header
24+
comment as well as a note to indicate modifications (when appropriate).

conftest.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright 2023 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
# ==============================================================================
15+
"""Configure FLAGS with default values for absltest."""
16+
from absl import app
17+
18+
try:
19+
app.run(lambda argv: None)
20+
except SystemExit:
21+
pass

dee/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# TODO(alxmrs): https://docs.google.com/document/d/1Ltl6XrZ_uGD2J7OW1roUsxhpFxx5QvNeInjuONIkmL8/edit#heading=h.uj7plawe7x7e

pyproject.toml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
[project]
2+
name = "dee"
3+
dynamic = ["version"]
4+
description = "Google Earth Engine FeatureCollections via Dask Dataframes."
5+
readme = "README.md"
6+
requires-python = ">=3.8"
7+
license = {text = "Apache-2.0"}
8+
authors = [
9+
{name = "Alexander Merose", email = "al@merose.com"},
10+
]
11+
classifiers = [
12+
"Development Status :: 4 - Beta",
13+
"Intended Audience :: Science/Research",
14+
"Intended Audience :: Developers",
15+
"Intended Audience :: Information Technology",
16+
"License :: OSI Approved :: Apache Software License",
17+
"Operating System :: MacOS :: MacOS X",
18+
"Operating System :: Microsoft :: Windows",
19+
"Operating System :: POSIX",
20+
"Programming Language :: Python :: 3.9",
21+
"Programming Language :: Python :: 3.10",
22+
"Programming Language :: Python :: 3.11",
23+
"Programming Language :: Python :: 3.12",
24+
"Topic :: Scientific/Engineering :: Atmospheric Science",
25+
]
26+
dependencies = [
27+
"earthengine-api>=0.1.374",
28+
"dask",
29+
]
30+
31+
[project.optional-dependencies]
32+
tests = [
33+
"absl-py",
34+
"pytest",
35+
"pyink",
36+
]
37+
38+
[project.urls]
39+
Homepage = "https://github.com/alxmrs/dee"
40+
Issues = "https://github.com/alxmrs/dee/issues"
41+
42+
[build-system]
43+
requires = ["setuptools>=64", "setuptools_scm>=8"]
44+
build-backend = "setuptools.build_meta"
45+
46+
[tool.pyink]
47+
line-length = 80
48+
preview = true
49+
pyink-indentation = 2
50+
pyink-use-majority-quotes = true
51+
52+
[tool.setuptools_scm]

0 commit comments

Comments
 (0)