mirror of
https://github.com/saymrwulf/stable-baselines3.git
synced 2026-05-26 22:45:15 +00:00
Drop python 3.7, add 3.11 and update github templates (#1587)
* Add missing word in patch error message * Add changelog * Drop python 3.7, add 3.11 and update github templates * [ci skip] Update version in doc * Update minimum PyTorch version * Update conda env and fix mypy --------- Co-authored-by: Lukas Hass <lukas@slucky.de>
This commit is contained in:
parent
472ff8edb8
commit
d68ff2e17f
15 changed files with 64 additions and 36 deletions
2
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
2
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
|
|
@ -67,7 +67,7 @@ body:
|
|||
required: true
|
||||
- label: I have read the [documentation](https://stable-baselines3.readthedocs.io/en/master/)
|
||||
required: true
|
||||
- label: I have provided a minimal working example to reproduce the bug
|
||||
- label: I have provided a [minimal and working](https://github.com/DLR-RM/stable-baselines3/issues/982#issuecomment-1197044014) example to reproduce the bug
|
||||
required: true
|
||||
- label: I've used the [markdown code blocks](https://help.github.com/en/articles/creating-and-highlighting-code-blocks) for both code and stack traces.
|
||||
required: true
|
||||
|
|
|
|||
4
.github/ISSUE_TEMPLATE/custom_env.yml
vendored
4
.github/ISSUE_TEMPLATE/custom_env.yml
vendored
|
|
@ -28,7 +28,7 @@ body:
|
|||
attributes:
|
||||
label: Code example
|
||||
description: |
|
||||
Please try to provide a minimal example to reproduce the bug.
|
||||
Please try to provide a [minimal example](https://github.com/DLR-RM/stable-baselines3/issues/982#issuecomment-1197044014) to reproduce the bug.
|
||||
For a custom environment, you need to give at least the observation space, action space, `reset()` and `step()` methods (see working example below).
|
||||
Error messages and stack traces are also helpful.
|
||||
Please use the [markdown code blocks](https://help.github.com/en/articles/creating-and-highlighting-code-blocks) for both code and stack traces.
|
||||
|
|
@ -101,7 +101,7 @@ body:
|
|||
required: true
|
||||
- label: I have read the [documentation](https://stable-baselines3.readthedocs.io/en/master/)
|
||||
required: true
|
||||
- label: I have provided a minimal working example to reproduce the bug
|
||||
- label: I have provided a [minimal and working](https://github.com/DLR-RM/stable-baselines3/issues/982#issuecomment-1197044014) example to reproduce the bug
|
||||
required: true
|
||||
- label: I have checked my env using the env checker
|
||||
required: true
|
||||
|
|
|
|||
2
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
2
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
|
|
@ -42,3 +42,5 @@ body:
|
|||
options:
|
||||
- label: I have checked that there is no similar [issue](https://github.com/DLR-RM/stable-baselines3/issues) in the repo
|
||||
required: true
|
||||
- label: If I'm requesting a new feature, I have proposed alternatives
|
||||
required: true
|
||||
|
|
|
|||
2
.github/ISSUE_TEMPLATE/question.yml
vendored
2
.github/ISSUE_TEMPLATE/question.yml
vendored
|
|
@ -26,7 +26,7 @@ body:
|
|||
required: true
|
||||
- label: I have read the [documentation](https://stable-baselines3.readthedocs.io/en/master/)
|
||||
required: true
|
||||
- label: If code there is, it is minimal and working
|
||||
- label: If code there is, it is [minimal and working](https://github.com/DLR-RM/stable-baselines3/issues/982#issuecomment-1197044014)
|
||||
required: true
|
||||
- label: If code there is, it is formatted using the [markdown code blocks](https://help.github.com/en/articles/creating-and-highlighting-code-blocks) for both code and stack traces.
|
||||
required: true
|
||||
|
|
|
|||
8
.github/workflows/ci.yml
vendored
8
.github/workflows/ci.yml
vendored
|
|
@ -20,7 +20,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ["3.7", "3.8", "3.9", "3.10"]
|
||||
python-version: ["3.8", "3.9", "3.10", "3.11"]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
|
@ -32,7 +32,7 @@ jobs:
|
|||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
# cpu version of pytorch
|
||||
pip install torch==1.11+cpu -f https://download.pytorch.org/whl/torch_stable.html
|
||||
pip install torch==1.13+cpu -f https://download.pytorch.org/whl/torch_stable.html
|
||||
|
||||
# Install Atari Roms
|
||||
pip install autorom
|
||||
|
|
@ -55,8 +55,8 @@ jobs:
|
|||
- name: Type check
|
||||
run: |
|
||||
make type
|
||||
# skip mypy type check for python3.7 (result is different to all other versions)
|
||||
if: "!(matrix.python-version == '3.7')"
|
||||
# skip PyType, doesn't support 3.11 yet
|
||||
if: "!(matrix.python-version == '3.11')"
|
||||
- name: Test with pytest
|
||||
run: |
|
||||
make pytest
|
||||
|
|
|
|||
|
|
@ -92,10 +92,10 @@ It provides a minimal number of features compared to SB3 but can be much faster
|
|||
|
||||
## Installation
|
||||
|
||||
**Note:** Stable-Baselines3 supports PyTorch >= 1.11
|
||||
**Note:** Stable-Baselines3 supports PyTorch >= 1.13
|
||||
|
||||
### Prerequisites
|
||||
Stable Baselines3 requires Python 3.7+.
|
||||
Stable Baselines3 requires Python 3.8+.
|
||||
|
||||
#### Windows 10
|
||||
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ channels:
|
|||
dependencies:
|
||||
- cpuonly=1.0=0
|
||||
- pip=22.3.1
|
||||
- python=3.7
|
||||
- pytorch=1.11.0=py3.7_cpu_0
|
||||
- python=3.8
|
||||
- pytorch=1.13.0=py3.8_cpu_0
|
||||
- pip:
|
||||
- gymnasium
|
||||
- cloudpickle
|
||||
|
|
@ -15,6 +15,6 @@ dependencies:
|
|||
- numpy
|
||||
- matplotlib
|
||||
- sphinx_autodoc_typehints
|
||||
- sphinx>=4.2
|
||||
- sphinx>=5.3,<7.0
|
||||
- sphinx_rtd_theme>=1.0
|
||||
- sphinx_copybutton
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ Installation
|
|||
Prerequisites
|
||||
-------------
|
||||
|
||||
Stable-Baselines3 requires python 3.7+ and PyTorch >= 1.11
|
||||
Stable-Baselines3 requires python 3.8+ and PyTorch >= 1.13
|
||||
|
||||
Windows 10
|
||||
~~~~~~~~~~
|
||||
|
|
|
|||
|
|
@ -3,6 +3,40 @@
|
|||
Changelog
|
||||
==========
|
||||
|
||||
|
||||
Release 2.1.0a0 (WIP)
|
||||
--------------------------
|
||||
|
||||
Breaking Changes:
|
||||
^^^^^^^^^^^^^^^^^
|
||||
- Removed Python 3.7 support
|
||||
- SB3 now requires PyTorch >= 1.13
|
||||
|
||||
New Features:
|
||||
^^^^^^^^^^^^^
|
||||
- Added Python 3.11 support
|
||||
|
||||
`SB3-Contrib`_
|
||||
^^^^^^^^^^^^^^
|
||||
|
||||
`RL Zoo`_
|
||||
^^^^^^^^^
|
||||
|
||||
Bug Fixes:
|
||||
^^^^^^^^^^
|
||||
|
||||
Deprecations:
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
Others:
|
||||
^^^^^^^
|
||||
- Updated GitHub issue templates
|
||||
- Fix typo in gym patch error message (@lukashass)
|
||||
|
||||
Documentation:
|
||||
^^^^^^^^^^^^^^
|
||||
|
||||
|
||||
Release 2.0.0 (2023-06-22)
|
||||
--------------------------
|
||||
|
||||
|
|
@ -1361,4 +1395,4 @@ And all the contributors:
|
|||
@Melanol @qgallouedec @francescoluciano @jlp-ue @burakdmb @timothe-chaumont @honglu2875
|
||||
@anand-bala @hughperkins @sidney-tio @AlexPasqua @dominicgkerr @Akhilez @Rocamonde @tobirohrer @ZikangXiong
|
||||
@DavyMorgan @luizapozzobon @Bonifatius94 @theSquaredError @harveybellini @DavyMorgan @FieteO @jonasreiher @npit @WeberSamuel @troiganto
|
||||
@lutogniew @lbergmann1
|
||||
@lutogniew @lbergmann1 @lukashass
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
[tool.ruff]
|
||||
# Same as Black.
|
||||
line-length = 127
|
||||
# Assume Python 3.7
|
||||
target-version = "py37"
|
||||
# Assume Python 3.8
|
||||
target-version = "py38"
|
||||
# See https://beta.ruff.rs/docs/rules/
|
||||
select = ["E", "F", "B", "UP", "C90", "RUF"]
|
||||
# B028: Ignore explicit stacklevel`
|
||||
|
|
|
|||
15
setup.py
15
setup.py
|
|
@ -76,9 +76,7 @@ model = PPO("MlpPolicy", "CartPole-v1").learn(10_000)
|
|||
extra_no_roms = [
|
||||
# For render
|
||||
"opencv-python",
|
||||
'pygame; python_version >= "3.8.0"',
|
||||
# See https://github.com/pygame/pygame/issues/3572
|
||||
'pygame>=2.0,<2.1.3; python_version < "3.8.0"',
|
||||
"pygame",
|
||||
# Tensorboard support
|
||||
"tensorboard>=2.9.1",
|
||||
# Checking memory taken by replay buffer
|
||||
|
|
@ -87,13 +85,13 @@ extra_no_roms = [
|
|||
"tqdm",
|
||||
"rich",
|
||||
# For atari games,
|
||||
"shimmy[atari]~=0.2.1",
|
||||
"shimmy[atari]~=1.1.0",
|
||||
"pillow",
|
||||
]
|
||||
|
||||
extra_packages = extra_no_roms + [ # noqa: RUF005
|
||||
# For atari roms,
|
||||
"autorom[accept-rom-license]~=0.6.0",
|
||||
"autorom[accept-rom-license]~=0.6.1",
|
||||
]
|
||||
|
||||
|
||||
|
|
@ -104,8 +102,7 @@ setup(
|
|||
install_requires=[
|
||||
"gymnasium==0.28.1",
|
||||
"numpy>=1.20",
|
||||
"torch>=1.11",
|
||||
'typing_extensions>=4.0,<5; python_version < "3.8.0"',
|
||||
"torch>=1.13",
|
||||
# For saving models
|
||||
"cloudpickle",
|
||||
# For reading logs
|
||||
|
|
@ -154,7 +151,7 @@ setup(
|
|||
long_description=long_description,
|
||||
long_description_content_type="text/markdown",
|
||||
version=__version__,
|
||||
python_requires=">=3.7",
|
||||
python_requires=">=3.8",
|
||||
# PyPI package information.
|
||||
project_urls={
|
||||
"Code": "https://github.com/DLR-RM/stable-baselines3",
|
||||
|
|
@ -166,10 +163,10 @@ setup(
|
|||
},
|
||||
classifiers=[
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3.7",
|
||||
"Programming Language :: Python :: 3.8",
|
||||
"Programming Language :: Python :: 3.9",
|
||||
"Programming Language :: Python :: 3.10",
|
||||
"Programming Language :: Python :: 3.11",
|
||||
],
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ try:
|
|||
|
||||
cv2.ocl.setUseOpenCL(False)
|
||||
except ImportError:
|
||||
cv2 = None
|
||||
cv2 = None # type: ignore[assignment]
|
||||
|
||||
|
||||
class StickyActionEnv(gym.Wrapper[np.ndarray, int, np.ndarray, int]):
|
||||
|
|
@ -241,6 +241,7 @@ class WarpFrame(gym.ObservationWrapper[np.ndarray, int, np.ndarray]):
|
|||
:param frame: environment frame
|
||||
:return: the observation
|
||||
"""
|
||||
assert cv2 is not None, "OpenCV is not installed, you can do `pip install opencv-python`"
|
||||
frame = cv2.cvtColor(frame, cv2.COLOR_RGB2GRAY)
|
||||
frame = cv2.resize(frame, (self.width, self.height), interpolation=cv2.INTER_AREA)
|
||||
return frame[:, :, None]
|
||||
|
|
|
|||
|
|
@ -1,18 +1,12 @@
|
|||
"""Common aliases for type hints"""
|
||||
|
||||
import sys
|
||||
from enum import Enum
|
||||
from typing import Any, Callable, Dict, List, NamedTuple, Optional, SupportsFloat, Tuple, Union
|
||||
from typing import Any, Callable, Dict, List, NamedTuple, Optional, Protocol, SupportsFloat, Tuple, Union
|
||||
|
||||
import gymnasium as gym
|
||||
import numpy as np
|
||||
import torch as th
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
from typing import Protocol
|
||||
else:
|
||||
from typing_extensions import Protocol
|
||||
|
||||
from stable_baselines3.common import callbacks, vec_env
|
||||
|
||||
GymEnv = Union[gym.Env, vec_env.VecEnv]
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ def _patch_env(env: Union["gym.Env", gymnasium.Env]) -> gymnasium.Env: # pragma
|
|||
import shimmy # pytype: disable=import-error
|
||||
except ImportError as e:
|
||||
raise ImportError(
|
||||
"Missing shimmy installation. You an OpenAI Gym environment. "
|
||||
"Missing shimmy installation. You provided an OpenAI Gym environment. "
|
||||
"Stable-Baselines3 (SB3) has transitioned to using Gymnasium internally. "
|
||||
"In order to use OpenAI Gym environments with SB3, you need to "
|
||||
"install shimmy (`pip install 'shimmy>=0.2.1'`)."
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
2.0.0
|
||||
2.1.0a0
|
||||
|
|
|
|||
Loading…
Reference in a new issue