[feature] Import external envs (ors, verifiers)#726
Conversation
sergiopaniego
left a comment
There was a problem hiding this comment.
this is so good and unlocks a lot of ideas!
I've briefly tested it against a couple of tasks from https://huggingface.co/datasets/AdithyaSK/repo2rlenv-v083-pr_diff (generated using Repo2RLEnv), wrapping them with openreward. The deployed space is here (cc @adithya-s-k)
CC has found these 4 issues but works! 😃
1. Circular import — blocks startup completely
src/openenv/cli/importers/ors.py and verifiers.py: the top-level imports of _copy_template_directory / _create_template_replacements from openenv.cli.commands.init create a circular dependency at import time (commands.__init__ → import_env → importers → ors → commands.init). Fix: move those imports inside generate().
2. _ORS_MODULES missing real openreward import paths
src/openenv/cli/importers/ors.py, the _ORS_MODULES set: the real openreward SDK uses from openreward.environments import Environment, but neither "openreward.environments" nor "openreward.environments.environment" are in the set, so AST detection fails for real openreward environments.
3. Source filename collision with generated package name
src/openenv/cli/importers/ors.py, _wrapper_source(): the generated import_module("{source_module}") call fails if the source filename matches --name, because Python resolves it to the generated package instead of the vendored file.
4. Generated dependency is ors-sdk which doesn't exist on PyPI
src/openenv/cli/importers/ors.py, _append_dependency_files(): the importer hardcodes ors-sdk>=0.1.0 in requirements.txt and pyproject.toml, but that package doesn't exist on PyPI. Any deployment (e.g. HuggingFace Spaces) fails at build time with ModuleNotFoundError. The importer should detect which ORS SDK the source actually uses (openreward, ors, etc.) and insert the correct package name.
|
Hi @burtenshaw thanks for getting this together. I've had a play around with it this afternoon across a few of our envs and it seems to be working. I have a few comments but empirically it seems good and I think the approach is good. A few comments:
H |
|
Pushed @sergiopaniego, the branch now covers the four OpenReward/ORS issues you called out:
@henryjcee, I added dependency and data handling for imported source trees:
For the automated review items:
Validation run locally:
There are no unresolved inline review threads. The remaining HTTP/task endpoint, MCP boundary, and RFC questions are architectural alignment questions for maintainers; the mechanical blockers from the comments are addressed in this push. |
|
Follow-up: merged current |
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
|
@burtenshaw are there any examples you have tested this on? would like to have a look at them and try to reproduce |
|
@adithya-s-k added a small reproducible example in 0ec0377: It includes a tiny ORS/OpenReward-style source under uv run python examples/imported_environment/use_imported_environment.pyI also added |
This PR adds deterministic import support for third-party environment libraries and wraps imported sources as normal OpenEnv environments.
Changes:
openenv import SOURCE --name NAME --output-dir DIRwith an importer registry.tools/listandtools/callsupport for generated wrappers.