Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
6 changes: 3 additions & 3 deletions .github/workflows/cpu_ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ jobs:
- name: Run cpu tests
run: uv run --frozen pytest tests/cpu/

skygym_tests:
skyrl_gym_tests:
needs: check_code_quality
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: ./skygym
working-directory: ./skyrl-gym

steps:
- uses: actions/checkout@v4
Expand All @@ -83,7 +83,7 @@ jobs:
uses: astral-sh/setup-uv@v6
with:
activate-environment: true
- name: Install skygym
- name: Install skyrl-gym
run: uv sync --frozen --extra dev # installs from lock file
- name: Run cpu tests
run: uv run --frozen pytest tests/
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ docs/_spelling/

# .env files inside directories can be ignored
/skyrl-train/.env
/skygym/.env
/skyrl-gym/.env

/skyrl_train/.venv
/skygym/.venv
/skyrl-gym/.venv

# build
/skygym/build
/skyrl-gym/build

*.log
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ SkyRL provides the following components:

- [`skyagent`](./skyagent): Our agent layer for training long-horizon, real-world agents. Contains code for [SkyRL-v0](https://novasky-ai.notion.site/skyrl-v0).
- (NEW!) [`skyrl-train`](./skyrl-train): Our flexible training framework for RL.
- (NEW!) [`skygym`](./skygym): Our library of math, coding, search and SQL environments implemented with the Gymnasium API.
- (NEW!) [`skyrl-gym`](./skyrl-gym): Our library of math, coding, search and SQL environments implemented with the Gymnasium API.

# Acknowledgement

Expand Down
28 changes: 0 additions & 28 deletions skygym/skygym/envs/__init__.py
Copy link
Member Author

Choose a reason for hiding this comment

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

Moved, not deleted.

This file was deleted.

6 changes: 3 additions & 3 deletions skygym/pyproject.toml → skyrl-gym/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# basic pyproject.toml for skygym
# basic pyproject.toml for skyrl-gym
[build-system]
requires = ["setuptools>=45", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "skygym"
name = "skyrl-gym"
version = "0.1.0"
description = "A gymnasium environment for RL agents to interact with the sky"
authors = [
Expand All @@ -22,7 +22,7 @@ dependencies = [
]

[tool.setuptools.packages.find]
include = ["skygym*"]
include = ["skyrl_gym*"]

[project.optional-dependencies]
dev = [
Expand Down
8 changes: 4 additions & 4 deletions skygym/skygym/__init__.py → skyrl-gym/skyrl_gym/__init__.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
"""Root `__init__` of the gym module setting the `__all__` of skyrl modules."""

from skygym.core import Env
from skygym import error
from skyrl_gym.core import Env
from skyrl_gym import error

from skygym.envs.registration import (
from skyrl_gym.envs.registration import (
make,
spec,
register,
registry,
pprint_registry,
)
from skygym import tools, envs
from skyrl_gym import tools, envs

# Define __all__ to control what's exposed
__all__ = [
Expand Down
2 changes: 1 addition & 1 deletion skygym/skygym/core.py → skyrl-gym/skyrl_gym/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class EnvStepOutput(TypedDict):

class Env(Generic[ObsType, ActType]):
"""
The main SkyGym class for implementing Reinforcement Learning Agents environments.
The main SkyRL Gym class for implementing Reinforcement Learning Agents environments.

The main API methods that users of this class need to know are:

Expand Down
File renamed without changes.
28 changes: 28 additions & 0 deletions skyrl-gym/skyrl_gym/envs/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""Registers the internal gym envs."""

from skyrl_gym.envs.registration import register

register(
id="gsm8k",
entry_point="skyrl_gym.envs.gsm8k.env:GSM8kEnv",
)

register(
id="text2sql",
entry_point="skyrl_gym.envs.sql.env:SQLEnv",
)

register(
id="search",
entry_point="skyrl_gym.envs.search.env:SearchEnv",
)

register(
id="lcb",
entry_point="skyrl_gym.envs.lcb.env:LCBEnv",
)

register(
id="searchcode",
entry_point="skyrl_gym.envs.searchcode.env:SearchCodeEnv",
)
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from typing import Any, Dict, List, Optional, TypedDict
from skygym import Env
from skyrl_gym import Env
from typing import Tuple

MessageType = Dict[str, str]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from skygym.envs.base_text_env import BaseTextEnv, BaseTextEnvStepOutput
from skygym.envs.gsm8k import utils
from skyrl_gym.envs.base_text_env import BaseTextEnv, BaseTextEnvStepOutput
from skyrl_gym.envs.gsm8k import utils
from typing import Dict, Any
from omegaconf import DictConfig

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from skygym.envs.base_text_env import BaseTextEnv, BaseTextEnvStepOutput
from skyrl_gym.envs.base_text_env import BaseTextEnv, BaseTextEnvStepOutput
from typing import Any, Dict
from skygym.envs.lcb.livecodebench import compute_score
from skyrl_gym.envs.lcb.livecodebench import compute_score
import json
from omegaconf import DictConfig

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Functions for registering environments within skygym using public functions ``make``, ``register`` and ``spec``."""
"""Functions for registering environments within skyrl_gym using public functions ``make``, ``register`` and ``spec``."""

from __future__ import annotations

Expand All @@ -7,7 +7,7 @@
import importlib
import json
from dataclasses import dataclass, field
from skygym import Env, error
from skyrl_gym import Env, error

from typing import Protocol, Dict, Any

Expand All @@ -30,9 +30,9 @@ def __call__(self, **kwargs: Any) -> Env: ...

@dataclass
class EnvSpec:
"""A specification for creating environments with `skygym.make`.
"""A specification for creating environments with `skyrl_gym.make`.

* **id**: The string used to create the environment with `skygym.make`
* **id**: The string used to create the environment with `skyrl_gym.make`

* **entry_point**: A string for the environment location, ``(import path):(environment name)`` or a function that creates the environment.
NOTE[shu]: example is like a database path? or local RAG environment?
Expand Down Expand Up @@ -87,7 +87,7 @@ def _check_can_jsonify(env_spec: Dict[str, Any]):
for key, value in env_spec.items():
if callable(value):
raise ValueError(
f"Callable found in {spec_name} for {key} attribute with value={value}. Currently, skygym does not support serialising callables."
f"Callable found in {spec_name} for {key} attribute with value={value}. Currently, skyrl_gym does not support serialising callables."
)

@staticmethod
Expand Down Expand Up @@ -148,7 +148,7 @@ def _find_spec(env_id: str) -> EnvSpec:

if env_spec is None:
raise error.Error(
f"No registered env with id: {env_name}. Did you register it, or import the package that registers it? Use `skygym.pprint_registry()` to see all of the registered environments."
f"No registered env with id: {env_name}. Did you register it, or import the package that registers it? Use `skyrl_gym.pprint_registry()` to see all of the registered environments."
)

return env_spec
Expand Down Expand Up @@ -185,7 +185,7 @@ def register(
kwargs: Dict[str, Any] | None = None,
):
"""
Registers an environment in skygym with an ``id`` to use with `skygym.make` with the ``entry_point``
Registers an environment in skyrl_gym with an ``id`` to use with `skyrl_gym.make` with the ``entry_point``
being a string or callable for creating the environment.

The ``id`` parameter corresponds to the name of the environment.
Expand Down Expand Up @@ -216,9 +216,9 @@ def make(
id: str | EnvSpec,
**kwargs: Any,
) -> Env:
"""Creates an environment previously registered with `skygym.register` or a :class:`EnvSpec`.
"""Creates an environment previously registered with `skyrl_gym.register` or a :class:`EnvSpec`.

To find all available environments use ``skygym.envs.registry.keys()`` for all valid ids.
To find all available environments use ``skyrl_gym.envs.registry.keys()`` for all valid ids.

Args:
id: A string for the environment id or a :class:`EnvSpec`.
Expand Down Expand Up @@ -260,10 +260,12 @@ def make(
raise type(e)(f"{e} was raised from the environment creator for {env_spec.id} with kwargs ({env_spec_kwargs})")

if not isinstance(env, Env):
if str(env.__class__.__base__) == "<class 'skygym.core.Env'>":
raise TypeError("Gym is incompatible with skygym, please update the environment class to `skygym.Env`. ")
if str(env.__class__.__base__) == "<class 'skyrl_gym.core.Env'>":
raise TypeError(
"Gym is incompatible with skyrl_gym, please update the environment class to `skyrl_gym.Env`. "
)
else:
raise TypeError(f"The environment must inherit from the skygym.Env class, actual class: {type(env)}. ")
raise TypeError(f"The environment must inherit from the skyrl_gym.Env class, actual class: {type(env)}. ")

# Set the minimal env spec for the environment.
env.spec = EnvSpec(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from skygym.envs.base_text_env import BaseTextEnv, BaseTextEnvStepOutput, ConversationType
from skyrl_gym.envs.base_text_env import BaseTextEnv, BaseTextEnvStepOutput, ConversationType
from typing import Tuple, Any
from skygym.envs.search.utils import compute_score
from skygym.tools import SearchToolGroup
from skyrl_gym.envs.search.utils import compute_score
from skyrl_gym.tools import SearchToolGroup
import re
from typing import Dict
from omegaconf import DictConfig
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from skygym.envs.base_text_env import BaseTextEnv, BaseTextEnvStepOutput, ConversationType
from skyrl_gym.envs.base_text_env import BaseTextEnv, BaseTextEnvStepOutput, ConversationType
from typing import Tuple, Any
from skygym.tools import SearchToolGroup, PythonCodeExecutorToolGroup
from skygym.envs.gsm8k import utils
from skyrl_gym.tools import SearchToolGroup, PythonCodeExecutorToolGroup
from skyrl_gym.envs.gsm8k import utils
import re
from typing import Dict
from omegaconf import DictConfig
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from skygym.envs.base_text_env import BaseTextEnv, BaseTextEnvStepOutput, ConversationType
from skyrl_gym.envs.base_text_env import BaseTextEnv, BaseTextEnvStepOutput, ConversationType
from typing import Tuple, Any
from skygym.tools import SQLCodeExecutorToolGroup
from skyrl_gym.tools import SQLCodeExecutorToolGroup
import re
from skygym.envs.sql.utils import compute_score_single
from skyrl_gym.envs.sql.utils import compute_score_single
import os
from typing import Dict
from omegaconf import DictConfig
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion skygym/skygym/error.py → skyrl-gym/skyrl_gym/error.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Set of Error classes for skygym."""
"""Set of Error classes for skyrl_gym."""


class Error(Exception):
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from skygym.tools.core import tool, ToolGroup
from skyrl_gym.tools.core import tool, ToolGroup
import subprocess


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import time
from typing import List, Tuple, Optional, Any, Dict

from skygym.tools.core import tool, ToolGroup
from skyrl_gym.tools.core import tool, ToolGroup

logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from func_timeout import func_timeout, FunctionTimedOut
from skygym.tools.core import tool, ToolGroup
from skyrl_gym.tools.core import tool, ToolGroup
import pandas as pd
import sqlite3
import sys
Expand Down
4 changes: 2 additions & 2 deletions skygym/tests/test_gsm8k.py → skyrl-gym/tests/test_gsm8k.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import skygym
import skyrl_gym
import pytest
from omegaconf import DictConfig

Expand All @@ -13,7 +13,7 @@
],
)
def test_compute_score(output, ground_truth, expected):
env = skygym.make(
env = skyrl_gym.make(
"gsm8k",
env_config=DictConfig({"env_class": "gsm8k"}),
extras={"reward_spec": {"method": "rule", "ground_truth": ground_truth}},
Expand Down
4 changes: 2 additions & 2 deletions skygym/tests/test_lcb.py → skyrl-gym/tests/test_lcb.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
import skygym
import skyrl_gym
import json
from omegaconf import DictConfig

Expand Down Expand Up @@ -67,7 +67,7 @@ def main():
],
)
def test_compute_score(model_response, tests, expected_reward):
env = skygym.make(
env = skyrl_gym.make(
"lcb",
env_config=DictConfig({"env_class": "lcb"}),
extras={"reward_spec": {"method": "rule", "ground_truth": tests}},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import skygym
import skyrl_gym
import pytest
from omegaconf import DictConfig

Expand All @@ -12,7 +12,7 @@
],
)
def test_compute_score(output, ground_truth, expected):
env = skygym.make(
env = skyrl_gym.make(
"search",
env_config=DictConfig({"env_class": "search"}),
extras={"reward_spec": {"method": "rule", "ground_truth": {"target": ground_truth}}, "max_turns": 1},
Expand All @@ -37,7 +37,7 @@ def test_compute_score(output, ground_truth, expected):
)
def test_tool_parsing(output, parse_ground_truth, ground_truth):
# Test the parsing logic and reward logic with dummy input
env = skygym.make(
env = skyrl_gym.make(
"search",
env_config=DictConfig({"env_class": "search"}),
extras={"reward_spec": {"method": "rule", "ground_truth": {"target": ground_truth}}, "max_turns": 2},
Expand Down
Loading