Skip to content

Commit

Permalink
Support Python3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
Jasha10 committed Apr 28, 2022
1 parent 6590a94 commit b9544f1
Show file tree
Hide file tree
Showing 26 changed files with 55 additions and 13 deletions.
14 changes: 7 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -271,19 +271,19 @@ workflows:
- test_macos:
matrix:
parameters:
py_version: ["3.6", "3.7", "3.8", "3.9"]
py_version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
- test_linux:
matrix:
parameters:
py_version: ["3.6", "3.7", "3.8", "3.9"]
py_version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
- test_win:
matrix:
parameters:
py_version: ["3.6", "3.7", "3.8", "3.9"]
py_version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
- test_linux_omc_dev:
matrix:
parameters:
py_version: ["3.6", "3.7", "3.8", "3.9"]
py_version: ["3.6", "3.7", "3.8", "3.9", "3.10"]


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


Expand Down
1 change: 1 addition & 0 deletions examples/plugins/example_configsource_plugin/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Operating System :: OS Independent",
],
install_requires=[
Expand Down
1 change: 1 addition & 0 deletions examples/plugins/example_generic_plugin/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Operating System :: OS Independent",
],
install_requires=[
Expand Down
1 change: 1 addition & 0 deletions examples/plugins/example_launcher_plugin/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Operating System :: OS Independent",
],
install_requires=[
Expand Down
1 change: 1 addition & 0 deletions examples/plugins/example_registered_plugin/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Operating System :: OS Independent",
],
install_requires=[
Expand Down
1 change: 1 addition & 0 deletions examples/plugins/example_searchpath_plugin/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Operating System :: OS Independent",
],
install_requires=[
Expand Down
1 change: 1 addition & 0 deletions examples/plugins/example_sweeper_plugin/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Operating System :: OS Independent",
],
install_requires=[
Expand Down
2 changes: 1 addition & 1 deletion hydra/_internal/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ class FakeTracebackType:
assert iter_tb.tb_next is not None
iter_tb = iter_tb.tb_next

print_exception(etype=None, value=ex, tb=final_tb) # type: ignore
print_exception(None, value=ex, tb=final_tb) # type: ignore
sys.stderr.write(
"\nSet the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.\n"
)
Expand Down
20 changes: 17 additions & 3 deletions hydra/core/plugins.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import importlib
import importlib.util
import inspect
import pkgutil
import sys
Expand Down Expand Up @@ -181,10 +182,23 @@ def _scan_all_plugins(
if module_name.startswith("_") and not module_name.startswith("__"):
continue
import_time = timer()
m = importer.find_module(modname) # type: ignore
assert m is not None

with warnings.catch_warnings(record=True) as recorded_warnings:
loaded_mod = m.load_module(modname)
if sys.version_info < (3, 10):
m = importer.find_module(modname) # type: ignore
assert m is not None
loaded_mod = m.load_module(modname)
else:
spec = importer.find_spec(modname)
assert spec is not None
if modname in sys.modules:
loaded_mod = sys.modules[modname]
else:
loaded_mod = importlib.util.module_from_spec(spec)
if loaded_mod is not None:
spec.loader.exec_module(loaded_mod)
sys.modules[modname] = loaded_mod

import_time = timer() - import_time
if len(recorded_warnings) > 0:
sys.stderr.write(
Expand Down
1 change: 1 addition & 0 deletions news/1856.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Support for Python 3.10
10 changes: 8 additions & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

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

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

PYTHON_VERSIONS = os.environ.get(
Expand Down Expand Up @@ -546,6 +546,7 @@ def test_jupyter_notebooks(session):
install_hydra(session, ["pip", "install", "-e"])
args = pytest_args(
"--nbval",
"-W ignore::DeprecationWarning",
"-W ignore::ResourceWarning",
"examples/jupyter_notebooks/compose_configs_in_notebook.ipynb",
)
Expand All @@ -555,7 +556,12 @@ def test_jupyter_notebooks(session):
for notebook in [
file for file in notebooks_dir.iterdir() if str(file).endswith(".ipynb")
]:
args = pytest_args("--nbval", "-W ignore::ResourceWarning", str(notebook))
args = pytest_args(
"--nbval",
"-W ignore::DeprecationWarning",
"-W ignore::ResourceWarning",
str(notebook),
)
args = [x for x in args if x != "-Werror"]
session.run(*args, silent=SILENT)

Expand Down
1 change: 1 addition & 0 deletions plugins/hydra_ax_sweeper/news/1856.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Support for Python 3.10
1 change: 1 addition & 0 deletions plugins/hydra_ax_sweeper/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Operating System :: POSIX :: Linux",
"Operating System :: MacOS",
"Development Status :: 4 - Beta",
Expand Down
1 change: 1 addition & 0 deletions plugins/hydra_colorlog/news/1856.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Support for Python 3.10
1 change: 1 addition & 0 deletions plugins/hydra_colorlog/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Operating System :: OS Independent",
],
install_requires=["colorlog", "hydra-core>=1.0.0"],
Expand Down
1 change: 1 addition & 0 deletions plugins/hydra_joblib_launcher/news/1856.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Support for Python 3.10
1 change: 1 addition & 0 deletions plugins/hydra_joblib_launcher/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Operating System :: MacOS",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
Expand Down
1 change: 1 addition & 0 deletions plugins/hydra_nevergrad_sweeper/news/1856.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Support for Python 3.10
1 change: 1 addition & 0 deletions plugins/hydra_nevergrad_sweeper/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Operating System :: OS Independent",
"Development Status :: 4 - Beta",
],
Expand Down
1 change: 1 addition & 0 deletions plugins/hydra_optuna_sweeper/news/1856.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Support for Python 3.10
1 change: 1 addition & 0 deletions plugins/hydra_optuna_sweeper/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Operating System :: POSIX :: Linux",
"Operating System :: MacOS",
"Development Status :: 4 - Beta",
Expand Down
1 change: 1 addition & 0 deletions plugins/hydra_rq_launcher/news/1856.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Support for Python 3.10
1 change: 1 addition & 0 deletions plugins/hydra_rq_launcher/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Operating System :: MacOS",
"Operating System :: POSIX :: Linux",
],
Expand Down
1 change: 1 addition & 0 deletions plugins/hydra_submitit_launcher/news/1856.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Support for Python 3.10
1 change: 1 addition & 0 deletions plugins/hydra_submitit_launcher/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Operating System :: MacOS",
"Operating System :: POSIX :: Linux",
"Development Status :: 4 - Beta",
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Operating System :: POSIX :: Linux",
"Operating System :: MacOS",
"Operating System :: Microsoft :: Windows",
Expand Down

0 comments on commit b9544f1

Please sign in to comment.