Merge branch 'master' into better_tests

This commit is contained in:
Dominik Moritz Roth 2023-11-26 18:50:55 +01:00
commit d6f42cf755
10 changed files with 462 additions and 117 deletions

52
.github/workflows/publish-to-pypi.yml vendored Normal file
View File

@ -0,0 +1,52 @@
name: Publish Python package to PyPI
on:
push:
tags:
- '*'
jobs:
publish:
name: Publish to PyPI
runs-on: ubuntu-latest
if: false && startsWith(github.ref, 'refs/tags/') # Only run on tagged commits
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0 # This fetches all history for all branches and tags
- name: Verify tag is on master branch
run: |
TAG_IS_ON_MASTER=$(git branch -r --contains ${{ github.ref }} | grep 'origin/master')
if [ -z "$TAG_IS_ON_MASTER" ]; then
echo "Tag is not on the master branch. Cancelling the workflow."
exit 1
fi
echo "Tag is on the master branch. Proceeding with the workflow."
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install pypa/build/setuptools/twine
run: >-
python3 -m
pip install
build setuptools twine
--user
- name: Prevent fallback onto setup.py
run: rm setup.py
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: twine upload dist/*

View File

@ -0,0 +1,52 @@
name: Publish Python package to TestPyPI
on:
push:
tags:
- '*'
jobs:
publish:
name: Publish to TestPyPI
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/') # Only run on tagged commits
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0 # This fetches all history for all branches and tags
- name: Verify tag is on master branch
run: |
TAG_IS_ON_MASTER=$(git branch -r --contains ${{ github.ref }} | grep 'origin/master')
if [ -z "$TAG_IS_ON_MASTER" ]; then
echo "Tag is not on the master branch. Cancelling the workflow."
exit 1
fi
echo "Tag is on the master branch. Proceeding with the workflow."
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install pypa/build/setuptools/twine
run: >-
python3 -m
pip install
build setuptools twine
--user
- name: Prevent fallback onto setup.py
run: rm setup.py
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Publish to TestPyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }}
run: twine upload --repository-url https://test.pypi.org/legacy/ dist/*

14
MANIFEST.in Normal file
View File

@ -0,0 +1,14 @@
# Include the README
include README.md
# Include the license, Code of Conduct and Contributing guidelines
include LICENSE
include CODE_OF_CONDUCT.md
include CONTRIBUTING.md
# Include stl and xml files from the fancy_gym/envs/mujoco directory
recursive-include fancy_gym/envs/mujoco *.stl
recursive-include fancy_gym/envs/mujoco *.xml
# Also shipping the most important part of fancy gym
include icon.svg

View File

@ -1,12 +1,12 @@
<h1 align="center">
<br>
<img src='./icon.svg' width="250px">
<img src='https://raw.githubusercontent.com/ALRhub/fancy_gym/master/icon.svg' width="250px">
<br><br>
<b>Fancy Gym</b>
<br><br>
</h1>
| :exclamation: Fancy Gym has recently received a major refactor, which also updated many of the used dependencies to current versions. The update has brought some breaking changes. If you want to access the old version, check out the [legacy branch](https://github.com/ALRhub/fancy_gym/tree/legacy). Find out more about what changed [here](https://github.com/ALRhub/fancy_gym/pull/75). |
| &#x2757; Fancy Gym has recently received a major refactor, which also updated many of the used dependencies to current versions. The update has brought some breaking changes. If you want to access the old version, check out the [legacy branch](https://github.com/ALRhub/fancy_gym/tree/legacy). Find out more about what changed [here](https://github.com/ALRhub/fancy_gym/pull/75). |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
Built upon the foundation of [Gymnasium](https://gymnasium.farama.org/) (a maintained fork of OpenAIs renowned Gym library) `fancy_gym` offers a comprehensive collection of reinforcement learning environments.
@ -33,40 +33,72 @@ While the overarching objective of MP environments remains the learning of an op
## Installation
1. Clone the repository
We recommend installing `fancy_gym` into a virtual environment as provided by [venv](https://docs.python.org/3/library/venv.html). 3rd party alternatives to venv like [Poetry](https://python-poetry.org/) or [Conda](https://docs.conda.io/en/latest/) can also be used.
### Installation from PyPI (recommended)
Install `fancy_gym` via
```bash
git clone git@github.com:ALRhub/fancy_gym.git
```
2. Go to the folder
```bash
cd fancy_gym
```
3. Install with
```bash
pip install -e .
pip install fancy_gym
```
We have a few optional dependencies. If you also want to install those use
```bash
pip install -e '.[all]' # to install all optional dependencies
pip install -e '.[dmc,metaworld,box2d,mujoco,mujoco-legacy,jax,testing]' # or choose only those you want
# to install all optional dependencies
pip install 'fancy_gym[all]'
# or choose only those you want
pip install 'fancy_gym[dmc,box2d,mujoco-legacy,jax,testing]'
```
Pip can not automatically install up-to-date versions of metaworld, since they are not avaible on PyPI yet.
Install metaworld via
```bash
pip install metaworld@git+https://github.com/Farama-Foundation/Metaworld.git@d155d0051630bb365ea6a824e02c66c068947439#egg=metaworld
```
### Installation from master
1. Clone the repository
```bash
git clone git@github.com:ALRhub/fancy_gym.git
```
2. Go to the folder
```bash
cd fancy_gym
```
3. Install with
```bash
pip install -e .
```
We have a few optional dependencies. If you also want to install those use
```bash
# to install all optional dependencies
pip install -e '.[all]'
# or choose only those you want
pip install -e '.[dmc,box2d,mujoco-legacy,jax,testing]'
```
Metaworld has to be installed manually with
```bash
pip install metaworld@git+https://github.com/Farama-Foundation/Metaworld.git@d155d0051630bb365ea6a824e02c66c068947439#egg=metaworld
```
## How to use Fancy Gym
We will only show the basics here and prepared [multiple examples](fancy_gym/examples/) for a more detailed look.
We will only show the basics here and prepared [multiple examples](https://github.com/ALRhub/fancy_gym/tree/master/fancy_gym/examples/) for a more detailed look.
### Step-Based Environments
Regular step based environments added by Fancy Gym are added into the `fancy/` namespace.
| :exclamation: Legacy versions of Fancy Gym used `fancy_gym.make(...)`. This is no longer supported and will raise an Exception on new versions. |
| &#x2757; Legacy versions of Fancy Gym used `fancy_gym.make(...)`. This is no longer supported and will raise an Exception on new versions. |
| ----------------------------------------------------------------------------------------------------------------------------------------------- |
```python
@ -165,7 +197,7 @@ print(fancy_gym.MOVEMENT_PRIMITIVE_ENVIRONMENTS_FOR_NS['<my_custom_namespace>'])
### How to create a new MP task
In case a required task is not supported yet in the MP framework, it can be created relatively easy. For the task at
hand, the following [interface](fancy_gym/black_box/raw_interface_wrapper.py) needs to be implemented.
hand, the following [interface](https://github.com/ALRhub/fancy_gym/tree/master/fancy_gym/black_box/raw_interface_wrapper.py) needs to be implemented.
```python
from abc import abstractmethod
@ -251,7 +283,7 @@ class RawInterfaceWrapper(gym.Wrapper):
If you created a new task wrapper, feel free to open a PR, so we can integrate it for others to use as well. Without the
integration the task can still be used. A rough outline can be shown here, for more details we recommend having a look
at the [examples](fancy_gym/examples/).
at the [examples](https://github.com/ALRhub/fancy_gym/tree/master/fancy_gym/examples/).
If the step-based is already registered with gym, you can simply do the following:

View File

@ -6,7 +6,10 @@ from .envs.registry import ALL_MOVEMENT_PRIMITIVE_ENVIRONMENTS, MOVEMENT_PRIMITI
ALL_DMC_MOVEMENT_PRIMITIVE_ENVIRONMENTS = MOVEMENT_PRIMITIVE_ENVIRONMENTS_FOR_NS['dm_control']
ALL_FANCY_MOVEMENT_PRIMITIVE_ENVIRONMENTS = MOVEMENT_PRIMITIVE_ENVIRONMENTS_FOR_NS['fancy']
ALL_METAWORLD_MOVEMENT_PRIMITIVE_ENVIRONMENTS = MOVEMENT_PRIMITIVE_ENVIRONMENTS_FOR_NS['metaworld']
if 'metaworld' in MOVEMENT_PRIMITIVE_ENVIRONMENTS_FOR_NS:
ALL_METAWORLD_MOVEMENT_PRIMITIVE_ENVIRONMENTS = MOVEMENT_PRIMITIVE_ENVIRONMENTS_FOR_NS['metaworld']
else:
ALL_METAWORLD_MOVEMENT_PRIMITIVE_ENVIRONMENTS = 'Metaworld is not installed.'
ALL_GYM_MOVEMENT_PRIMITIVE_ENVIRONMENTS = MOVEMENT_PRIMITIVE_ENVIRONMENTS_FOR_NS['gym']

View File

@ -16,7 +16,7 @@ def example_mp(env_name="fancy_ProMP/HoleReacher-v0", seed=1, iterations=1, rend
"""
# Equivalent to gym, we have a make function which can be used to create environments.
# It takes care of seeding and enables the use of a variety of external environments using the gym interface.
env = gym.make(env_name)
env = gym.make(env_name, render_mode='human' if render else None)
returns = 0
# env.render(mode=None)
@ -28,7 +28,7 @@ def example_mp(env_name="fancy_ProMP/HoleReacher-v0", seed=1, iterations=1, rend
if render and i % 1 == 0:
# This renders the full MP trajectory
# It is only required to call render() once in the beginning, which renders every consecutive trajectory.
env.render(mode="human")
env.render()
# Now the action space is not the raw action but the parametrization of the trajectory generator,
# such as a ProMP
@ -43,14 +43,19 @@ def example_mp(env_name="fancy_ProMP/HoleReacher-v0", seed=1, iterations=1, rend
if terminated or truncated:
print(reward)
obs = env.reset()
env.close()
def example_custom_mp(env_name="fancy_ProMP/Reacher5d-v0", seed=1, iterations=1, render=True):
"""
Example for running a movement primitive based environment, which is already registered
Example for running a custom movement primitive based environments.
Our already registered environments follow the same structure.
Hence, this also allows to adjust hyperparameters of the movement primitives.
Yet, we recommend the method above if you are just interested in changing those parameters for existing tasks.
We appreciate PRs for custom environments (especially MP wrappers of existing tasks)
for our repo: https://github.com/ALRhub/fancy_gym/
Args:
env_name: DMP env_id
seed: seed for deterministic behaviour
seed: seed
iterations: Number of rollout steps to run
render: Render the episode
@ -59,14 +64,14 @@ def example_custom_mp(env_name="fancy_ProMP/Reacher5d-v0", seed=1, iterations=1,
"""
# Changing the arguments of the black box env is possible by providing them to gym through mp_config_override.
# E.g. here for way to many basis functions
env = gym.make(env_name, seed, mp_config_override={'basis_generator_kwargs': {'num_basis': 1000}})
env = gym.make(env_name, seed, mp_config_override={'basis_generator_kwargs': {'num_basis': 1000}}, render_mode='human' if render else None)
returns = 0
obs = env.reset()
# This time rendering every trajectory
if render:
env.render(mode="human")
env.render()
# number of samples/full trajectories (multiple environment steps)
for i in range(iterations):
@ -78,8 +83,47 @@ def example_custom_mp(env_name="fancy_ProMP/Reacher5d-v0", seed=1, iterations=1,
print(i, reward)
obs = env.reset()
env.close()
return obs
class Custom_MPWrapper(fancy_gym.envs.mujoco.reacher.MPWrapper):
mp_config = {
'ProMP': {
'trajectory_generator_kwargs': {
'trajectory_generator_type': 'promp',
'weights_scale': 2
},
'phase_generator_kwargs': {
'phase_generator_type': 'linear'
},
'controller_kwargs': {
'controller_type': 'velocity'
},
'basis_generator_kwargs': {
'basis_generator_type': 'zero_rbf',
'num_basis': 5,
'num_basis_zero_start': 1
}
},
'DMP': {
'trajectory_generator_kwargs': {
'trajectory_generator_type': 'dmp',
'weights_scale': 500
},
'phase_generator_kwargs': {
'phase_generator_type': 'exp',
'alpha_phase': 2.5
},
'controller_kwargs': {
'controller_type': 'velocity'
},
'basis_generator_kwargs': {
'basis_generator_type': 'rbf',
'num_basis': 5
}
}
}
def example_fully_custom_mp(seed=1, iterations=1, render=True):
"""
@ -99,38 +143,92 @@ def example_fully_custom_mp(seed=1, iterations=1, render=True):
"""
base_env_id = "fancy/Reacher5d-v0"
custom_env_id = "fancy/Reacher5d-Custom-v0"
custom_env_id_DMP = "fancy_DMP/Reacher5d-Custom-v0"
custom_env_id_ProMP = "fancy_ProMP/Reacher5d-Custom-v0"
# Replace this wrapper with the custom wrapper for your environment by inheriting from the RawInterfaceWrapper.
# You can also add other gym.Wrappers in case they are needed.
wrappers = [fancy_gym.envs.mujoco.reacher.MPWrapper]
fancy_gym.upgrade(custom_env_id, mp_wrapper=Custom_MPWrapper, add_mp_types=['ProMP', 'DMP'], base_id=base_env_id)
# For a ProMP
trajectory_generator_kwargs = {'trajectory_generator_type': 'promp',
'weights_scale': 2}
phase_generator_kwargs = {'phase_generator_type': 'linear'}
controller_kwargs = {'controller_type': 'velocity'}
basis_generator_kwargs = {'basis_generator_type': 'zero_rbf',
'num_basis': 5,
'num_basis_zero_start': 1
}
env = gym.make(custom_env_id_ProMP, render_mode='human' if render else None)
# # For a DMP
# trajectory_generator_kwargs = {'trajectory_generator_type': 'dmp',
# 'weights_scale': 500}
# phase_generator_kwargs = {'phase_generator_type': 'exp',
# 'alpha_phase': 2.5}
# controller_kwargs = {'controller_type': 'velocity'}
# basis_generator_kwargs = {'basis_generator_type': 'rbf',
# 'num_basis': 5
# }
base_env = gym.make(base_env_id)
env = fancy_gym.make_bb(env=base_env, wrappers=wrappers, black_box_kwargs={},
traj_gen_kwargs=trajectory_generator_kwargs, controller_kwargs=controller_kwargs,
phase_kwargs=phase_generator_kwargs, basis_kwargs=basis_generator_kwargs,
seed=seed)
rewards = 0
obs = env.reset()
if render:
env.render(mode="human")
env.render()
# number of samples/full trajectories (multiple environment steps)
for i in range(iterations):
ac = env.action_space.sample()
obs, reward, terminated, truncated, info = env.step(ac)
rewards += reward
if terminated or truncated:
print(rewards)
rewards = 0
obs = env.reset()
try: # Some mujoco-based envs don't correlcty implement .close
env.close()
except:
pass
def example_fully_custom_mp_alternative(seed=1, iterations=1, render=True):
"""
Instead of defining the mp_args in a new custom MP_Wrapper, they can also be provided during registration.
Args:
seed: seed
iterations: Number of rollout steps to run
render: Render the episode
Returns:
"""
base_env_id = "fancy/Reacher5d-v0"
custom_env_id = "fancy/Reacher5d-Custom-v0"
custom_env_id_ProMP = "fancy_ProMP/Reacher5d-Custom-v0"
fancy_gym.upgrade(custom_env_id, mp_wrapper=fancy_gym.envs.mujoco.reacher.MPWrapper, add_mp_types=['ProMP'], base_id=base_env_id, mp_config_override= {'ProMP': {
'trajectory_generator_kwargs': {
'trajectory_generator_type': 'promp',
'weights_scale': 2
},
'phase_generator_kwargs': {
'phase_generator_type': 'linear'
},
'controller_kwargs': {
'controller_type': 'velocity'
},
'basis_generator_kwargs': {
'basis_generator_type': 'zero_rbf',
'num_basis': 5,
'num_basis_zero_start': 1
}
}})
env = gym.make(custom_env_id_ProMP, render_mode='human' if render else None)
rewards = 0
obs = env.reset()
if render:
env.render()
# number of samples/full trajectories (multiple environment steps)
for i in range(iterations):
ac = env.action_space.sample()
obs, reward, terminated, truncated, info = env.step(ac)
rewards += reward
if terminated or truncated:
print(rewards)
rewards = 0
obs = env.reset()
if render:
env.render()
rewards = 0
obs = env.reset()
@ -146,7 +244,14 @@ def example_fully_custom_mp(seed=1, iterations=1, render=True):
rewards = 0
obs = env.reset()
def main(render = False):
try: # Some mujoco-based envs don't correlcty implement .close
env.close()
except:
pass
def main():
render = False
# DMP
example_mp("fancy_DMP/HoleReacher-v0", seed=10, iterations=5, render=render)
@ -165,6 +270,7 @@ def main(render = False):
# Custom MP
example_fully_custom_mp(seed=10, iterations=1, render=render)
example_fully_custom_mp_alternative(seed=10, iterations=1, render=render)
if __name__ == '__main__':
main()
if __name__=='__main__':
main()

View File

@ -7,56 +7,63 @@ from ..envs.registry import register
from . import goal_object_change_mp_wrapper, goal_change_mp_wrapper, goal_endeffector_change_mp_wrapper, \
object_change_mp_wrapper
from . import metaworld_adapter
try:
import metaworld
except ModuleNotFoundError:
print('[FANCY GYM] Metaworld not avaible.')
else:
# Will only get executed, if import succeeds
metaworld_adapter.register_all_ML1()
from . import metaworld_adapter
ALL_METAWORLD_MOVEMENT_PRIMITIVE_ENVIRONMENTS = {"DMP": [], "ProMP": [], "ProDMP": []}
metaworld_adapter.register_all_ML1()
# MetaWorld
_goal_change_envs = ["assembly-v2", "pick-out-of-hole-v2", "plate-slide-v2", "plate-slide-back-v2",
"plate-slide-side-v2", "plate-slide-back-side-v2"]
for _task in _goal_change_envs:
register(
id=f'metaworld/{_task}',
register_step_based=False,
mp_wrapper=goal_change_mp_wrapper.MPWrapper,
add_mp_types=['ProMP', 'ProDMP'],
)
ALL_METAWORLD_MOVEMENT_PRIMITIVE_ENVIRONMENTS = {"DMP": [], "ProMP": [], "ProDMP": []}
_object_change_envs = ["bin-picking-v2", "hammer-v2", "sweep-into-v2"]
for _task in _object_change_envs:
register(
id=f'metaworld/{_task}',
register_step_based=False,
mp_wrapper=object_change_mp_wrapper.MPWrapper,
add_mp_types=['ProMP', 'ProDMP'],
)
# MetaWorld
_goal_change_envs = ["assembly-v2", "pick-out-of-hole-v2", "plate-slide-v2", "plate-slide-back-v2",
"plate-slide-side-v2", "plate-slide-back-side-v2"]
for _task in _goal_change_envs:
register(
id=f'metaworld/{_task}',
register_step_based=False,
mp_wrapper=goal_change_mp_wrapper.MPWrapper,
add_mp_types=['ProMP', 'ProDMP'],
)
_goal_and_object_change_envs = ["box-close-v2", "button-press-v2", "button-press-wall-v2", "button-press-topdown-v2",
"button-press-topdown-wall-v2", "coffee-button-v2", "coffee-pull-v2",
"coffee-push-v2", "dial-turn-v2", "disassemble-v2", "door-close-v2",
"door-lock-v2", "door-open-v2", "door-unlock-v2", "hand-insert-v2",
"drawer-close-v2", "drawer-open-v2", "faucet-open-v2", "faucet-close-v2",
"handle-press-side-v2", "handle-press-v2", "handle-pull-side-v2",
"handle-pull-v2", "lever-pull-v2", "peg-insert-side-v2", "pick-place-wall-v2",
"reach-v2", "push-back-v2", "push-v2", "pick-place-v2", "peg-unplug-side-v2",
"soccer-v2", "stick-push-v2", "stick-pull-v2", "push-wall-v2", "reach-wall-v2",
"shelf-place-v2", "sweep-v2", "window-open-v2", "window-close-v2"
]
for _task in _goal_and_object_change_envs:
register(
id=f'metaworld/{_task}',
register_step_based=False,
mp_wrapper=goal_object_change_mp_wrapper.MPWrapper,
add_mp_types=['ProMP', 'ProDMP'],
)
_object_change_envs = ["bin-picking-v2", "hammer-v2", "sweep-into-v2"]
for _task in _object_change_envs:
register(
id=f'metaworld/{_task}',
register_step_based=False,
mp_wrapper=object_change_mp_wrapper.MPWrapper,
add_mp_types=['ProMP', 'ProDMP'],
)
_goal_and_endeffector_change_envs = ["basketball-v2"]
for _task in _goal_and_endeffector_change_envs:
register(
id=f'metaworld/{_task}',
register_step_based=False,
mp_wrapper=goal_endeffector_change_mp_wrapper.MPWrapper,
add_mp_types=['ProMP', 'ProDMP'],
)
_goal_and_object_change_envs = ["box-close-v2", "button-press-v2", "button-press-wall-v2", "button-press-topdown-v2",
"button-press-topdown-wall-v2", "coffee-button-v2", "coffee-pull-v2",
"coffee-push-v2", "dial-turn-v2", "disassemble-v2", "door-close-v2",
"door-lock-v2", "door-open-v2", "door-unlock-v2", "hand-insert-v2",
"drawer-close-v2", "drawer-open-v2", "faucet-open-v2", "faucet-close-v2",
"handle-press-side-v2", "handle-press-v2", "handle-pull-side-v2",
"handle-pull-v2", "lever-pull-v2", "peg-insert-side-v2", "pick-place-wall-v2",
"reach-v2", "push-back-v2", "push-v2", "pick-place-v2", "peg-unplug-side-v2",
"soccer-v2", "stick-push-v2", "stick-pull-v2", "push-wall-v2", "reach-wall-v2",
"shelf-place-v2", "sweep-v2", "window-open-v2", "window-close-v2"
]
for _task in _goal_and_object_change_envs:
register(
id=f'metaworld/{_task}',
register_step_based=False,
mp_wrapper=goal_object_change_mp_wrapper.MPWrapper,
add_mp_types=['ProMP', 'ProDMP'],
)
_goal_and_endeffector_change_envs = ["basketball-v2"]
for _task in _goal_and_endeffector_change_envs:
register(
id=f'metaworld/{_task}',
register_step_based=False,
mp_wrapper=goal_endeffector_change_mp_wrapper.MPWrapper,
add_mp_types=['ProMP', 'ProDMP'],
)

View File

@ -11,11 +11,7 @@ import numpy as np
from fancy_gym.utils.env_compatibility import EnvCompatibility
try:
import metaworld
except Exception:
print('[FANCY GYM] Metaworld not avaible')
import metaworld
class FixMetaworldHasIncorrectObsSpaceWrapper(gym.Wrapper, gym.utils.RecordConstructorArgs):
def __init__(self, env: gym.Env):

79
pyproject.toml Normal file
View File

@ -0,0 +1,79 @@
[project]
name = "fancy_gym"
version = "0.1.4"
description = "Fancy Gym: Unifying interface for various RL benchmarks with support for Black Box approaches."
readme = "README.md"
authors = [
{name = "Fabian Otto", email = "fabian.otto@uni-tuebingen.de"},
{name = "Onur Celik", email = "celik@kit.edu"},
{name = "Dominik Roth", email = "fancy_gym@dominik-roth.eu"},
{name = "Hongyi Zhou", email = "hongyi.zhou@kit.edu"}
]
license = { text = "MIT License" }
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Operating System :: OS Independent",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"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"
]
dependencies = [
"mp_pytorch<=0.1.3",
"mujoco==2.3.3",
"gymnasium[mujoco]>=0.26.0"
]
requires-python = ">=3.7"
[project.urls]
"Homepage" = "https://github.com/ALRhub/fancy_gym/"
#"Documentation" = "https://github.com/ALRhub/fancy_gym/"
"Bug Tracker" = "https://github.com/ALRhub/fancy_gym/issues"
#"Repository" = "https://github.com/ALRhub/fancy_gym/"
[build-system]
requires = ["setuptools>=61.0.0", "wheel"]
build-backend = "setuptools.build_meta"
[project.optional-dependencies]
dmc = ["shimmy[dm-control]", "Shimmy==1.0.0"]
# PyPi does not allow external dependencies. Metaworld will have to be installed manually until Farama publishes up-to-date version of metaworld on PyPi.
#metaworld = ["metaworld @ git+https://github.com/Farama-Foundation/Metaworld.git@d155d0051630bb365ea6a824e02c66c068947439#egg=metaworld"]
box2d = ["gymnasium[box2d]>=0.26.0"]
mujoco-legacy = ["mujoco-py>=2.1,<2.2", "cython<3"]
jax = ["jax>=0.4.0", "jaxlib>=0.4.0"]
all = [
# include all the optional dependencies
"shimmy[dm-control]",
"Shimmy==1.0.0",
#"metaworld @ git+https://github.com/Farama-Foundation/Metaworld.git@d155d0051630bb365ea6a824e02c66c068947439#egg=metaworld",
"mujoco==2.3.3",
"gymnasium[box2d,mujoco]>=0.26.0",
"mujoco-py>=2.1,<2.2",
"cython<3",
"jax>=0.4.0",
"jaxlib>=0.4.0"
]
testing = [
"pytest",
# include all the optional dependencies as well
"shimmy[dm-control]",
"Shimmy==1.0.0",
#"metaworld @ git+https://github.com/Farama-Foundation/Metaworld.git@d155d0051630bb365ea6a824e02c66c068947439#egg=metaworld",
"mujoco==2.3.3",
"gymnasium[box2d,mujoco]>=0.26.0",
"mujoco-py>=2.1,<2.2",
"cython<3",
"jax>=0.4.0",
"jaxlib>=0.4.0"
]

View File

@ -1,15 +1,17 @@
# We still provide a setup.py for backwards compatability.
# But the pyproject.toml should be prefered.
import itertools
from pathlib import Path
from typing import List
from setuptools import setup, find_packages
print('[!] You are currently installing/building fancy_gym via setup.py. This is only provided for backwards-compatability. Please use the pyproject.toml instead.')
# Environment-specific dependencies for dmc and metaworld
extras = {
'dmc': ['shimmy[dm-control]', 'Shimmy==1.0.0'],
'metaworld': ['mujoco==2.3.3', 'metaworld @ git+https://github.com/Farama-Foundation/Metaworld.git@d155d0051630bb365ea6a824e02c66c068947439#egg=metaworld'],
'box2d': ['gymnasium[box2d]>=0.26.0'],
'mujoco': ['mujoco==2.3.3', 'gymnasium[mujoco]>0.26.0'],
'mujoco-legacy': ['mujoco-py >=2.1,<2.2', 'cython<3'],
'jax': ["jax >=0.4.0", "jaxlib >=0.4.0"],
'mushroom-rl': ['mushroom-rl'],
@ -36,7 +38,7 @@ def find_package_data(extensions_to_include: List[str]) -> List[str]:
setup(
author='Fabian Otto, Onur Celik, Dominik Roth, Hongyi Zhou',
name='fancy_gym',
version='1.0',
version='0.1.0',
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Science/Research',
@ -49,11 +51,13 @@ setup(
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
],
extras_require=extras,
install_requires=[
'gymnasium>=0.26.0',
'mp_pytorch<=0.1.3'
'mp_pytorch<=0.1.3',
'mujoco==2.3.3',
'gymnasium[mujoco]>=0.26.0'
],
packages=[package for package in find_packages(
) if package.startswith("fancy_gym")],