From de92025bb2ec403698842345cdfa2754e3f5cf60 Mon Sep 17 00:00:00 2001 From: Antonin RAFFIN Date: Fri, 23 Jun 2023 13:10:17 +0200 Subject: [PATCH] Prepare Release v2.0 (#192) --- docs/misc/changelog.rst | 2 +- pyproject.toml | 9 +++++++-- sb3_contrib/ars/ars.py | 4 ++-- sb3_contrib/ppo_mask/ppo_mask.py | 4 ++-- sb3_contrib/ppo_recurrent/ppo_recurrent.py | 4 ++-- sb3_contrib/qrdqn/qrdqn.py | 4 ++-- sb3_contrib/tqc/tqc.py | 4 ++-- sb3_contrib/trpo/trpo.py | 4 ++-- sb3_contrib/version.txt | 2 +- setup.py | 4 +++- 10 files changed, 24 insertions(+), 17 deletions(-) diff --git a/docs/misc/changelog.rst b/docs/misc/changelog.rst index a9c35bb..3879c03 100644 --- a/docs/misc/changelog.rst +++ b/docs/misc/changelog.rst @@ -3,7 +3,7 @@ Changelog ========== -Release 2.0.0a13 (WIP) +Release 2.0.0 (2023-06-22) -------------------------- **Gymnasium support** diff --git a/pyproject.toml b/pyproject.toml index 2a2913e..017c0d4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,8 +4,13 @@ line-length = 127 # Assume Python 3.7 target-version = "py37" select = ["E", "F", "B", "UP", "C90", "RUF"] -# Ignore explicit stacklevel` -ignore = ["B028"] +# B028: Ignore explicit stacklevel` +# RUF013: Too many false positives (implicit optional) +ignore = ["B028", "RUF013"] + +[tool.ruff.per-file-ignores] +# ClassVar, implicit optional check not needed for tests +"./tests/*.py"= ["RUF012", "RUF013"] [tool.ruff.mccabe] # Unlike Flake8, ruff default to a complexity level of 10. diff --git a/sb3_contrib/ars/ars.py b/sb3_contrib/ars/ars.py index 20c9162..26d2d8a 100644 --- a/sb3_contrib/ars/ars.py +++ b/sb3_contrib/ars/ars.py @@ -3,7 +3,7 @@ import sys import time import warnings from functools import partial -from typing import Any, Dict, Optional, Type, TypeVar, Union +from typing import Any, ClassVar, Dict, Optional, Type, TypeVar, Union import numpy as np import torch as th @@ -50,7 +50,7 @@ class ARS(BaseAlgorithm): :param _init_setup_model: Whether or not to build the network at the creation of the instance """ - policy_aliases: Dict[str, Type[BasePolicy]] = { + policy_aliases: ClassVar[Dict[str, Type[BasePolicy]]] = { "MlpPolicy": MlpPolicy, "LinearPolicy": LinearPolicy, } diff --git a/sb3_contrib/ppo_mask/ppo_mask.py b/sb3_contrib/ppo_mask/ppo_mask.py index b97213b..ca23a22 100644 --- a/sb3_contrib/ppo_mask/ppo_mask.py +++ b/sb3_contrib/ppo_mask/ppo_mask.py @@ -1,7 +1,7 @@ import sys import time from collections import deque -from typing import Any, Dict, Optional, Tuple, Type, TypeVar, Union +from typing import Any, ClassVar, Dict, Optional, Tuple, Type, TypeVar, Union import numpy as np import torch as th @@ -69,7 +69,7 @@ class MaskablePPO(OnPolicyAlgorithm): :param _init_setup_model: Whether or not to build the network at the creation of the instance """ - policy_aliases: Dict[str, Type[BasePolicy]] = { + policy_aliases: ClassVar[Dict[str, Type[BasePolicy]]] = { "MlpPolicy": MlpPolicy, "CnnPolicy": CnnPolicy, "MultiInputPolicy": MultiInputPolicy, diff --git a/sb3_contrib/ppo_recurrent/ppo_recurrent.py b/sb3_contrib/ppo_recurrent/ppo_recurrent.py index c8b0a62..acd44c9 100644 --- a/sb3_contrib/ppo_recurrent/ppo_recurrent.py +++ b/sb3_contrib/ppo_recurrent/ppo_recurrent.py @@ -1,7 +1,7 @@ import sys import time from copy import deepcopy -from typing import Any, Dict, Optional, Type, TypeVar, Union +from typing import Any, ClassVar, Dict, Optional, Type, TypeVar, Union import numpy as np import torch as th @@ -67,7 +67,7 @@ class RecurrentPPO(OnPolicyAlgorithm): :param _init_setup_model: Whether or not to build the network at the creation of the instance """ - policy_aliases: Dict[str, Type[BasePolicy]] = { + policy_aliases: ClassVar[Dict[str, Type[BasePolicy]]] = { "MlpLstmPolicy": MlpLstmPolicy, "CnnLstmPolicy": CnnLstmPolicy, "MultiInputLstmPolicy": MultiInputLstmPolicy, diff --git a/sb3_contrib/qrdqn/qrdqn.py b/sb3_contrib/qrdqn/qrdqn.py index a2a4341..97177be 100644 --- a/sb3_contrib/qrdqn/qrdqn.py +++ b/sb3_contrib/qrdqn/qrdqn.py @@ -1,5 +1,5 @@ import warnings -from typing import Any, Dict, List, Optional, Tuple, Type, TypeVar, Union +from typing import Any, ClassVar, Dict, List, Optional, Tuple, Type, TypeVar, Union import numpy as np import torch as th @@ -60,7 +60,7 @@ class QRDQN(OffPolicyAlgorithm): :param _init_setup_model: Whether or not to build the network at the creation of the instance """ - policy_aliases: Dict[str, Type[BasePolicy]] = { + policy_aliases: ClassVar[Dict[str, Type[BasePolicy]]] = { "MlpPolicy": MlpPolicy, "CnnPolicy": CnnPolicy, "MultiInputPolicy": MultiInputPolicy, diff --git a/sb3_contrib/tqc/tqc.py b/sb3_contrib/tqc/tqc.py index 21c7b74..f5e4ec6 100644 --- a/sb3_contrib/tqc/tqc.py +++ b/sb3_contrib/tqc/tqc.py @@ -1,4 +1,4 @@ -from typing import Any, Callable, Dict, List, Optional, Tuple, Type, TypeVar, Union +from typing import Any, Callable, ClassVar, Dict, List, Optional, Tuple, Type, TypeVar, Union import numpy as np import torch as th @@ -68,7 +68,7 @@ class TQC(OffPolicyAlgorithm): :param _init_setup_model: Whether or not to build the network at the creation of the instance """ - policy_aliases: Dict[str, Type[BasePolicy]] = { + policy_aliases: ClassVar[Dict[str, Type[BasePolicy]]] = { "MlpPolicy": MlpPolicy, "CnnPolicy": CnnPolicy, "MultiInputPolicy": MultiInputPolicy, diff --git a/sb3_contrib/trpo/trpo.py b/sb3_contrib/trpo/trpo.py index e885da5..fd59f04 100644 --- a/sb3_contrib/trpo/trpo.py +++ b/sb3_contrib/trpo/trpo.py @@ -1,7 +1,7 @@ import copy import warnings from functools import partial -from typing import Any, Dict, List, Optional, Tuple, Type, TypeVar, Union +from typing import Any, ClassVar, Dict, List, Optional, Tuple, Type, TypeVar, Union import numpy as np import torch as th @@ -69,7 +69,7 @@ class TRPO(OnPolicyAlgorithm): :param _init_setup_model: Whether or not to build the network at the creation of the instance """ - policy_aliases: Dict[str, Type[BasePolicy]] = { + policy_aliases: ClassVar[Dict[str, Type[BasePolicy]]] = { "MlpPolicy": MlpPolicy, "CnnPolicy": CnnPolicy, "MultiInputPolicy": MultiInputPolicy, diff --git a/sb3_contrib/version.txt b/sb3_contrib/version.txt index 2e4adf3..227cea2 100644 --- a/sb3_contrib/version.txt +++ b/sb3_contrib/version.txt @@ -1 +1 @@ -2.0.0a13 +2.0.0 diff --git a/setup.py b/setup.py index a02bed2..58aaae5 100644 --- a/setup.py +++ b/setup.py @@ -65,7 +65,7 @@ setup( packages=[package for package in find_packages() if package.startswith("sb3_contrib")], package_data={"sb3_contrib": ["py.typed", "version.txt"]}, install_requires=[ - "stable_baselines3>=2.0.0a13", + "stable_baselines3>=2.0.0", ], description="Contrib package of Stable Baselines3, experimental code.", author="Antonin Raffin", @@ -82,8 +82,10 @@ setup( project_urls={ "Code": "https://github.com/Stable-Baselines-Team/stable-baselines3-contrib", "Documentation": "https://sb3-contrib.readthedocs.io/", + "Changelog": "https://stable-baselines3.readthedocs.io/en/master/misc/changelog.html", "Stable-Baselines3": "https://github.com/DLR-RM/stable-baselines3", "RL-Zoo": "https://github.com/DLR-RM/rl-baselines3-zoo", + "SBX": "https://github.com/araffin/sbx", }, classifiers=[ "Programming Language :: Python :: 3",