File size: 1,197 Bytes
81b02bf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
"""
Compatibility shim for the historical ``openenv_core`` package.

The core runtime now lives under ``openenv.core``. Importing from the old
package path will continue to work but emits a ``DeprecationWarning`` so
downstream users can migrate at their own pace.
"""

from __future__ import annotations

import importlib
import sys
import warnings
from types import ModuleType
from typing import Dict

_TARGET_PREFIX = "openenv.core"
_TARGET_MODULE = importlib.import_module(_TARGET_PREFIX)

warnings.warn(
    "openenv_core is deprecated; import from openenv.core instead.",
    DeprecationWarning,
    stacklevel=2,
)

__all__ = getattr(_TARGET_MODULE, "__all__", [])


def __getattr__(name: str):
    return getattr(_TARGET_MODULE, name)


def __dir__():
    return sorted(set(dir(_TARGET_MODULE)))


def _alias(name: str) -> None:
    target = f"{_TARGET_PREFIX}.{name}"
    sys.modules[f"{__name__}.{name}"] = importlib.import_module(target)


for _child in (
    "client_types",
    "containers",
    "env_client",
    "env_server",
    "rubrics",
    "tools",
    "utils",
):
    try:
        _alias(_child)
    except ModuleNotFoundError:  # pragma: no cover - defensive
        continue