From 8c27f9b42c945c0e8896cc9843244fa57fc3734f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Frederik=20L=C3=A9ger?= Date: Tue, 10 Feb 2026 11:13:44 +0100 Subject: [PATCH] fix(types): add explicit submodule import for pyright compatibility Add `import gitlab.base` inside the TYPE_CHECKING block in repositories.py so that pyright can resolve `gitlab.base.RESTObject`. Without the explicit import, pyright cannot resolve the submodule access via the parent package (implicit submodule access is a runtime loader side effect that type checkers don't model). This caused `_RestObjectBase` to be `Unknown`, propagating through `RepositoryMixin` into `Project` and other classes. Fixes python-gitlab/python-gitlab#3342 Co-Authored-By: Claude Opus 4.6 --- gitlab/v4/objects/repositories.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gitlab/v4/objects/repositories.py b/gitlab/v4/objects/repositories.py index 71935caaa..a621cda43 100644 --- a/gitlab/v4/objects/repositories.py +++ b/gitlab/v4/objects/repositories.py @@ -17,6 +17,8 @@ if TYPE_CHECKING: # When running mypy we use these as the base classes + import gitlab.base + _RestObjectBase = gitlab.base.RESTObject else: _RestObjectBase = object