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

Update dependencies (shimmy, sphinx), remove sphinx_autodoc_typehints #1724

Merged
merged 6 commits into from
Oct 24, 2023
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
5 changes: 5 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,8 @@ formats: all
# Set requirements using conda env
conda:
environment: docs/conda_env.yml

build:
os: ubuntu-22.04
tools:
python: "mambaforge-22.9"
5 changes: 2 additions & 3 deletions docs/conda_env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ dependencies:
- pandas
- numpy
- matplotlib
- sphinx_autodoc_typehints
- sphinx>=5.3,<7.0
- sphinx_rtd_theme>=1.0
- sphinx>=5,<8
- sphinx_rtd_theme>=1.3.0
- sphinx_copybutton
3 changes: 2 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
# ones.
extensions = [
"sphinx.ext.autodoc",
"sphinx_autodoc_typehints",
"sphinx.ext.autosummary",
"sphinx.ext.mathjax",
"sphinx.ext.ifconfig",
Expand All @@ -73,6 +72,8 @@
# 'sphinx.ext.doctest'
]

autodoc_typehints = "description"

if enable_spell_check:
extensions.append("sphinxcontrib.spelling")

Expand Down
3 changes: 2 additions & 1 deletion docs/misc/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Changelog
==========

Release 2.2.0a7 (WIP)
Release 2.2.0a8 (WIP)
--------------------------

Breaking Changes:
Expand Down Expand Up @@ -55,6 +55,7 @@ Others:
- Fixed ``stable_baselines3/her/her_replay_buffer.py`` type hints
- Buffers do no call an additional ``.copy()`` when storing new transitions
- 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:
^^^^^^^^^^^^^^
Expand Down
8 changes: 3 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"tqdm",
"rich",
# For atari games,
"shimmy[atari]~=1.1.0",
"shimmy[atari]~=1.3.0",
"pillow",
]

Expand Down Expand Up @@ -126,13 +126,11 @@
"black>=23.9.1,<24",
],
"docs": [
"sphinx>=5.3,<7.0",
"sphinx>=5,<8",
"sphinx-autobuild",
"sphinx-rtd-theme",
"sphinx-rtd-theme>=1.3.0",
# For spelling
"sphinxcontrib.spelling",
# Type hints support
"sphinx-autodoc-typehints",
# Copy button for code snippets
"sphinx_copybutton",
],
Expand Down
7 changes: 5 additions & 2 deletions stable_baselines3/common/callbacks.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import warnings
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 numpy as np
Expand All @@ -19,10 +19,13 @@
# if the progress bar is used
tqdm = None

from stable_baselines3.common import base_class

from stable_baselines3.common.evaluation import evaluate_policy
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):
"""
Expand Down
12 changes: 7 additions & 5 deletions stable_baselines3/common/type_aliases.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
"""Common aliases for type hints"""

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 numpy as np
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]
GymResetReturn = Tuple[GymObs, Dict]
AtariResetReturn = Tuple[np.ndarray, Dict[str, Any]]
GymStepReturn = Tuple[GymObs, float, bool, bool, Dict]
AtariStepReturn = Tuple[np.ndarray, SupportsFloat, bool, bool, Dict[str, Any]]
TensorDict = Dict[str, th.Tensor]
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
# and ouputs a scalar (e.g. learning rate, clip range, ...)
Expand Down
2 changes: 1 addition & 1 deletion stable_baselines3/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.2.0a7
2.2.0a8