Skip to content

[Proposal] Move lab_tasks gym registrations out of __init__.py #668

Closed

Description

@davis-openai

Proposal

Instead of relying on the recursive import of import_packages() in lab_tasks extension make a registry module that imports environments and registers them. Users should build environments anywhere but would register them all in the same file rather than in various places throughout the extension.

Motivation

By relying on recursive imports through the top level init.py it's not possible to import individual modules from the lab_tasks extension. For instance, if I want to extend an environment in my own extension I have to import the entire lab_tasks extension rather than the specific pieces I need.

Alternatives

  • Add registry.py top level module that does the recursive import (and modify that logic) so we can move imports out of init.py

Checklist

  • I have checked that there is no similar issue in the repo (required)

Acceptance Criteria

  • Individual modules can be imported from the lab_tasks extension without importing all extension dependencies.
  • Individual modules can be imported from the lab_tasks extension without registering all environments with gym.

Activity

  1. changed the title [-][Proposal] Move lab_tasks gym registry to standalone module instead of relying on recursive imports[/-] [+][Proposal] Move lab_tasks gym registrations out of __init__.py[/+] on Jul 10, 2024
  2. added
    enhancement
    on Jul 15, 2024
  3. animesh-garg commented on Jul 15, 2024

    @animesh-garg

    this is a very useful suggestion.
    Thanks @davis-openai

    @Mayankm96 @Dhoeller19 This change in import structure would enable lower overhead in users extending existing envs.
    Thoughts?

  4. StafaH commented on Oct 1, 2026

    @StafaH
    Collaborator

    After doing some investigations in #7966 and debating the pros and cons, we have decided not to move towards a registry.py paradigm. If there are specific use cases that would benefit from #7966 please let us know and we can revisit the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions