__init__.py 754 B

12345678910111213141516171819202122232425
  1. from __future__ import annotations
  2. from minigrid.envs.wfc.config import (
  3. WFC_PRESETS,
  4. WFC_PRESETS_INCONSISTENT,
  5. WFC_PRESETS_SLOW,
  6. WFCConfig,
  7. )
  8. # This is wrapped in a try-except block so the presets can be accessed for registration
  9. # Otherwise, importing here will fail when networkx is not installed
  10. try:
  11. from minigrid.envs.wfc.wfcenv import WFCEnv
  12. except ImportError:
  13. class WFCEnv:
  14. """Dummy class to give a helpful error message when dependencies are missing"""
  15. def __init__(self, *args, **kwargs):
  16. from gymnasium.error import DependencyNotInstalled
  17. raise DependencyNotInstalled(
  18. 'WFC dependencies are missing, please run `pip install "minigrid[wfc]"`'
  19. )