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 all commits
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
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pycqa/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
files: 'hydra/.*'
Expand All @@ -10,7 +10,7 @@ repos:
files: 'tools/.*'

- repo: https://github.com/psf/black
rev: 23.1.0
rev: 24.2.0
hooks:
- id: black

Expand All @@ -20,7 +20,7 @@ repos:
- id: flake8

- repo: https://github.com/adrienverge/yamllint.git
rev: v1.30.0
rev: v1.35.1
hooks:
- id: yamllint
args: [-c=.yamllint, --strict]
3 changes: 1 addition & 2 deletions examples/instantiate/object/my_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@


class DBConnection:
def connect(self) -> None:
...
def connect(self) -> None: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.


class MySQLConnection(DBConnection):
Expand Down
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
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@
)
],
)
class TestExampleSweeper(LauncherTestSuite):
...
class TestExampleSweeper(LauncherTestSuite): ...

Check notice

Code scanning / CodeQL

Statement has no effect Note test

This statement has no effect.


# Many sweepers are batching jobs in groups.
Expand All @@ -73,8 +72,7 @@
)
],
)
class TestExampleSweeperWithBatching(BatchedSweeperTestSuite):
...
class TestExampleSweeperWithBatching(BatchedSweeperTestSuite): ...

Check notice

Code scanning / CodeQL

Statement has no effect Note test

This statement has no effect.


# Run integration test suite with the basic launcher and this sweeper
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
21 changes: 7 additions & 14 deletions hydra/_internal/config_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,34 +27,27 @@

class IConfigRepository(ABC):
@abstractmethod
def get_schema_source(self) -> ConfigSource:
...
def get_schema_source(self) -> ConfigSource: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.

@abstractmethod
def load_config(self, config_path: str) -> Optional[ConfigResult]:
...
def load_config(self, config_path: str) -> Optional[ConfigResult]: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.

@abstractmethod
def group_exists(self, config_path: str) -> bool:
...
def group_exists(self, config_path: str) -> bool: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.

@abstractmethod
def config_exists(self, config_path: str) -> bool:
...
def config_exists(self, config_path: str) -> bool: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.

@abstractmethod
def get_group_options(
self, group_name: str, results_filter: Optional[ObjectType] = ObjectType.CONFIG
) -> List[str]:
...
) -> List[str]: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.

@abstractmethod
def get_sources(self) -> List[ConfigSource]:
...
def get_sources(self) -> List[ConfigSource]: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.

@abstractmethod
def initialize_sources(self, config_search_path: ConfigSearchPath) -> None:
...
def initialize_sources(self, config_search_path: ConfigSearchPath) -> None: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.


class ConfigRepository(IConfigRepository):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,18 @@ 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:
f = res.open(encoding="utf-8")
header_text = f.read(512)
if isinstance(header_text, bytes):
# if header is bytes, utf-8 decode (zipfile path)
header_text = header_text.decode("utf-8")
header = ConfigSource._get_header_dict(header_text)
header_text_str = header_text.decode("utf-8")
else:
header_text_str = header_text
header = ConfigSource._get_header_dict(header_text_str)
f.seek(0)
cfg = OmegaConf.load(f)
return ConfigResult(
Expand Down
21 changes: 7 additions & 14 deletions hydra/core/config_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,21 @@
run_mode: RunMode,
from_shell: bool = True,
validate_sweep_overrides: bool = True,
) -> DictConfig:
...
) -> DictConfig: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.

@abstractmethod
def load_sweep_config(
self, master_config: DictConfig, sweep_overrides: List[str]
) -> DictConfig:
...
) -> DictConfig: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.

@abstractmethod
def get_search_path(self) -> ConfigSearchPath:
...
def get_search_path(self) -> ConfigSearchPath: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.

@abstractmethod
def get_sources(self) -> List[ConfigSource]:
...
def get_sources(self) -> List[ConfigSource]: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.

@abstractmethod
def list_groups(self, parent_name: str) -> List[str]:
...
def list_groups(self, parent_name: str) -> List[str]: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.

@abstractmethod
def get_group_options(
Expand All @@ -51,14 +46,12 @@
results_filter: Optional[ObjectType] = ObjectType.CONFIG,
config_name: Optional[str] = None,
overrides: Optional[List[str]] = None,
) -> List[str]:
...
) -> List[str]: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.

@abstractmethod
def compute_defaults_list(
self,
config_name: Optional[str],
overrides: List[str],
run_mode: RunMode,
) -> Any:
...
) -> Any: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.
3 changes: 1 addition & 2 deletions hydra/core/config_search_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@

class ConfigSearchPath(ABC):
@abstractmethod
def get_path(self) -> MutableSequence[SearchPathElement]:
...
def get_path(self) -> MutableSequence[SearchPathElement]: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.

@abstractmethod
def append(
Expand Down
3 changes: 1 addition & 2 deletions hydra/core/config_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
group=group, name=name, node=node, package=package, provider=self.provider
)

def __exit__(self, exc_type: Any, exc_value: Any, exc_traceback: Any) -> Any:
...
def __exit__(self, exc_type: Any, exc_value: Any, exc_traceback: Any) -> Any: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.


@dataclass
Expand Down
18 changes: 6 additions & 12 deletions hydra/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@
from typing import Optional, Sequence


class HydraException(Exception):
...
class HydraException(Exception): ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.


class CompactHydraException(HydraException):
...
class CompactHydraException(HydraException): ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.


class OverrideParseException(CompactHydraException):
Expand All @@ -17,16 +15,13 @@
self.message = message


class InstantiationException(CompactHydraException):
...
class InstantiationException(CompactHydraException): ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.


class ConfigCompositionException(CompactHydraException):
...
class ConfigCompositionException(CompactHydraException): ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.


class SearchPathException(CompactHydraException):
...
class SearchPathException(CompactHydraException): ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.


class MissingConfigException(IOError, ConfigCompositionException):
Expand All @@ -41,5 +36,4 @@
self.options = options


class HydraDeprecationError(HydraException):
...
class HydraDeprecationError(HydraException): ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.
9 changes: 7 additions & 2 deletions hydra/experimental/initialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def __init__(
config_path=config_path,
job_name=job_name,
caller_stack_depth=caller_stack_depth + 1,
version_base=str(version.getbase()),
odelalleau marked this conversation as resolved.
Show resolved Hide resolved
)

def __enter__(self, *args: Any, **kwargs: Any) -> None:
Expand Down Expand Up @@ -80,7 +81,9 @@ def __init__(self, config_module: str, job_name: str = "app") -> None:
deprecation_warning(message=message)

self.delegate = real_initialize_config_module(
config_module=config_module, job_name=job_name
config_module=config_module,
job_name=job_name,
version_base=str(version.getbase()),
)

def __enter__(self, *args: Any, **kwargs: Any) -> None:
Expand Down Expand Up @@ -116,7 +119,9 @@ def __init__(self, config_dir: str, job_name: str = "app") -> None:
deprecation_warning(message=message)

self.delegate = real_initialize_config_dir(
config_dir=config_dir, job_name=job_name
config_dir=config_dir,
job_name=job_name,
version_base=str(version.getbase()),
)

def __enter__(self, *args: Any, **kwargs: Any) -> None:
Expand Down
Loading
Loading