Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
cdanielw committed Oct 17, 2024
2 parents dc1290b + b281501 commit d448db0
Show file tree
Hide file tree
Showing 152 changed files with 57,827 additions and 23,410 deletions.
17 changes: 12 additions & 5 deletions .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,33 @@ name: ci-tests
on: [
push,
pull_request,
workflow_dispatch, # Enables running this workflow manually from the Actions tab.
]

jobs:
build:
name: "python ${{ matrix.python-version }} tests"
runs-on: ubuntu-latest
name: "Python ${{ matrix.python-version }} tests on ${{ matrix.os }}"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: [
"3.7",
"3.8",
"3.9",
"3.10",
"3.11",
"3.12",
]
include:
- os: macos-latest
python-version: "3.11"
- os: windows-latest
python-version: "3.11"
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
Expand Down
20 changes: 16 additions & 4 deletions .github/workflows/ci-type-verification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,28 @@ jobs:
if: ${{github.ref != 'refs/head/master'}}
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install EE API
run: |
pip install -e ./python
pip install ./python[tests]
pip install pyright
- name: ee type verification
pip install pytype
pip install mypy
- name: pyright ee type verification
run: |
pyright --verifytypes ee
- name: ee.cli type verification
continue-on-error: true
- name: pyright ee.cli type verification
run: |
pyright --verifytypes ee.cli
continue-on-error: true
- name: mypy ee and ee.cli type verification
run: |
mypy -p ee
continue-on-error: true
- name: pytype ee type verification
run: |
cd python
pytype -k -d import-error ee
51 changes: 51 additions & 0 deletions .github/workflows/publish-to-npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Publish to NPM
on:
release:
types: [published]
# Enables running this workflow manually from the Actions tab.
workflow_dispatch:

jobs:
smoke-test:
if: "!github.event.release.prerelease" # Only run if not a prerelease.
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- name: Authenticate with Google Cloud
id: "auth"
uses: 'google-github-actions/auth@v2'
with:
service_account: ${{ secrets.SERVICE_ACCOUNT }}
workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITY_PROVIDER }}
token_format: "access_token"
- uses: actions/setup-node@v4
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- run: |
cd javascript/
npm install
npm run build
npm run test
env:
EE_ACCESS_TOKEN: ${{ steps.auth.outputs.access_token }}
publish-npm:
if: "!github.event.release.prerelease" # Only run if not a prerelease.
needs: smoke-test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- run: |
cd javascript/
npm install
npm run build
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_API_TOKEN }}
99 changes: 99 additions & 0 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: Publish to PyPi
on:
release:
types: [published]
# Enables running this workflow manually from the Actions tab.
workflow_dispatch:

jobs:
smoke-test:
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: 3.11
- name: Authenticate with Google Cloud
uses: 'google-github-actions/auth@v2'
with:
service_account: ${{ secrets.SERVICE_ACCOUNT }}
workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITY_PROVIDER }}
- name: Install EE and dependencies
run: |
pip install ./python[tests]
- name: Smoke test
run: >
python -c 'import ee;
import json;
import os;
from google.auth import identity_pool;
scopes = [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/earthengine",
];
path = os.environ["GOOGLE_APPLICATION_CREDENTIALS"];
info = json.load(open(path));
ee.Initialize(identity_pool.Credentials.from_info(info).with_scopes(scopes));
print(ee.Image("srtm90_v4").getInfo())'
build-artifacts:
needs: smoke-test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade build twine
- name: Build package
run: python -m build ./python
- name: Check built artifacts
run: |
python -m twine check ./python/dist/*
- uses: actions/upload-artifact@v4
with:
name: releases
path: ./python/dist

pypi-upload:
needs: build-artifacts
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: 3.11
- uses: actions/download-artifact@v4
with:
name: releases
path: dist
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@v1.8.13
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
verbose: true

check-pypi-package:
needs: pypi-upload
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: 3.11
- name: Check uploaded package
run: |
sleep 3 # To account for PyPi publish delay.
python -m pip install --upgrade pip
python -m pip install --upgrade --pre earthengine-api
python -c "import ee; print(ee.__version__)"
2 changes: 1 addition & 1 deletion demos/interactive-classifier/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def get(self):
)

# Train a classifier using the aggregated data.
classifier = ee.Classifier.naiveBayes().train(
classifier = ee.Classifier.smileNaiveBayes().train(
features=training,
classProperty='label',
inputProperties=landsat_composite.bandNames(),
Expand Down
4 changes: 2 additions & 2 deletions demos/wmts/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
import flask
from flask import request
from flask_wtf import csrf
import requests

from google.appengine.api import app_identity
from google.appengine.api import urlfetch
from google.auth import app_engine
from google.cloud import storage
import requests

import ee
import config

Expand Down
Loading

0 comments on commit d448db0

Please sign in to comment.