Skip to content

Commit

Permalink
Rename simzoo package to stable gym (#117)
Browse files Browse the repository at this point in the history
* chore(release): 0.5.18

* build(simzoo): rename `simzoo` package to `stable_gym`

This commit renames the `simzoo` package to `stable-gym`. This was done since the package is no
longer included in the bayesian_learning_control package and in my oppinion the name `stable_gym`
better represents the package content.

BREAKING CHANGE: The package name is changed so the package should be imported as `stable_gym` in
the future.
  • Loading branch information
rickstaa authored Jun 5, 2023
1 parent f768715 commit ca28218
Show file tree
Hide file tree
Showing 43 changed files with 722 additions and 691 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release_ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Github action that updates the code version tags, adds a changelog and drafts a release when
# a new version tag is added.
name: Simzoo release CI
name: Stable Gym release CI
on:
push:
tags:
Expand Down Expand Up @@ -54,7 +54,7 @@ jobs:
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: main
file_pattern: simzoo/version.py setup.cfg package.json
file_pattern: package.json
commit_message: "chore(release): updates code version to ${{ steps.get_semver.outputs.current_version }}"
create-release:
# NOTE: Drafts a release for the new tag
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Main Simzoo github action. Performs linting and formatting checks. It also runs tests.
name: Simzoo CI
# Main Stable Gym github action. Performs linting and formatting checks. It also runs tests.
name: Stable Gym CI
on:
push:
branches:
Expand Down
1,220 changes: 616 additions & 604 deletions CHANGELOG.md

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Simzoo
# Stable Gym

[![GitHub release (latest by date)](https://img.shields.io/github/v/release/rickstaa/simzoo)](https://github.com/rickstaa/simzoo/releases)
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/rickstaa/stable-gym)](https://github.com/rickstaa/stable-gym/releases)
[![Python 3](https://img.shields.io/badge/Python->=3.7-brightgreen)](https://www.python.org/)
[![Contributions](https://img.shields.io/badge/contributions-welcome-brightgreen.svg)](CONTRIBUTING.md)

A python package containing the non ROS-based [gymnasium environments](https://gymnasium.farama.org/) used to train the (stable) RL agents in the [bayesian\_learning\_control](https://github.com/rickstaa/bayesian-learning-control) package.

## Installation and Usage

Please see the [bayesian-learning-control docs](https://rickstaa.github.io/bayesian-learning-control/simzoo/simzoo.html) for installation and usage instructions.
Please see the [bayesian-learning-control docs](https://rickstaa.github.io/bayesian-learning-control/stable-gym/stable-gym.html) for installation and usage instructions.

## Contributing

Expand Down
4 changes: 4 additions & 0 deletions TODOs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# TODOs

* Fix release action versioning. Check if release works and the sphinx documentation uses the correct version.
* Add sphinx documentation.
4 changes: 2 additions & 2 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Examples

Contains examples of how to use the [Simzoo](https://github.com/rickstaa/simzoo) package. Alternatively, you can directly run the environment Python files to see how the environment behaves (e.g. `python simzoo/envs/biological/oscillator/oscillator.py`).
Contains examples of how to use the [Stable Gym](https://github.com/rickstaa/stable-gym) package. Alternatively, you can directly run the environment Python files to see how the environment behaves (e.g. `python stable_gym/envs/biological/oscillator/oscillator.py`).

## Dependencies

Expand All @@ -9,4 +9,4 @@ Contains examples of how to use the [Simzoo](https://github.com/rickstaa/simzoo)
## How to use

1. Install the Python dependencies using `pip install -r requirements.txt`.
2. Run the example using `python use_simzoo.py`.
2. Run the example using `python use_stable_gym.py`.
7 changes: 4 additions & 3 deletions examples/use_simzoo.py → examples/use_stable_gym.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
"""A simple example on how to use the Simzoo environments.
"""A simple example on how to use the Stable Gym `gymnasium`_ environments.
.. _gymnasium: https://gymnasium.farama.org/
"""
import gymnasium as gym

import simzoo # noqa: F401
import stable_gym # noqa: F401

# ENV_NAME = "Oscillator-v1"
# ENV_NAME = "Ex3EKF-v1"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
"""A simple example on how to use the Simzoo environments in a vectorized manner.
"""A simple example on how to use the Stable Gym `gymnasium`_ environments in a
vectorized manner.
.. note::
For more information on vectorized environments, see the `gym.vector`_
documentation.
.. _gymnasium: https://gymnasium.farama.org/
.. _gym.vector: https://gymnasium.farama.org/api/vector/
"""
import gymnasium as gym

import simzoo # noqa: F401
import stable_gym # noqa: F401

ENV_NAME = "Oscillator-v1"
# ENV_NAME = "Ex3EKF-v1"
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
{
"name": "simzoo",
"version": "0.5.17",
"name": "stable-gym",
"version": "0.5.18",
"description": "Package that contains the gymnasium environments of the bayesian-learning-control package.",
"keywords": [
"reinforcement-learning",
"simulation",
"stability",
"openai-gym",
"gym-environments",
"gymnasium",
"gymnasium-environments"
],
"homepage": "https://github.com/rickstaa/simzoo#simzoo",
"homepage": "https://github.com/rickstaa/stable-gym#stable-gym",
"bugs": {
"url": "https://github.com/rickstaa/simzoo/issues"
"url": "https://github.com/rickstaa/stable-gym/issues"
},
"repository": {
"type": "git",
"url": "[email protected]:rickstaa/simzoo.git"
"url": "[email protected]:rickstaa/stable-gym.git"
},
"license": "MIT",
"author": "Rick Staa",
Expand Down
13 changes: 7 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
# Project configuration.

[project]
name = "simzoo"
name = "stable_gym"
dynamic = ["version", "readme"]
authors = [
{name = "Rick Staa", email = "[email protected]"}
Expand All @@ -15,6 +15,7 @@ description = "A zoo full of gymnasium environments that can be used with the ba
keywords = [
"reinforcement-learning",
"simulation",
"stability",
"openai-gym",
"gym-environments",
"gymnasium",
Expand Down Expand Up @@ -43,20 +44,20 @@ dev = [
]

[project.urls]
repository = "https://github.com/rickstaa/simzoo"
source = "https://github.com/rickstaa/simzoo"
documentation = "https://rickstaa.dev/simzoo"
repository = "https://github.com/rickstaa/stable-gym"
source = "https://github.com/rickstaa/stable-gym"
documentation = "https://rickstaa.dev/stable-gym"

# Python tools configuration.

[tool.setuptools]
packages = ["simzoo"]
packages = ["stable_gym"]

[tool.setuptools.dynamic]
readme = {file = "README.md", content_type = "text/markdown"}

[tool.setuptools_scm]
write_to = "simzoo/_version.py"
write_to = "stable_gym/_version.py"

[tool.pytest.ini_options]
minversion = "6.0"
Expand Down
4 changes: 0 additions & 4 deletions simzoo/_version.py

This file was deleted.

3 changes: 0 additions & 3 deletions simzoo/common/__init__.py

This file was deleted.

1 change: 0 additions & 1 deletion simzoo/envs/__init__.py

This file was deleted.

4 changes: 0 additions & 4 deletions simzoo/envs/biological/__init__.py

This file was deleted.

7 changes: 0 additions & 7 deletions simzoo/envs/classic_control/__init__.py

This file was deleted.

2 changes: 0 additions & 2 deletions simzoo/envs/classic_control/ex3_ekf/__init__.py

This file was deleted.

10 changes: 6 additions & 4 deletions simzoo/__init__.py → stable_gym/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""Module that register the Simzoo gymnasium environments.
"""Module that register the Stable Gym `gymnasium`_ environments.
.. _gymnasium: https://gymnasium.farama.org/
"""
import gymnasium as gym
from gymnasium.envs.registration import register
Expand All @@ -14,17 +16,17 @@
# Available environments
ENVS = {
"Oscillator-v1": {
"module": "simzoo.envs.biological.oscillator.oscillator:Oscillator",
"module": "stable_gym.envs.biological.oscillator.oscillator:Oscillator",
"max_step": 400,
"reward_threshold": 300,
},
"Ex3EKF-v1": {
"module": "simzoo.envs.classic_control.ex3_ekf.ex3_ekf:Ex3EKF",
"module": "stable_gym.envs.classic_control.ex3_ekf.ex3_ekf:Ex3EKF",
"max_step": 400,
"reward_threshold": 300,
},
"CartPoleCost-v1": {
"module": "simzoo.envs.classic_control.cartpole_cost.cartpole_cost:CartPoleCost", # noqa: E501
"module": "stable_gym.envs.classic_control.cartpole_cost.cartpole_cost:CartPoleCost", # noqa: E501
"max_step": 250,
"reward_threshold": 300,
},
Expand Down
4 changes: 4 additions & 0 deletions stable_gym/_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# file generated by setuptools_scm
# don't change, don't track in version control
__version__ = version = "0.5.17.dev3+gf768715.d20230605"
__version_tuple__ = version_tuple = (0, 5, 17, "dev3", "gf768715.d20230605")
6 changes: 6 additions & 0 deletions stable_gym/common/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"""Contains several functions that can be used across all the Stable Gym `gymnasium`_
environments.
.. _gymnasium: https://gymnasium.farama.org/
"""
from stable_gym.common.disturber import Disturber # noqa: F401
File renamed without changes.
6 changes: 3 additions & 3 deletions simzoo/common/disturber.py → stable_gym/common/disturber.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ class Disturber:
of the :class:`Disturber` class.
disturbance_cfg (dict): The disturbance config used to generate the currently
selected disturber. This variable is retrieved from the
:obj:`~bayesian_learning_control.simzoo.simzoo.common.disturber.Disturber.disturber_cfg`
:obj:`~stable_gym.common.disturber.Disturber.disturber_cfg`
using the currently set ``disturbance_type`` and/or ``disturbance_variant``.
.. seealso::
Expand Down Expand Up @@ -1347,7 +1347,7 @@ def _apply_env_disturbance(self):

def next_disturbance(self):
"""Function used to request the next disturbance that is specified in the
:obj:`~bayesian_learning_control.simzoo.simzoo.common.disturber.Disturber.disturbance_cfg`.
:obj:`~stable_gym.common.disturber.Disturber.disturbance_cfg`.
Raises:
RuntimeError: Thrown when this method is called before the
Expand Down Expand Up @@ -1440,7 +1440,7 @@ def disturber_cfg(self, set_val):
def disturbance_cfg(self):
"""The disturbance config used to generate the currently selected disturber.
This variable is retrieved from the
:obj:`~bayesian_learning_control.simzoo.simzoo.common.disturber.Disturber.disturber_cfg`
:obj:`~stable_gym.common.disturber.Disturber.disturber_cfg`
using the currently set ``disturbance_type`` and/or ``disturbance_variant``.
""" # noqa: E501
if self._disturbance_cfg is None:
Expand Down
4 changes: 3 additions & 1 deletion simzoo/common/utils.py → stable_gym/common/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""Utility functions that are used in multiple simzoo environments.
"""Utility functions that are used in multiple Stable Gym `gymnasium`_ environments.
.. _gymnasium: https://gymnasium.farama.org/
"""
import re

Expand Down
4 changes: 4 additions & 0 deletions stable_gym/envs/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
"""The Stable Gym `gymnasium`_ environments.
.. _gymnasium: https://gymnasium.farama.org/
"""
6 changes: 6 additions & 0 deletions stable_gym/envs/biological/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"""Stable Gym `gymnasium`_ environments that are based on Biological systems.
.. _Gymnasium: https://gymnasium.farama.org/
"""

from stable_gym.envs.biological.oscillator.oscillator import Oscillator # noqa: F401
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ The info dictionary contains the following keys:

## How to use

This environment is part of the [simzoo package](https://github.com/rickstaa/simzoo). It is therefore registered as a gymnasium environment when you import the Simzoo package. If you want to use the environment in the stand-alone mode, you can register it yourself.
This environment is part of the [Stable Gym package](https://github.com/rickstaa/stable-gym). It is therefore registered as a gymnasium environment when you import the Stable Gym package. If you want to use the environment in the stand-alone mode, you can register it yourself.
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""A synthetic oscillatory network of transcriptional regulators gymnasium environment.
"""
from simzoo.envs.biological.oscillator.oscillator import Oscillator # noqa: F401
from stable_gym.envs.biological.oscillator.oscillator import Oscillator # noqa: F401
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Oscillator(gym.Env, OscillatorDisturber):
.. note::
This gymnasium environment inherits from the
:class:`~bayesian_learning_control.simzoo.simzoo.common.disturber.Disturber`
:class:`~stable_gym.common.disturber.Disturber`
in order to be able to use it with the Robustness Evaluation tool of the
Bayesian Learning Control package (BLC). For more information see
`the BLC documentation <https://rickstaa.github.io/bayesian-learning-control/control/robustness_eval.html>`_.
Expand Down Expand Up @@ -109,8 +109,9 @@ class Oscillator(gym.Env, OscillatorDisturber):
Arguments:
```python
import simzoo
env = simzoo.make("Oscillator-v1")
import stable_gym
import gymnasium as gym
env = gym.make("Oscillator-v1")
```
On reset, the `options` parameter allows the user to change the bounds used to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
documentation.
""" # noqa: E501
# IMPROVE: File can be removed when a gymnasium wrapper is used.
from simzoo.common.disturber import Disturber
from stable_gym.common.disturber import Disturber

# Disturber config used to overwrite the default config
# NOTE: Merged with the default config
Expand Down Expand Up @@ -34,7 +34,7 @@

class OscillatorDisturber(Disturber):
"""Wrapper around the
:meth:`~bayesian_learning_control.simzoo.simzoo.common.disturber.Disturber` that
:meth:`~stable_gym.common.disturber.Disturber` that
makes the disturber is compatible with the `Oscillator` environment.
"""

Expand All @@ -53,7 +53,7 @@ def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

def init_disturber(self, *args, **kwargs):
"""Wrapper around the :meth:`~bayesian_learning_control.simzoo.simzoo.common.disturber.Disturber.init_disturber`
"""Wrapper around the :meth:`~stable_gym.common.disturber.Disturber.init_disturber`
method that makes sure an up to date version of the environment
:obj:`DISTURBER_CFG` is used.
Expand Down
10 changes: 10 additions & 0 deletions stable_gym/envs/classic_control/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"""Stable Gym `gymnasium`_ environments that are based on classical control theory
problems.
.. _Gymnasium: https://gymnasium.farama.org/
"""
# fmt: off
from stable_gym.envs.classic_control.cartpole_cost.cartpole_cost import \
CartPoleCost # noqa: F401
# fmt: on
from stable_gym.envs.classic_control.ex3_ekf.ex3_ekf import Ex3EKF # noqa: F401
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,4 @@ The info dictionary contains the following keys:

## How to use

This environment is part of the [simzoo package](https://github.com/rickstaa/simzoo). It is therefore registered as a gymnasium environment when you import the Simzoo package. If you want to use the environment in stand-alone mode, you can register it yourself.
This environment is part of the [Stable Gym package](https://github.com/rickstaa/stable-gym). It is therefore registered as a gymnasium environment when you import the Stable Gym package. If you want to use the environment in stand-alone mode, you can register it yourself.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""A synthetic oscillatory network of transcriptional regulators gymnasium environment.
"""
# fmt: off
from simzoo.envs.classic_control.cartpole_cost.cartpole_cost import \
from stabe_gym.envs.classic_control.cartpole_cost.cartpole_cost import \
CartPoleCost # noqa: F401

# fmt: off
Loading

0 comments on commit ca28218

Please sign in to comment.