Skip to content

Commit

Permalink
Add documentation, switch to pyproject.toml and ruff (#365)
Browse files Browse the repository at this point in the history
* Switch to pyproject.toml and ruff

* Add basic doc

* Move README to documentation

* Simplify README

* Add modules

* Relax dependency and remove old logo

* Download Atari ROMS

* Upgrade SB3

* Add RTD env file

* Fix RTD conda env

* Fix Atari Roms download
  • Loading branch information
araffin authored Mar 12, 2023
1 parent d38ef18 commit 10de3a8
Show file tree
Hide file tree
Showing 45 changed files with 1,535 additions and 425 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ body:
required: true
- label: I have read the [SB3 documentation](https://stable-baselines3.readthedocs.io/en/master/)
required: true
- label: I have read the [RL Zoo README](https://github.com/DLR-RM/rl-baselines3-zoo/blob/master/README.md)
- label: I have read the [RL Zoo documentation](https://rl-baselines3-zoo.readthedocs.io)
required: true
- label: I have provided a minimal working example to reproduce the bug
required: true
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/question.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ body:
required: true
- label: I have read the [SB3 documentation](https://stable-baselines3.readthedocs.io/en/master/)
required: true
- label: I have read the [RL Zoo README](https://github.com/DLR-RM/rl-baselines3-zoo/blob/master/README.md)
- label: I have read the [RL Zoo documentation](https://rl-baselines3-zoo.readthedocs.io)
required: true
- label: If code there is, it is minimal and working
required: true
Expand Down
22 changes: 16 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
# Install Atari Roms
pip install autorom
wget https://gist.githubusercontent.com/jjshoots/61b22aefce4456920ba99f2c36906eda/raw/00046ac3403768bfe45857610a3d333b8e35e026/Roms.tar.gz.b64
base64 Roms.tar.gz.b64 --decode &> Roms.tar.gz
AutoROM --accept-license --source-file Roms.tar.gz
pip install setuptools==65.5.0
# cpu version of pytorch - faster to download
pip install torch==1.11+cpu -f https://download.pytorch.org/whl/torch_stable.html
Expand All @@ -41,17 +48,20 @@ jobs:
# install parking-env to test HER (pinned so it works with gym 0.21)
pip install highway-env==1.5.0
pip install -e .
- name: Type check
- name: Lint with ruff
run: |
make type
# skip mypy type check for python3.7 (last forever for some reason)
if: "!(matrix.python-version == '3.7')"
make lint
- name: Check codestyle
run: |
make check-codestyle
- name: Lint with flake8
- name: Build doc
run: |
make lint
make doc
- name: Type check
run: |
make type
# skip mypy type check for python3.7 (last forever for some reason)
if: "!(matrix.python-version == '3.7')"
- name: Test with pytest
run: |
make pytest
9 changes: 9 additions & 0 deletions .github/workflows/trained_agents.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
env:
TERM: xterm-256color
FORCE_COLOR: 1

# Skip CI if [ci skip] in the commit message
if: "! contains(toJSON(github.event.commits.*.message), '[ci skip]')"
runs-on: ubuntu-latest
Expand All @@ -31,6 +32,14 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
# Install Atari Roms
pip install autorom
wget https://gist.githubusercontent.com/jjshoots/61b22aefce4456920ba99f2c36906eda/raw/00046ac3403768bfe45857610a3d333b8e35e026/Roms.tar.gz.b64
base64 Roms.tar.gz.b64 --decode &> Roms.tar.gz
AutoROM --accept-license --source-file Roms.tar.gz
pip install setuptools==65.5.0
# cpu version of pytorch - faster to download
pip install torch==1.11+cpu -f https://download.pytorch.org/whl/torch_stable.html
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ runs
hub
*.mp4
*.json
_build/


# Setuptools distribution and build folders.
/dist/
Expand Down
16 changes: 16 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py

# Optionally build your docs in additional formats such as PDF and ePub
formats: all

# Set requirements using conda env
conda:
environment: docs/conda_env.yml
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
## Release 1.8.0a2 (WIP)
## Release 1.8.0a9 (WIP)

### Breaking Changes
- Upgraded to SB3 >= 1.8.0

### New Features
- Tuned hyperparameters for RecurrentPPO on Swimmer
- Documentation is now built using Sphinx and hosted on read the doc

### Bug fixes
- Set ``highway-env`` version to 1.5 and ``setuptools to`` v65.5 for the CI
Expand All @@ -18,6 +19,7 @@
- Added support for `ruff` (fast alternative to flake8) in the Makefile
- Removed Gitlab CI file
- Replaced deprecated `optuna.suggest_loguniform(...)` by `optuna.suggest_float(..., log=True)`
- Switched to `ruff` and `pyproject.toml`

## Release 1.7.0 (2023-01-10)

Expand Down
26 changes: 14 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,32 +18,34 @@ type: pytype mypy

lint:
# stop the build if there are Python syntax errors or undefined names
# see https://lintlyci.github.io/Flake8Rules/
flake8 ${LINT_PATHS} --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings.
flake8 ${LINT_PATHS} --count --exit-zero --statistics

ruff:
# stop the build if there are Python syntax errors or undefined names
# see https://lintlyci.github.io/Flake8Rules/
# see https://www.flake8rules.com/
ruff ${LINT_PATHS} --select=E9,F63,F7,F82 --show-source
# exit-zero treats all errors as warnings.
ruff ${LINT_PATHS} --exit-zero --line-length 127
ruff ${LINT_PATHS} --exit-zero

format:
# Sort imports
isort ${LINT_PATHS}
# Reformat using black
black -l 127 ${LINT_PATHS}
black ${LINT_PATHS}

check-codestyle:
# Sort imports
isort --check ${LINT_PATHS}
# Reformat using black
black --check -l 127 ${LINT_PATHS}
black --check ${LINT_PATHS}

commit-checks: format type lint

doc:
cd docs && make html

spelling:
cd docs && make spelling

clean:
cd docs && make clean

docker: docker-cpu docker-gpu

docker-cpu:
Expand All @@ -66,4 +68,4 @@ test-release:
python setup.py bdist_wheel
twine upload --repository-url https://test.pypi.org/legacy/ dist/*

.PHONY: lint format check-codestyle commit-checks doc spelling docker type pytest
.PHONY: lint format check-codestyle commit-checks doc spelling docker type pytest
Loading

0 comments on commit 10de3a8

Please sign in to comment.