Merge pull request #1724 from DLR-RM/chores/update-deps

Update dependencies (shimmy, sphinx), remove `sphinx_autodoc_typehints`
This commit is contained in:
M. Ernestus 2023-10-24 21:28:05 +02:00 committed by GitHub
commit f56ddeda10
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 27 additions and 18 deletions

View file

@ -14,3 +14,8 @@ formats: all
# Set requirements using conda env # Set requirements using conda env
conda: conda:
environment: docs/conda_env.yml environment: docs/conda_env.yml
build:
os: ubuntu-22.04
tools:
python: "mambaforge-22.9"

View file

@ -14,7 +14,6 @@ dependencies:
- pandas - pandas
- numpy - numpy
- matplotlib - matplotlib
- sphinx_autodoc_typehints - sphinx>=5,<8
- sphinx>=5.3,<7.0 - sphinx_rtd_theme>=1.3.0
- sphinx_rtd_theme>=1.0
- sphinx_copybutton - sphinx_copybutton

View file

@ -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")

View file

@ -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:
^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^

View file

@ -85,7 +85,7 @@ extra_no_roms = [
"tqdm", "tqdm",
"rich", "rich",
# For atari games, # For atari games,
"shimmy[atari]~=1.1.0", "shimmy[atari]~=1.3.0",
"pillow", "pillow",
] ]
@ -126,13 +126,11 @@ setup(
"black>=23.9.1,<24", "black>=23.9.1,<24",
], ],
"docs": [ "docs": [
"sphinx>=5.3,<7.0", "sphinx>=5,<8",
"sphinx-autobuild", "sphinx-autobuild",
"sphinx-rtd-theme", "sphinx-rtd-theme>=1.3.0",
# For spelling # For spelling
"sphinxcontrib.spelling", "sphinxcontrib.spelling",
# Type hints support
"sphinx-autodoc-typehints",
# Copy button for code snippets # Copy button for code snippets
"sphinx_copybutton", "sphinx_copybutton",
], ],

View file

@ -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):
""" """

View file

@ -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, ...)

View file

@ -1 +1 @@
2.2.0a7 2.2.0a8