diff --git a/.mypy.ini b/.mypy.ini index a75af6c5722..08ccb974155 100644 --- a/.mypy.ini +++ b/.mypy.ini @@ -11,3 +11,9 @@ ignore_missing_imports = True [mypy-hydra.grammar.gen.*] ignore_missing_imports = True ignore_errors = True + +[mypy-nevergrad.*] +ignore_missing_imports = True + +[mypy-rq.*] +ignore_missing_imports = True diff --git a/hydra/_internal/grammar/grammar_functions.py b/hydra/_internal/grammar/grammar_functions.py index 39b506cc3c6..7d08cc9550a 100644 --- a/hydra/_internal/grammar/grammar_functions.py +++ b/hydra/_internal/grammar/grammar_functions.py @@ -15,7 +15,7 @@ Sweep, ) -ElementType = Union[str, int, bool, float, list, dict] +ElementType = Union[str, int, bool, float, List[Any], Dict[str, Any]] def apply_to_dict_values( diff --git a/plugins/hydra_ax_sweeper/setup.py b/plugins/hydra_ax_sweeper/setup.py index b49ffff8f71..3f668c5c3f9 100644 --- a/plugins/hydra_ax_sweeper/setup.py +++ b/plugins/hydra_ax_sweeper/setup.py @@ -30,6 +30,8 @@ "ax-platform>=0.1.20,<0.2.1", # https://github.com/facebookresearch/hydra/issues/1767 "torch", "gpytorch<=1.8.1", # avoid deprecation warnings. This can probably be removed when ax-platform is unpinned. + "pandas<1.5.0", # https://github.com/facebook/Ax/issues/1153, unpin when upgrading ax to >=0.2.8 + "numpy<1.25.0", # same as above, silences deprecation from np.find_common_type for pandas <1.5 ], include_package_data=True, ) diff --git a/plugins/hydra_nevergrad_sweeper/hydra_plugins/hydra_nevergrad_sweeper/_impl.py b/plugins/hydra_nevergrad_sweeper/hydra_plugins/hydra_nevergrad_sweeper/_impl.py index 6424e4c7f95..37329424a1f 100644 --- a/plugins/hydra_nevergrad_sweeper/hydra_plugins/hydra_nevergrad_sweeper/_impl.py +++ b/plugins/hydra_nevergrad_sweeper/hydra_plugins/hydra_nevergrad_sweeper/_impl.py @@ -76,7 +76,7 @@ def create_nevergrad_parameter_from_override(override: Override) -> Any: if "log" in val.tags: scalar = ng.p.Log(lower=val.start, upper=val.end) else: - scalar = ng.p.Scalar(lower=val.start, upper=val.end) # type: ignore + scalar = ng.p.Scalar(lower=val.start, upper=val.end) if isinstance(val.start, int): scalar.set_integer_casting() return scalar diff --git a/plugins/hydra_optuna_sweeper/setup.py b/plugins/hydra_optuna_sweeper/setup.py index 23a5a5435c5..4d735c99446 100644 --- a/plugins/hydra_optuna_sweeper/setup.py +++ b/plugins/hydra_optuna_sweeper/setup.py @@ -29,6 +29,7 @@ install_requires=[ "hydra-core>=1.1.0.dev7", "optuna>=2.10.0,<3.0.0", + "sqlalchemy~=1.3.0", # TODO: Unpin when upgrading to optuna v3.0 ], include_package_data=True, ) diff --git a/plugins/hydra_ray_launcher/hydra_plugins/hydra_ray_launcher/_config.py b/plugins/hydra_ray_launcher/hydra_plugins/hydra_ray_launcher/_config.py index 01432b0bfbe..e4e1ac09eb8 100644 --- a/plugins/hydra_ray_launcher/hydra_plugins/hydra_ray_launcher/_config.py +++ b/plugins/hydra_ray_launcher/hydra_plugins/hydra_ray_launcher/_config.py @@ -3,11 +3,11 @@ from dataclasses import dataclass, field from enum import Enum, IntEnum from importlib import import_module +from importlib.metadata import version from typing import Any, Dict, List, Optional from hydra.core.config_store import ConfigStore from omegaconf import OmegaConf -from pkg_resources import get_distribution @dataclass @@ -178,11 +178,11 @@ def _pip_pkgs_default_factory() -> Dict[str, str]: "hydra_core": "${ray_pkg_version:hydra}", "ray": "${ray_pkg_version:ray}", "cloudpickle": "${ray_pkg_version:cloudpickle}", - "hydra_ray_launcher": get_distribution("hydra_ray_launcher").version, + "hydra_ray_launcher": version("hydra_ray_launcher"), } if sys.version_info < (3, 8): - d["pickle5"] = get_distribution("pickle5").version + d["pickle5"] = version("pickle5") return d diff --git a/plugins/hydra_ray_launcher/hydra_plugins/hydra_ray_launcher/_core.py b/plugins/hydra_ray_launcher/hydra_plugins/hydra_ray_launcher/_core.py index 9819f7dcd3f..35da61802d6 100644 --- a/plugins/hydra_ray_launcher/hydra_plugins/hydra_ray_launcher/_core.py +++ b/plugins/hydra_ray_launcher/hydra_plugins/hydra_ray_launcher/_core.py @@ -32,6 +32,8 @@ def launch( f"sweep output dir: {sweep_dir}" ) + # Avoid allocating too little memory in CI https://github.com/ray-project/ray/issues/11966#issuecomment-1318100747 + launcher.ray_cfg.init.setdefault("object_store_memory", 78643200) start_ray(launcher.ray_cfg.init) runs = [] diff --git a/plugins/hydra_rq_launcher/hydra_plugins/hydra_rq_launcher/_core.py b/plugins/hydra_rq_launcher/hydra_plugins/hydra_rq_launcher/_core.py index 36a2bf551dc..fde4fcb03bf 100644 --- a/plugins/hydra_rq_launcher/hydra_plugins/hydra_rq_launcher/_core.py +++ b/plugins/hydra_rq_launcher/hydra_plugins/hydra_rq_launcher/_core.py @@ -19,7 +19,7 @@ from hydra.types import HydraContext, TaskFunction from omegaconf import DictConfig, OmegaConf, open_dict from redis import Redis -from rq import Queue # type: ignore +from rq import Queue from .rq_launcher import RQLauncher diff --git a/plugins/hydra_rq_launcher/setup.py b/plugins/hydra_rq_launcher/setup.py index eb41695ae81..b3881755914 100644 --- a/plugins/hydra_rq_launcher/setup.py +++ b/plugins/hydra_rq_launcher/setup.py @@ -29,7 +29,7 @@ "cloudpickle", "fakeredis<1.7.4", # https://github.com/dsoftwareinc/fakeredis-py/issues/3 "hydra-core>=1.1.0.dev7", - "rq>=1.5.1", + "rq>=1.5.1,<1.12", ], include_package_data=True, ) diff --git a/plugins/hydra_submitit_launcher/tests/test_submitit_launcher.py b/plugins/hydra_submitit_launcher/tests/test_submitit_launcher.py index d59000efd2b..65f7a0e6a4c 100644 --- a/plugins/hydra_submitit_launcher/tests/test_submitit_launcher.py +++ b/plugins/hydra_submitit_launcher/tests/test_submitit_launcher.py @@ -58,5 +58,6 @@ def test_example(tmpdir: Path) -> None: "-m", f"hydra.sweep.dir={tmpdir}", "hydra/launcher=submitit_local", - ] + ], + allow_warnings=True, ) diff --git a/pytest.ini b/pytest.ini index bfbef0b9979..3b72ada2972 100644 --- a/pytest.ini +++ b/pytest.ini @@ -15,4 +15,6 @@ filterwarnings = ; Remove when default changes ignore:.*Future Hydra versions will no longer change working directory at job runtime by default.*:UserWarning ; Jupyter notebook test on Windows yield warnings - ignore:.*Proactor event loop does not implement add_reader family of methods required for zmq.*:RuntimeWarning \ No newline at end of file + ignore:.*Proactor event loop does not implement add_reader family of methods required for zmq.*:RuntimeWarning + ; Ignore deprecation warning related to pkg_resources + ignore:.*pkg_resources is deprecated* diff --git a/requirements/dev.txt b/requirements/dev.txt index c43ca403a20..d93d0295e9a 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -5,6 +5,7 @@ build coverage flake8<6 # pinned due to https://github.com/savoirfairelinux/flake8-copyright/issues/19 flake8-copyright +importlib-metadata<5.0; python_version <= '3.7' isort==5.5.2 mypy nox diff --git a/website/docs/advanced/compose_api.md b/website/docs/advanced/compose_api.md index e7bbaff79b0..f73b341e389 100644 --- a/website/docs/advanced/compose_api.md +++ b/website/docs/advanced/compose_api.md @@ -34,7 +34,7 @@ There are 3 initialization methods: All 3 can be used as methods or contexts. When used as methods, they are initializing Hydra globally and should only be called once. -When used as contexts, they are initializing Hydra within the context can be used multiple times. +When used as contexts, they are initializing Hydra within the context and can be used multiple times. Like @hydra.main() all three support the [version_base](../upgrades/version_base.md) parameter to define the compatibility level to use. diff --git a/website/docs/advanced/instantiate_objects/overview.md b/website/docs/advanced/instantiate_objects/overview.md index 01f88be9d97..5030d3d27fe 100644 --- a/website/docs/advanced/instantiate_objects/overview.md +++ b/website/docs/advanced/instantiate_objects/overview.md @@ -270,7 +270,7 @@ assert isinstance(obj_object.foo, Foo) assert isinstance(obj_object.bar, dict) obj_all = instantiate(cfg, _convert_="all") -assert isinstance(obj_none, MyTarget) +assert isinstance(obj_all, MyTarget) assert isinstance(obj_all.foo, dict) assert isinstance(obj_all.bar, dict) ``` diff --git a/website/versioned_docs/version-1.3/tutorials/basic/running_your_app/3_working_directory.md b/website/versioned_docs/version-1.3/tutorials/basic/running_your_app/3_working_directory.md index 12f1190e4de..0dd4afc6241 100644 --- a/website/versioned_docs/version-1.3/tutorials/basic/running_your_app/3_working_directory.md +++ b/website/versioned_docs/version-1.3/tutorials/basic/running_your_app/3_working_directory.md @@ -66,6 +66,7 @@ By setting `hydra.job.chdir=True`, you can configure Hydra's `@hydra.main` decorator to change python's working directory by calling `os.chdir` before passing control to the user's decorated main function. As of Hydra v1.2, `hydra.job.chdir` defaults to `False`. + Setting `hydra.job.chdir=True` enables convenient use of the output directory to store output for the application (For example, a database dump file).