diff --git a/noxfile.py b/noxfile.py index 10d08f11..58ab137b 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) 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