Update importlib_metadata entry_point calls (#2538)

This commit is contained in:
Jesse Farebrother
2021-12-22 13:54:20 -05:00
committed by GitHub
parent 102cd1bf4c
commit eb6d826aac
2 changed files with 3 additions and 3 deletions

View File

@@ -5,7 +5,7 @@ import importlib
import contextlib import contextlib
from typing import Callable, Type, Optional, Union, Dict, Set, Tuple, Generator from typing import Callable, Type, Optional, Union, Dict, Set, Tuple, Generator
if sys.version_info < (3, 8): if sys.version_info < (3, 10):
import importlib_metadata as metadata # type: ignore import importlib_metadata as metadata # type: ignore
else: else:
import importlib.metadata as metadata import importlib.metadata as metadata
@@ -794,7 +794,7 @@ def namespace(ns: str):
def load_env_plugins(entry_point: str = "gym.envs") -> None: def load_env_plugins(entry_point: str = "gym.envs") -> None:
# Load third-party environments # Load third-party environments
for plugin in metadata.entry_points().get(entry_point, []): for plugin in metadata.entry_points(group=entry_point):
# Python 3.8 doesn't support plugin.module, plugin.attr # Python 3.8 doesn't support plugin.module, plugin.attr
# So we'll have to try and parse this ourselves # So we'll have to try and parse this ourselves
try: try:

View File

@@ -48,7 +48,7 @@ setup(
install_requires=[ install_requires=[
"numpy>=1.18.0", "numpy>=1.18.0",
"cloudpickle>=1.2.0", "cloudpickle>=1.2.0",
"importlib_metadata>=4.8.1; python_version < '3.8'", "importlib_metadata>=4.10.0; python_version < '3.10'",
], ],
extras_require=extras, extras_require=extras,
package_data={ package_data={