Skip to content

Commit

Permalink
Update CI, pre-commit and website (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
pseudo-rnd-thoughts authored Jan 11, 2025
1 parent 24ed0a2 commit 6501cd1
Show file tree
Hide file tree
Showing 34 changed files with 165 additions and 120 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ Add any other context about the problem here.

### Checklist

- [ ] I have checked that there is no similar [issue](https://github.com/Farama-Foundation/gym-miniworld/issues) in the repo (**required**)
- [ ] I have checked that there is no similar [issue](https://github.com/Farama-Foundation/miniworld/issues) in the repo (**required**)
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/proposal.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ title: "[Proposal] Proposal title"



### Proposal
### Proposal

A clear and concise description of the proposal.

Expand All @@ -30,4 +30,4 @@ Add any other context or screenshots about the feature request here.

### Checklist

- [ ] I have checked that there is no similar [issue](https://github.com/Farama-Foundation/gym-miniworld/issues) in the repo (**required**)
- [ ] I have checked that there is no similar [issue](https://github.com/Farama-Foundation/miniworld/issues) in the repo (**required**)
10 changes: 5 additions & 5 deletions .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ title: "[Question] Question title"

### Question

If you're a beginner and have basic questions, please ask on
[r/reinforcementlearning](https://www.reddit.com/r/reinforcementlearning/)
or in the [RL Discord](https://discord.com/invite/xhfNqQv)
(if you're new please use the beginners channel).
Basic questions that are not bugs or feature requests will be closed without reply,
If you're a beginner and have basic questions, please ask on
[r/reinforcementlearning](https://www.reddit.com/r/reinforcementlearning/)
or in the [RL Discord](https://discord.com/invite/xhfNqQv)
(if you're new please use the beginners channel).
Basic questions that are not bugs or feature requests will be closed without reply,
because GitHub issues are not an appropriate venue for these.

Advanced/nontrivial questions, especially in areas where documentation is lacking, are very much welcome.
14 changes: 14 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
# Enable version updates for GitHub Actions
- package-ecosystem: "github-actions"
# Look for GitHub Actions workflows in the `root` directory
directory: "/"
# Check the for updates once a week
schedule:
interval: "weekly"
File renamed without changes.
20 changes: 20 additions & 0 deletions .github/docker/testing-old.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# A Dockerfile that sets up a full Gym install with test dependencies
ARG PYTHON_VERSION
FROM python:$PYTHON_VERSION

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

RUN apt-get -y update
RUN apt-get install -y freeglut3-dev xvfb

COPY ../.. /usr/local/miniworld/
WORKDIR /usr/local/miniworld/

RUN pip install .[testing] gymnasium==0.29.1 numpy==1.26.4

RUN ["chmod", "+x", "/usr/local/miniworld/.github/docker/docker_entrypoint"]

ENTRYPOINT ["/usr/local/miniworld/.github/docker/docker_entrypoint"]

#RUN cd pytorch-a2c-ppo-acktr
#RUN xvfb-run -a -s "-screen 0 1024x768x24 -ac +extension GLX +render -noreset" time python3 main.py --no-cuda --algo a2c --log-interval 1 --num-frames 200 --num-processes 1 --num-steps 80 --lr 0.00005 --env-name MiniWorld-Hallway-v0
6 changes: 3 additions & 3 deletions py.Dockerfile → .github/docker/testing.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN apt-get -y update
RUN apt-get install -y freeglut3-dev xvfb

COPY . /usr/local/miniworld/
COPY ../.. /usr/local/miniworld/
WORKDIR /usr/local/miniworld/

RUN pip install .[testing] --no-cache-dir

RUN ["chmod", "+x", "/usr/local/miniworld/bin/docker_entrypoint"]
RUN ["chmod", "+x", "/usr/local/miniworld/.github/docker/docker_entrypoint"]

ENTRYPOINT ["/usr/local/miniworld/bin/docker_entrypoint"]
ENTRYPOINT ["/usr/local/miniworld/.github/docker/docker_entrypoint"]

#RUN cd pytorch-a2c-ppo-acktr
#RUN xvfb-run -a -s "-screen 0 1024x768x24 -ac +extension GLX +render -noreset" time python3 main.py --no-cuda --algo a2c --log-interval 1 --num-frames 200 --num-processes 1 --num-steps 80 --lr 0.00005 --env-name MiniWorld-Hallway-v0
2 changes: 1 addition & 1 deletion .github/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ only: issues

# issues:
# exemptLabels:
# - confirmed
# - confirmed
4 changes: 2 additions & 2 deletions .github/workflows/build-docs-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

- uses: actions/setup-python@v4
with:
python-version: '3.9'
python-version: '3.11'

- name: Install freeglut
run: sudo apt-get install -y freeglut3-dev xvfb
Expand Down Expand Up @@ -49,4 +49,4 @@ jobs:
with:
folder: _build
target-folder: main
clean: false
clean: false
4 changes: 2 additions & 2 deletions .github/workflows/build-docs-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

- uses: actions/setup-python@v4
with:
python-version: '3.9'
python-version: '3.11'

- name: Get tag
id: tag
Expand Down Expand Up @@ -62,4 +62,4 @@ jobs:
folder: _build
clean-exclude: |
*.*.*/
main
main
15 changes: 3 additions & 12 deletions .github/workflows/build-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,11 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
python-version: '3.11'
- name: Install pypa/build
run: >-
python -m
pip install -U
build
run: python -m pip install -U build
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
run: python -m build --sdist --wheel --outdir dist/ .
- name: Store wheels
uses: actions/upload-artifact@v3
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/manual-build-docs-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:

- uses: actions/setup-python@v4
with:
python-version: '3.9'
python-version: '3.11'

- name: Install freeglut
run: sudo apt-get install -y freeglut3-dev xvfb
Expand Down Expand Up @@ -74,4 +74,4 @@ jobs:
folder: _build
clean-exclude: |
*.*.*/
main
main
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ jobs:
- run: pip install pre-commit
- run: pre-commit --version
- run: pre-commit install
- run: pre-commit run --all-files
- run: pre-commit run --all-files
21 changes: 16 additions & 5 deletions .github/workflows/build.yml → .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,35 @@ name: build
on: [pull_request, push]

jobs:
build:
build-latest:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v2
- run: |
docker build -f py.Dockerfile \
docker build -f .github/docker/testing.Dockerfile \
--build-arg PYTHON_VERSION=${{ matrix.python-version }} \
--tag gym-miniworld-docker .
--tag miniworld-docker .
- name: Run tests
run: docker run gym-miniworld-docker pytest
run: docker run miniworld-docker pytest

build-old:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
docker build -f .github/docker/testing-old.Dockerfile \
--build-arg PYTHON_VERSION='3.11' \
--tag miniworld-docker .
- name: Run tests
run: docker run miniworld-docker pytest

# Old Travis testing

# Test the simulator
# xvfb-run -a -s "-screen 0 1024x768x24 -ac +extension GLX +render -noreset" ./run_tests.py
#
# Test RL code quickly
# cd pytorch-a2c-ppo-acktr && xvfb-run -a -s "-screen 0 1024x768x24 -ac +extension GLX +render -noreset" time python3 main.py --no-cuda --algo a2c --log-interval 1 --num-frames 200 --num-processes 1 --num-steps 80 --lr 0.00005 --env-name MiniWorld-Hallway-v0
# cd pytorch-a2c-ppo-acktr && xvfb-run -a -s "-screen 0 1024x768x24 -ac +extension GLX +render -noreset" time python3 main.py --no-cuda --algo a2c --log-interval 1 --num-frames 200 --num-processes 1 --num-steps 80 --lr 0.00005 --env-name MiniWorld-Hallway-v0
28 changes: 22 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,34 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-symlinks
- id: destroyed-symlinks
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-toml
- id: check-ast
- id: check-added-large-files
- id: check-merge-conflict
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable
- id: detect-private-key
- id: debug-statements
- repo: https://github.com/python/black
rev: 23.3.0
rev: 24.10.0
hooks:
- id: black
- repo: https://github.com/codespell-project/codespell
rev: v2.2.4
rev: v2.3.0
hooks:
- id: codespell
args:
- --skip=*.svg
# - --ignore-words-list=
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
rev: 7.1.1
hooks:
- id: flake8
args:
Expand All @@ -23,7 +39,7 @@ repos:
- --show-source
- --statistics
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
args: ["--profile", "black"]
Expand All @@ -37,10 +53,10 @@ repos:
# - --convention=google
# additional_dependencies: ["toml"]
- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
rev: v3.19.1
hooks:
- id: pyupgrade
args: ["--py37-plus"]
args: ["--py38-plus"]
# - repo: local
# hooks:
# - id: pyright
Expand Down
2 changes: 0 additions & 2 deletions CODE_OF_CONDUCT.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,3 @@ Attribution
-----------
This Code of Conduct is adapted from `Python's Code of Conduct <https://www.python.org/psf/conduct/>`_, which is under a `Creative Commons License
<https://creativecommons.org/licenses/by-sa/3.0/>`_.


6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ Contents:
- [Introduction](#introduction)
- [Installation](#installation)
- [Usage](#usage)
- [Environments](docs/environments.md)
- [Design and Customization](docs/content/design.md)
- [Troubleshooting](docs/content/troubleshooting.md)
- [Environments](https://miniworld.farama.org/content/env_list/)
- [Design and Customization](https://miniworld.farama.org/content/design/)
- [Troubleshooting](https://miniworld.farama.org/content/troubleshooting/)

## Introduction

Expand Down
2 changes: 1 addition & 1 deletion docs/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
environments/**/*.md
content/env_list.html
content/env_list.html
2 changes: 1 addition & 1 deletion docs/404.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# 404 - Page Not Found

## The requested page could not be found.
## The requested page could not be found.
5 changes: 3 additions & 2 deletions docs/_scripts/gen_env_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

import gymnasium as gym

import miniworld # noqa: F401
import miniworld

gym.register_envs(miniworld)


# From python docs
Expand Down Expand Up @@ -75,7 +77,6 @@ def trim(docstring):
|---|---|
| Action Space | `{re.sub(' +', ' ', action_space_table)}` |
| Observation Space | `{re.sub(' +', ' ', observation_space_table)}` |
| Reward Range | `{env.reward_range}` |
| Creation | `gymnasium.make("{env_spec.id}")` |
"""
res_env_md += f"{env_attributes}\n"
Expand Down
8 changes: 5 additions & 3 deletions docs/_scripts/gen_envs_display.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@

import gymnasium as gym

import miniworld # noqa: F401
import miniworld

gym.register_envs(miniworld)


def create_grid_cell(env_id):
env_name = env_id.split("-")[-2]
return f"""
<a href="/environments/{env_name.lower()}">
<a href="../environments/{env_name.lower()}.html">
<div class="env-grid__cell">
<div class="cell__image-container">
<img src="/_static/environments/{env_name.lower()}.jpg">
<img src="../_static/environments/{env_name.lower()}.jpg">
</div>
<div class="cell__title">
<span>{env_name}</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/_static/img/miniworld-text.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/_static/img/miniworld-white.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/_static/img/miniworld.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/content/create_env.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ which places the goal in the middle. Now the environment should look like this:
:width: 500px
```

### Add reward
### Add reward

To add a reward when the agent gets close to the box, we can do the following:

Expand Down
5 changes: 0 additions & 5 deletions docs/content/env_list.md

This file was deleted.

Loading

0 comments on commit 6501cd1

Please sign in to comment.