diff --git a/.github/workflows/build_sphinx_website.yml b/.github/workflows/build_sphinx_website.yml index 4202bd4..458ccd3 100644 --- a/.github/workflows/build_sphinx_website.yml +++ b/.github/workflows/build_sphinx_website.yml @@ -25,6 +25,7 @@ jobs: - name: install dependencies run: | python -m pip install --upgrade pip + pip install -e . pip install -r requirements_dev.txt - name: make html & commit the changes diff --git a/requirements_dev.txt b/requirements_dev.txt index 5314c04..b383082 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -13,3 +13,7 @@ meteostat pytest-mock furo myst-parser +earthengine-api +python-dotenv +myst_parser +furo diff --git a/setup.py b/setup.py index cbfc43a..160ef52 100644 --- a/setup.py +++ b/setup.py @@ -22,13 +22,20 @@ 'pooch', 'python-dateutil', 'meteostat', - 'cyclopts', 'requests', 'pydantic', 'pyyaml', + 'cyclopts', 'requests', + 'pydantic>=2.0', + 'pyyaml', 'geopandas', 'libpysal', 'docker', 'jax', 'jaxlib', 'blackjax', 'dynamax', 'flax', 'optax', 'scipy', 'fastapi', 'gitpython', 'earthengine-api', 'python-dotenv', 'rq', "python-multipart", "uvicorn", - 'pydantic-geojson', 'annotated_types' + 'pydantic-geojson', 'annotated_types', + 'pycountry', + 'unidecode', + 'httpx', + 'earthengine-api' + ] test_requirements = ['pytest>=3', "hypothesis"] diff --git a/tests/external/test_external_models.py b/tests/external/test_external_models.py index 2bd9172..b37e215 100644 --- a/tests/external/test_external_models.py +++ b/tests/external/test_external_models.py @@ -9,11 +9,11 @@ from climate_health.api import get_model_from_directory_or_github_url from climate_health.spatio_temporal_data.temporal_dataclass import DataSet -from climate_health.datatypes import ClimateHealthTimeSeries +from climate_health.datatypes import ClimateHealthTimeSeries,FullData logging.basicConfig(level=logging.INFO) from climate_health.external.external_model import get_model_from_yaml_file, run_command -from ..data_fixtures import full_data, train_data, future_climate_data +from ..data_fixtures import full_data, train_data, train_data_pop, future_climate_data from climate_health.util import conda_available @@ -35,7 +35,7 @@ def test_python_model_from_folder(models_path, train_data, future_climate_data): assert results is not None -def get_dataset_from_yaml(yaml_path: Path): +def get_dataset_from_yaml(yaml_path: Path, datatype=ClimateHealthTimeSeries): specs = yaml.load(yaml_path.read_text(), Loader=yaml.FullLoader) if 'demo_data' in specs: path = yaml_path.parent / specs['demo_data'] @@ -49,19 +49,20 @@ def get_dataset_from_yaml(yaml_path: Path): df[to_name] = df[from_name] #df['disease_cases'] = np.arange(len(df)) - return DataSet.from_pandas(df, ClimateHealthTimeSeries) + return DataSet.from_pandas(df, datatype) + #@pytest.mark.skipif(not conda_available(), reason='requires conda') @pytest.mark.parametrize('model_directory', ['ewars_Plus']) #@pytest.mark.parametrize('model_directory', ['naive_python_model']) -def test_all_external_models_acceptance(model_directory, models_path, train_data, future_climate_data): +def test_all_external_models_acceptance(model_directory, models_path, train_data_pop, future_climate_data): """Only tests that the model can be initiated and that train and predict can be called without anything failing""" print("Running") yaml_path = models_path / model_directory / 'config.yml' model = get_model_from_yaml_file(yaml_path, working_dir=models_path / model_directory) - train_data = get_dataset_from_yaml(yaml_path) + train_data = get_dataset_from_yaml(yaml_path, FullData) model.setup() model.train(train_data) #results = model.predict(future_climate_data) @@ -72,7 +73,7 @@ def test_all_external_models_acceptance(model_directory, models_path, train_data @pytest.mark.parametrize('model_directory', ['ewars_Plus']) def test_external_model_predict(model_directory, models_path): yaml_path = models_path / model_directory / 'config.yml' - train_data = get_dataset_from_yaml(yaml_path) + train_data = get_dataset_from_yaml(yaml_path, FullData) model = get_model_from_yaml_file(yaml_path, working_dir=models_path / model_directory) model.setup() #model.setup()