Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drop py3.7 & fix CI #2854

Merged
merged 8 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ jobs:
# Misc
coverage:
docker:
- image: circleci/python:3.7
- image: circleci/python:3.8
steps:
- checkout
- run: sudo pip install nox --progress-bar off
Expand All @@ -287,19 +287,19 @@ workflows:
- test_macos:
matrix:
parameters:
py_version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
py_version: ["3.8", "3.9", "3.10", "3.11"]
- test_linux:
matrix:
parameters:
py_version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
py_version: ["3.8", "3.9", "3.10", "3.11"]
- test_win:
matrix:
parameters:
py_version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
py_version: ["3.8", "3.9", "3.10", "3.11"]
- test_linux_omc_dev:
matrix:
parameters:
py_version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
py_version: ["3.8", "3.9", "3.10", "3.11"]


plugin_tests:
Expand All @@ -308,17 +308,17 @@ workflows:
- test_plugin_linux:
matrix:
parameters:
py_version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
py_version: ["3.8", "3.9", "3.10", "3.11"]
test_plugin: [<< pipeline.parameters.test_plugins >>]
- test_plugin_macos:
matrix:
parameters:
py_version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
py_version: ["3.8", "3.9", "3.10", "3.11"]
test_plugin: [<< pipeline.parameters.test_plugins >>]
- test_plugin_win:
matrix:
parameters:
py_version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
py_version: ["3.8", "3.9", "3.10", "3.11"]
test_plugin: [<< pipeline.parameters.test_plugins >>]


Expand Down
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ max-line-length = 119
copyright-check = True
select = E,F,W,C
copyright-regexp=Copyright \(c\) Facebook, Inc. and its affiliates. All Rights Reserved
ignore=W503,E203
ignore=W503,E203,E701,E704
1 change: 0 additions & 1 deletion examples/plugins/example_configsource_plugin/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"License :: OSI Approved :: MIT License",
# Hydra uses Python version and Operating system to determine
# In which environments to test this plugin
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand Down
1 change: 0 additions & 1 deletion examples/plugins/example_generic_plugin/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"License :: OSI Approved :: MIT License",
# Hydra uses Python version and Operating system to determine
# In which environments to test this plugin
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand Down
1 change: 0 additions & 1 deletion examples/plugins/example_launcher_plugin/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"License :: OSI Approved :: MIT License",
# Hydra uses Python version and Operating system to determine
# In which environments to test this plugin
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand Down
1 change: 0 additions & 1 deletion examples/plugins/example_registered_plugin/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"License :: OSI Approved :: MIT License",
# Hydra uses Python version and Operating system to determine
# In which environments to test this plugin
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand Down
1 change: 0 additions & 1 deletion examples/plugins/example_searchpath_plugin/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"License :: OSI Approved :: MIT License",
# Hydra uses Python version and Operating system to determine
# In which environments to test this plugin
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand Down
1 change: 0 additions & 1 deletion examples/plugins/example_sweeper_plugin/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"License :: OSI Approved :: MIT License",
# Hydra uses Python version and Operating system to determine
# In which environments to test this plugin
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand Down
2 changes: 1 addition & 1 deletion hydra/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved

# Source of truth for Hydra's version
__version__ = "1.4.0.dev0"
__version__ = "1.4.0.dev1"
from hydra import utils
from hydra.errors import MissingConfigException
from hydra.main import main
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def scheme() -> str:

def _read_config(self, res: Any) -> ConfigResult:
try:
if sys.version_info[0:2] >= (3, 8) and isinstance(res, zipfile.Path):
if isinstance(res, zipfile.Path):
# zipfile does not support encoding, read() calls returns bytes.
f = res.open()
else:
Expand Down
7 changes: 1 addition & 6 deletions hydra/test_utils/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from difflib import unified_diff
from pathlib import Path
from subprocess import PIPE, Popen
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union
from typing import Any, Callable, Dict, Iterator, List, Optional, Protocol, Tuple, Union

from omegaconf import Container, DictConfig, OmegaConf

Expand All @@ -25,11 +25,6 @@
from hydra.core.utils import JobReturn, validate_config_path
from hydra.types import TaskFunction

if sys.version_info >= (3, 8, 0):
from typing import Protocol
else:
from typing_extensions import Protocol # type: ignore


@contextmanager
def does_not_raise(enter_result: Any = None) -> Iterator[Any]:
Expand Down
1 change: 1 addition & 0 deletions news/2852.api_change
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Python 3.6 and 3.7 are not supported anymore: Hydra now requires Python 3.8+
odelalleau marked this conversation as resolved.
Show resolved Hide resolved
8 changes: 2 additions & 6 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

BASE = os.path.abspath(os.path.dirname(__file__))

DEFAULT_PYTHON_VERSIONS = ["3.7", "3.8", "3.9", "3.10", "3.11"]
DEFAULT_PYTHON_VERSIONS = ["3.8", "3.9", "3.10", "3.11"]
DEFAULT_OS_NAMES = ["Linux", "MacOS", "Windows"]

PYTHON_VERSIONS = os.environ.get(
Expand Down Expand Up @@ -308,7 +308,7 @@ def _isort_cmd() -> List[str]:
return isort


def _mypy_cmd(strict: bool, python_version: Optional[str] = "3.7") -> List[str]:
def _mypy_cmd(strict: bool, python_version: Optional[str] = "3.8") -> List[str]:
mypy = [
"mypy",
"--install-types",
Expand All @@ -325,8 +325,6 @@ def _mypy_cmd(strict: bool, python_version: Optional[str] = "3.7") -> List[str]:

@nox.session(python=PYTHON_VERSIONS) # type: ignore
def lint(session: Session) -> None:
if session_python_as_tuple(session) <= (3, 6):
session.skip(f"Skipping session {session.name} as python >= 3.7 is required")
_upgrade_basic(session)
install_dev_deps(session)
install_hydra(session, ["pip", "install", "-e"])
Expand Down Expand Up @@ -416,8 +414,6 @@ def lint_plugins_in_dir(session: Session, directory: str) -> None:
@nox.session(python=PYTHON_VERSIONS) # type: ignore
@nox.parametrize("plugin", list_plugins("plugins"), ids=[p.name for p in list_plugins("plugins")]) # type: ignore
def lint_plugins(session: Session, plugin: Plugin) -> None:
if session_python_as_tuple(session) <= (3, 6):
session.skip(f"Skipping session {session.name} as python >= 3.7 is required")
if not is_plugin_compatible(session, plugin):
session.skip(f"Skipping session {session.name}")
_upgrade_basic(session)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved

__version__ = "1.3.0.dev0"
__version__ = "1.4.0.dev0"
1 change: 0 additions & 1 deletion plugins/hydra_ax_sweeper/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
packages=find_namespace_packages(include=["hydra_plugins.*"]),
classifiers=[
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved

__version__ = "1.3.0.dev0"
__version__ = "1.4.0.dev0"
1 change: 0 additions & 1 deletion plugins/hydra_colorlog/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
packages=find_namespace_packages(include=["hydra_plugins.*"]),
classifiers=[
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved

__version__ = "1.3.0.dev0"
__version__ = "1.4.0.dev0"
1 change: 0 additions & 1 deletion plugins/hydra_joblib_launcher/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
packages=find_namespace_packages(include=["hydra_plugins.*"]),
classifiers=[
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved

__version__ = "1.3.0.dev0"
__version__ = "1.4.0.dev0"
1 change: 0 additions & 1 deletion plugins/hydra_nevergrad_sweeper/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
packages=find_namespace_packages(include=["hydra_plugins.*"]),
classifiers=[
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved

__version__ = "1.3.0.dev0"
__version__ = "1.4.0.dev0"
1 change: 0 additions & 1 deletion plugins/hydra_optuna_sweeper/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
packages=find_namespace_packages(include=["hydra_plugins.*"]),
classifiers=[
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved

__version__ = "1.2.1"
__version__ = "1.4.0.dev0"
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
security_group_id: sg-095ac7c26aa0d33bb
python_versions:
- 3.7
- 3.8
- 3.9
ray_yaml:
Expand Down
1 change: 0 additions & 1 deletion plugins/hydra_ray_launcher/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
packages=find_namespace_packages(include=["hydra_plugins.*"]),
classifiers=[
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved

__version__ = "1.3.0.dev0"
__version__ = "1.4.0.dev0"
1 change: 0 additions & 1 deletion plugins/hydra_rq_launcher/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
packages=find_namespace_packages(include=["hydra_plugins.*"]),
classifiers=[
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved

__version__ = "1.3.0.dev0"
__version__ = "1.4.0.dev0"
1 change: 0 additions & 1 deletion plugins/hydra_submitit_launcher/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
packages=find_namespace_packages(include=["hydra_plugins.*"]),
classifiers=[
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand Down
1 change: 0 additions & 1 deletion requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ 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
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
classifiers=[
"License :: OSI Approved :: MIT License",
"Development Status :: 4 - Beta",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand Down
18 changes: 0 additions & 18 deletions tests/instantiate/positional_only.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved

# Contains Python 3.8 syntax
# flake does not like it when running on older versions of Python
# flake8: noqa
# With mypy, there does not seem to be a way to prevent an error when running in Python < 3.8.
# For this reason, I am including the code as a string (the horror).
# Once we upgrade to mypy 0.812, we should be able to use --exclude and eliminate this hack.
from typing import Any

code = """


class PosOnlyArgsClass:
def __init__(self, a: Any, b: Any, /, **kwargs: Any) -> None:
Expand All @@ -28,12 +19,3 @@ def __eq__(self, other: Any) -> Any:
)
else:
return NotImplemented
"""


# Dummy class to keep mypy happy
class PosOnlyArgsClass:
def __init__(self, *args: Any, **kwargs: Any) -> None: ...


exec(code) # nosec
10 changes: 1 addition & 9 deletions tests/instantiate/test_positional_only_arguments.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import sys
from typing import Any

from pytest import mark, param, skip
from pytest import mark, param

from hydra.utils import instantiate

if sys.version_info < (3, 8):
skip(
reason="Positional-only syntax is only supported in Python 3.8 or newer",
allow_module_level=True,
)


from .positional_only import PosOnlyArgsClass


Expand Down
2 changes: 0 additions & 2 deletions tests/test_config_repository.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import copy
import re
import sys
import zipfile
from typing import Any, List

Expand Down Expand Up @@ -198,7 +197,6 @@ def test_restore_singleton_state_hack() -> None:
Singleton.set_state(state)


@mark.skipif(sys.version_info[0:2] < (3, 8), reason="zip.Path available in python 3.8+")
def test_importlib_resource_load_zip_path() -> None:
config_source = ImportlibResourcesConfigSource(provider="foo", path="pkg://bar")
conf = config_source._read_config(
Expand Down
8 changes: 4 additions & 4 deletions tests/test_core_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ def test_accessing_hydra_config(hydra_restore_singletons: Any) -> Any:


def test_py_version_resolver(hydra_restore_singletons: Any, monkeypatch: Any) -> Any:
monkeypatch.setattr(sys, "version_info", (3, 7, 2))
monkeypatch.setattr(sys, "version_info", (3, 8, 2))
utils.setup_globals()
assert OmegaConf.create({"key": "${python_version:}"}).key == "3.7"
assert OmegaConf.create({"key": "${python_version:}"}).key == "3.8"
assert OmegaConf.create({"key": "${python_version:major}"}).key == "3"
assert OmegaConf.create({"key": "${python_version:minor}"}).key == "3.7"
assert OmegaConf.create({"key": "${python_version:micro}"}).key == "3.7.2"
assert OmegaConf.create({"key": "${python_version:minor}"}).key == "3.8"
assert OmegaConf.create({"key": "${python_version:micro}"}).key == "3.8.2"
1 change: 0 additions & 1 deletion tools/configen/configen/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import sys
from enum import Enum
from typing import Any, Dict, Iterable, List, Optional, Set

Expand Down
Loading