mirror of
https://github.com/saymrwulf/stable-baselines3.git
synced 2026-11-17 08:56:08 +00:00
Update dependencies (remove sphinx type hint plugin), protect type aliases
This commit is contained in:
parent
80245bccc8
commit
d672008a32
5 changed files with 17 additions and 10 deletions
|
|
@ -64,7 +64,6 @@ release = __version__
|
||||||
# ones.
|
# ones.
|
||||||
extensions = [
|
extensions = [
|
||||||
"sphinx.ext.autodoc",
|
"sphinx.ext.autodoc",
|
||||||
"sphinx_autodoc_typehints",
|
|
||||||
"sphinx.ext.autosummary",
|
"sphinx.ext.autosummary",
|
||||||
"sphinx.ext.mathjax",
|
"sphinx.ext.mathjax",
|
||||||
"sphinx.ext.ifconfig",
|
"sphinx.ext.ifconfig",
|
||||||
|
|
@ -73,6 +72,8 @@ extensions = [
|
||||||
# 'sphinx.ext.doctest'
|
# 'sphinx.ext.doctest'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
autodoc_typehints = "description"
|
||||||
|
|
||||||
if enable_spell_check:
|
if enable_spell_check:
|
||||||
extensions.append("sphinxcontrib.spelling")
|
extensions.append("sphinxcontrib.spelling")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
Changelog
|
Changelog
|
||||||
==========
|
==========
|
||||||
|
|
||||||
Release 2.2.0a7 (WIP)
|
Release 2.2.0a8 (WIP)
|
||||||
--------------------------
|
--------------------------
|
||||||
|
|
||||||
Breaking Changes:
|
Breaking Changes:
|
||||||
|
|
@ -55,6 +55,7 @@ Others:
|
||||||
- Fixed ``stable_baselines3/her/her_replay_buffer.py`` type hints
|
- Fixed ``stable_baselines3/her/her_replay_buffer.py`` type hints
|
||||||
- Buffers do no call an additional ``.copy()`` when storing new transitions
|
- Buffers do no call an additional ``.copy()`` when storing new transitions
|
||||||
- Fixed ``ActorCriticPolicy.extract_features()`` signature by adding an optional ``features_extractor`` argument
|
- Fixed ``ActorCriticPolicy.extract_features()`` signature by adding an optional ``features_extractor`` argument
|
||||||
|
- Update dependencies (accept newer Shimmy/Sphinx version and remove ``sphinx_autodoc_typehints``)
|
||||||
|
|
||||||
Documentation:
|
Documentation:
|
||||||
^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import os
|
import os
|
||||||
import warnings
|
import warnings
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from typing import Any, Callable, Dict, List, Optional, Union
|
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Union
|
||||||
|
|
||||||
import gymnasium as gym
|
import gymnasium as gym
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
@ -19,10 +19,13 @@ except ImportError:
|
||||||
# if the progress bar is used
|
# if the progress bar is used
|
||||||
tqdm = None
|
tqdm = None
|
||||||
|
|
||||||
from stable_baselines3.common import base_class
|
|
||||||
from stable_baselines3.common.evaluation import evaluate_policy
|
from stable_baselines3.common.evaluation import evaluate_policy
|
||||||
from stable_baselines3.common.vec_env import DummyVecEnv, VecEnv, sync_envs_normalization
|
from stable_baselines3.common.vec_env import DummyVecEnv, VecEnv, sync_envs_normalization
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from stable_baselines3.common import base_class
|
||||||
|
|
||||||
|
|
||||||
class BaseCallback(ABC):
|
class BaseCallback(ABC):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,17 @@
|
||||||
"""Common aliases for type hints"""
|
"""Common aliases for type hints"""
|
||||||
|
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from typing import Any, Callable, Dict, List, NamedTuple, Optional, Protocol, SupportsFloat, Tuple, Union
|
from typing import TYPE_CHECKING, Any, Callable, Dict, List, NamedTuple, Optional, Protocol, SupportsFloat, Tuple, Union
|
||||||
|
|
||||||
import gymnasium as gym
|
import gymnasium as gym
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import torch as th
|
import torch as th
|
||||||
|
|
||||||
from stable_baselines3.common import callbacks, vec_env
|
# Avoid circular imports, we use type hint as string to avoid it too
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from stable_baselines3.common.callbacks import BaseCallback
|
||||||
|
from stable_baselines3.common.vec_env import VecEnv
|
||||||
|
|
||||||
GymEnv = Union[gym.Env, vec_env.VecEnv]
|
GymEnv = Union[gym.Env, "VecEnv"]
|
||||||
GymObs = Union[Tuple, Dict[str, Any], np.ndarray, int]
|
GymObs = Union[Tuple, Dict[str, Any], np.ndarray, int]
|
||||||
GymResetReturn = Tuple[GymObs, Dict]
|
GymResetReturn = Tuple[GymObs, Dict]
|
||||||
AtariResetReturn = Tuple[np.ndarray, Dict[str, Any]]
|
AtariResetReturn = Tuple[np.ndarray, Dict[str, Any]]
|
||||||
|
|
@ -17,7 +19,7 @@ GymStepReturn = Tuple[GymObs, float, bool, bool, Dict]
|
||||||
AtariStepReturn = Tuple[np.ndarray, SupportsFloat, bool, bool, Dict[str, Any]]
|
AtariStepReturn = Tuple[np.ndarray, SupportsFloat, bool, bool, Dict[str, Any]]
|
||||||
TensorDict = Dict[str, th.Tensor]
|
TensorDict = Dict[str, th.Tensor]
|
||||||
OptimizerStateDict = Dict[str, Any]
|
OptimizerStateDict = Dict[str, Any]
|
||||||
MaybeCallback = Union[None, Callable, List[callbacks.BaseCallback], callbacks.BaseCallback]
|
MaybeCallback = Union[None, Callable, List["BaseCallback"], "BaseCallback"]
|
||||||
|
|
||||||
# A schedule takes the remaining progress as input
|
# A schedule takes the remaining progress as input
|
||||||
# and ouputs a scalar (e.g. learning rate, clip range, ...)
|
# and ouputs a scalar (e.g. learning rate, clip range, ...)
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
2.2.0a7
|
2.2.0a8
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue