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 CI to follow gymnasium's implementation #418

Merged
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
22 changes: 22 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: build
on: [pull_request, push]

permissions:
contents: read # to fetch code (actions/checkout)

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
steps:
- uses: actions/checkout@v3
- run: |
docker build -f docker/Dockerfile \
--build-arg PYTHON_VERSION=${{ matrix.python-version }} \
--tag metaworld-docker .
- name: Run tests
run: docker run metaworld-docker pytest tests/*
# - name: Run doctests
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this do exactly? Should we have doc tests for other projects?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did some googling looks useful, though i don’t think many other farama projects do that style of docs with code examples

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a copy from Gymnasium where we run this.
I recommend it for having docstrings that are correct and will raise an error if the code changes etc

# run: docker run metaworld-docker pytest --doctest-modules metaworld/
39 changes: 0 additions & 39 deletions .github/workflows/metaworld-ci.yml

This file was deleted.

13 changes: 6 additions & 7 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
# https://pre-commit.com
# This GitHub Action assumes that the repo contains a valid .pre-commit-config.yaml file.
---
name: pre-commit
on:
pull_request:
push:
branches: [master]

permissions:
contents: read
contents: read # to fetch code (actions/checkout)

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- run: pip install pre-commit
- run: pre-commit --version
- run: pre-commit install
- run: pre-commit run --all-files
- uses: actions/setup-python@v4
- run: python -m pip install pre-commit
- run: python -m pre_commit --version
- run: python -m pre_commit install
- run: python -m pre_commit run --all-files
74 changes: 41 additions & 33 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,52 +1,60 @@
---
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/python/black
rev: 23.3.0
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: black
- 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/codespell-project/codespell
rev: v2.2.4
hooks:
- id: codespell
args:
- --skip=*.css,*.js,*.map,*.scss,*.svg,*.ipynb
- --ignore-words-list=magent
exclude: metaworld/envs/assets_updated/sawyer_xyz/dm_control_pick_place.ipynb
# args:
# - --ignore-words-list==
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
- id: flake8
args:
- '--per-file-ignores=*/__init__.py:F401'
- --extend-ignore=E203,W605,F841,E731,E741,F401 # TODO: fix some of these
- --max-complexity=205
- --max-line-length=300
- --ignore=E203,W503,E741
- --max-complexity=30
- --max-line-length=456
- --show-source
- --statistics
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
args: ["--profile", "black"]
- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
rev: v3.3.2
hooks:
- id: pyupgrade
args: ["--py37-plus"]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
args: ["--py38-plus"]
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: mixed-line-ending
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this not used in gymnasium? Seems useful, have had issues with line endings before. Also I feel like we should use the same pre commit config across farama projects similar to farama notifications and the furo documentation stuff. Might go and add these things to pettingzoo. For consistency’s sake.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that this is done in the end-of-file-fixer within pre-commit-hooks

args: ["--fix=lf"]
- repo: https://github.com/pycqa/pydocstyle
rev: 6.3.0
- id: isort
- repo: https://github.com/python/black
rev: 23.3.0
hooks:
- id: pydocstyle
args:
- --source
- --explain
- --convention=google
- --count
# TODO: Remove ignoring rules D101, D102, D103, D105
- --add-ignore=D100,D107,D101,D102,D103,D105
exclude: "__init__.py$|^metaworld.tests|^docs"
additional_dependencies: ["tomli"]
- id: black
# - repo: https://github.com/pycqa/pydocstyle
# rev: 6.3.0
# hooks:
# - id: pydocstyle
# exclude: ^
# args:
# - --source
# - --explain
# - --convention=google
# additional_dependencies: ["tomli"]
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ We particularly welcome contributions of additional tasks that thematically fit
### Checklist for adding new tasks

Ensure that your task and pull request:
* [ ] Can be performed by a real robot arm
* [ ] Can be performed by a real robot arm
* [ ] Is dissimilar from current tasks
* [ ] Contains meaningful internal variation (e.g. different object positions, etc.)
* [ ] Conforms to the action space, observation space, and reward functions conventions used by metaworld environments
* [ ] Uses existing assets if they exist, and that any new assets added are high-quality
* [ ] Follows the code qualtiy, style, testing, and documentation guidelines outlined below
* [ ] Follows the code quality, style, testing, and documentation guidelines outlined below
* [ ] Provides learning curves which show the task can by solved by PPO and SAC, using the implementations linked below

PPO: https://github.com/rlworkgroup/garage/blob/master/src/garage/tf/algos/ppo.py
Expand All @@ -35,7 +35,7 @@ These criteria may be satisfied in any order, but in practice your PR is unlikel
## Preparing your repo to make contributions
First, install the Metaworld locally in editable mode, with testing dependencies:

```
```
pip install -e .[dev]
```

Expand Down Expand Up @@ -68,7 +68,7 @@ These are Meta-World specific rules which are not part of the aforementioned sty

* Add convenience imports in `__init__.py` of a package for shallow first-level repetitive imports, but not for subpackages, even if that subpackage is defined in a single `.py` file.

For instance, if an import line reads `from
For instance, if an import line reads `from
.foo.bar import Bar` then you should add `from metaworld.foo.bar import Bar` to `metaworld/foo/__init__.py` so that users may instead write `from metaworld.foo import Bar`. However, if an import line reads `from metaworld.foo.bar.stuff import Baz`, *do not* add `from metaworld.foo.bar.stuff import Baz` to `metaworld/foo/__init__.py`, because that obscures the `stuff` subpackage.

*Do*
Expand Down
69 changes: 0 additions & 69 deletions Makefile

This file was deleted.

8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ cd metaworld
pip install -e .
```

For users attempting to reproduce results found in the Meta-World paper please use this command:
For users attempting to reproduce results found in the Meta-World paper please use this command:
```
pip install git+https://github.com/Farama-Foundation/Metaworld.git@04be337a12305e393c0caf0cbf5ec7755c7c8feb
```
Expand Down Expand Up @@ -174,7 +174,7 @@ env2.reset()
a1 = env1.action_space.sample() # Sample an action
a2 = env2.action_space.sample()
next_obs1, _, _, _ = env1.step(a1) # Step the environoment with the sampled random action
next_obs2, _, _, _ = env2.step(a2)
next_obs2, _, _, _ = env2.step(a2)
assert (next_obs1[-3:] == next_obs2[-3:]).all() # 2 envs initialized with the same seed will have the same goal
assert not (next_obs2[-3:] == np.zeros(3)).all() # The env's are goal observable, meaning the goal is not zero'd out

Expand All @@ -184,7 +184,7 @@ env3.reset()
a1 = env1.action_space.sample() # Sample an action
a3 = env3.action_space.sample()
next_obs1, _, _, _ = env1.step(a1) # Step the environoment with the sampled random action
next_obs3, _, _, _ = env3.step(a3)
next_obs3, _, _, _ = env3.step(a3)

assert not (next_obs1[-3:] == next_obs3[-3:]).all() # 2 envs initialized with different seeds will have different goals
assert not (next_obs1[-3:] == np.zeros(3)).all() # The env's are goal observable, meaning the goal is not zero'd out
Expand All @@ -208,7 +208,7 @@ If you use Meta-World for academic research, please kindly cite our CoRL 2019 pa
```

## Accompanying Baselines
If you're looking for implementations of the baselines algorithms used in the Metaworld conference publication, please look at our sister directory, [Garage](https://github.com/rlworkgroup/garage).
If you're looking for implementations of the baselines algorithms used in the Metaworld conference publication, please look at our sister directory, [Garage](https://github.com/rlworkgroup/garage).
Note that these aren't the exact same baselines that were used in the original conference publication, however they are true to the original baselines.

## Become a Contributor
Expand Down
Loading