Repository: yanyongyu/githubkit (language: python)

Issue:
Github Enterprise API causes type import errors
Using the ghec version of the api causes "cannot import name" issues across the entirety of the model data.


Discussion / hints:
I've investigated it a bit more and it appears as though the issue is due to the runtime failing to resolve the symbols from the ghec variant, although I can not figure out any reason why it should fail, considering the code is pretty much identical.

The failure also is reproducable simply by importing any of the models from the ghec variant.
Could you please provide your reproduce code and the error message?
Unfortunately, the code itself is under NDA, but I can provide a snippet that is capable of reproducting the bug.

As little as

`from githubkit.versions.ghec_v2022_11_28.models import Runner`

will cause

`ImportError: cannot import name 'Runner' from 'githubkit.versions.ghec_v2022_11_28.models' ([path to __init__.py])`
I can reproduce this error. It's due to a stupid error that i forget adding the module to lazy loading list :joy:

Fix patch:
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index a407a3dd3..ffe961422 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -21,12 +21,6 @@ repos:
       - id: ruff-format
         stages: [commit]
 
-  - repo: https://github.com/pre-commit/mirrors-prettier
-    rev: v4.0.0-alpha.8
-    hooks:
-      - id: prettier
-        stages: [commit]
-
   - repo: https://github.com/nonebot/nonemoji
     rev: v0.1.4
     hooks:
diff --git a/githubkit/lazy_module.py b/githubkit/lazy_module.py
index 838f6530a..7a93dc138 100644
--- a/githubkit/lazy_module.py
+++ b/githubkit/lazy_module.py
@@ -9,11 +9,12 @@
 
 LAZY_MODULES = (
     r"^githubkit\.rest$",
-    r"^githubkit\.versions\.v[^.]+\.models$",
-    r"^githubkit\.versions\.v[^.]+\.webhooks$",
-    r"^githubkit\.versions\.latest\.models$",
-    r"^githubkit\.versions\.latest\.types$",
-    r"^githubkit\.versions\.latest\.webhooks$",
+    r"^githubkit\.versions\.[^.]+\.models$",
+    r"^githubkit\.versions\.[^.]+\.types$",
+    r"^githubkit\.versions\.[^.]+\.webhooks$",
+    # r"^githubkit\.versions\.latest\.models$",
+    # r"^githubkit\.versions\.latest\.types$",
+    # r"^githubkit\.versions\.latest\.webhooks$",
 )
 
 


Test patch:
diff --git a/tests/test_versions/test_models.py b/tests/test_versions/test_models.py
new file mode 100644
index 000000000..eb2d1aa7d
--- /dev/null
+++ b/tests/test_versions/test_models.py
@@ -0,0 +1,9 @@
+from githubkit.versions.latest.models import (  # noqa: F401
+    SimpleUser as SimpleUserLatest,
+)
+from githubkit.versions.v2022_11_28.models import (  # noqa: F401
+    SimpleUser as SimpleUserV2022_11_28,
+)
+from githubkit.versions.ghec_v2022_11_28.models import (  # noqa: F401
+    SimpleUser as SimpleUserGhecV2022_11_28,
+)
diff --git a/tests/test_versions/test_types.py b/tests/test_versions/test_types.py
new file mode 100644
index 000000000..ecdeb49ef
--- /dev/null
+++ b/tests/test_versions/test_types.py
@@ -0,0 +1,9 @@
+from githubkit.versions.latest.types import (  # noqa: F401
+    SimpleUserType as SimpleUserLatestType,
+)
+from githubkit.versions.v2022_11_28.types import (  # noqa: F401
+    SimpleUserType as SimpleUserV2022_11_28Type,
+)
+from githubkit.versions.ghec_v2022_11_28.types import (  # noqa: F401
+    SimpleUserType as SimpleUserGhecV2022_11_28Type,
+)