From 6ea4a875f7f16d83638ae51087fc7113dfa62467 Mon Sep 17 00:00:00 2001 From: dfguerrerom Date: Mon, 26 Feb 2024 11:48:23 +0100 Subject: [PATCH 1/3] feat: update gdal sepal version, mimic sepal venv creation --- sepal_ui/bin/module_venv.py | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/sepal_ui/bin/module_venv.py b/sepal_ui/bin/module_venv.py index 6f4a4b42..46824a19 100755 --- a/sepal_ui/bin/module_venv.py +++ b/sepal_ui/bin/module_venv.py @@ -63,12 +63,36 @@ def main() -> None: pip = current_dir_venv / "bin" / "pip" python3 = current_dir_venv / "bin" / "python3" - for lib in ["wheel", "Cython", "ipykernel"]: - subprocess.run([str(pip), "install", lib], cwd=Path.cwd()) + base_libs = [ + "wheel", + "ipykernel", + "numpy", + "GDAL==3.8.3", + ] + + # if we are in sepal, install earthengine-api OF fork + + if "sepal-user" in str(Path.cwd()): + earthengine_api = "git+https://github.com/openforis/earthengine-api.git@v0.1.384#egg=earthengine-api&subdirectory=python" + base_libs.append(earthengine_api) + + subprocess.run([str(pip), "install", "--upgrade", "pip"], cwd=Path.cwd()) + + for lib in base_libs: + subprocess.run([str(pip), "install", "--no-cache-dir", lib], cwd=Path.cwd()) # install all the requirements req = Path.cwd() / "requirements.txt" - subprocess.run([str(pip), "install", "-r", str(req)], cwd=Path.cwd()) + subprocess.run( + [ + str(pip), + "install", + "--no-cache-dir", + "-r", + str(req), + ], + cwd=Path.cwd(), + ) # search for the module.yaml file # it embeds name and entry point From 104ea5d70b9380d5df5bfa16459e4543e40eda23 Mon Sep 17 00:00:00 2001 From: dfguerrerom Date: Tue, 27 Feb 2024 14:56:13 +0100 Subject: [PATCH 2/3] feat: use earthengine OF fork when running test in sepal --- noxfile.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index 2bf03e21..4c70cb35 100644 --- a/noxfile.py +++ b/noxfile.py @@ -3,7 +3,6 @@ The nox run are build in isolated environment that will be stored in .nox. to force the venv update, remove the .nox/xxx folder. """ - import nox nox.options.sessions = ["lint", "test", "docs"] @@ -20,6 +19,15 @@ def lint(session): def test(session): """Run all the test using the environment variable of the running machine.""" session.install(".[test]") + + # if we are in the sepal-venv, force earthengine api fork + if "sepal-user" in session.virtualenv.location: + session.run( + "pip", + "install", + "git+https://github.com/openforis/earthengine-api.git@v0.1.384#egg=earthengine-api&subdirectory=python", + ) + test_files = session.posargs or ["tests"] session.run("pytest", "--color=yes", "--cov", "--cov-report=xml", *test_files) From ef8daf889f22b946169068d3f3bc811f24be0c29 Mon Sep 17 00:00:00 2001 From: dfguerrerom Date: Tue, 27 Feb 2024 15:08:28 +0100 Subject: [PATCH 3/3] refactor: expose errors on ee initialization --- tests/conftest.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index 80a99a5c..55ae442c 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -21,7 +21,8 @@ try: su.init_ee() -except Exception: +except Exception as e: + raise e pass # try to init earthengine. use ee.data._credentials to skip # -- a component to fake the display in Ipython --------------------------------