Control: clone -1 -2
Control: reassign -2 python3-gitlab
Control: retitle -2 python3-gitlab: Fails with Python 3.14: AttributeError: 
'Project' object has no attribute '__annotations__'
Control: block -1 by -2

On Tue, Dec 16, 2025 at 07:49:18PM +0000, Santiago Vila wrote:
During a rebuild of all packages in unstable, this package failed to build.

Below you will find the last part of the build log (probably the most
relevant part, but not necessarily). If required, the full build log
is available here:

https://people.debian.org/~sanvila/build-logs/202512/

I tried to track this down but couldn't get very far due to problems in python3-gitlab. There may be more to it than this, but it's probably best to start with the first failure, as follows:

_ ERROR at setup of 
test_gitlab_get_repository_owner_and_name[patched_os_environ0-None-None] _

example_git_https_url = 'https://example.com/example_owner/example_repo.git'

    @pytest.fixture
    def default_gl_project(example_git_https_url: str):
      return gitlab.Gitlab(url=example_git_https_url).projects.get(
            f"{EXAMPLE_REPO_OWNER}/{EXAMPLE_REPO_NAME}", lazy=True
        )

tests/unit/semantic_release/hvcs/test_gitlab.py:40:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3/dist-packages/gitlab/v4/objects/projects.py:795: in get
    return cast(Project, super().get(id=id, lazy=lazy, **kwargs))
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3/dist-packages/gitlab/exceptions.py:340: in wrapped_f
    return f(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^
/usr/lib/python3/dist-packages/gitlab/mixins.py:122: in get
    return self._obj_cls(self, {self._obj_cls._id_attr: id}, lazy=lazy)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3/dist-packages/gitlab/base.py:78: in __init__
    self._create_managers()
/usr/lib/python3/dist-packages/gitlab/base.py:204: in _create_managers
    for attr, annotation in sorted(self.__annotations__.items()):
                                   ^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Project id:example_owner%2Fexample_repo>, name = '__annotations__'

    def __getattr__(self, name: str) -> Any:
        if name in self.__dict__["_updated_attrs"]:
            return self.__dict__["_updated_attrs"][name]

        if name in self.__dict__["_attrs"]:
            value = self.__dict__["_attrs"][name]
            # If the value is a list, we copy it in the _updated_attrs dict
            # because we are not able to detect changes made on the object
            # (append, insert, pop, ...). Without forcing the attr
            # creation __setattr__ is never called, the list never ends up
            # in the _updated_attrs dict, and the update() and save()
            # method never push the new data to the server.
            # See https://github.com/python-gitlab/python-gitlab/issues/306
            #
            # note: _parent_attrs will only store simple values (int) so we
            # don't make this check in the next block.
            if isinstance(value, list):
                self.__dict__["_updated_attrs"][name] = value[:]
                return self.__dict__["_updated_attrs"][name]

            return value

        if name in self.__dict__["_parent_attrs"]:
            return self.__dict__["_parent_attrs"][name]

        message = f"{type(self).__name__!r} object has no attribute {name!r}"
        if self._created_from_list:
            message = (
                f"{message}\n\n"
                + textwrap.fill(
                    f"{self.__class__!r} was created via a list() call and "
                    f"only a subset of the data may be present. To ensure "
                    f"all data is present get the object using a "
                    f"get(object.id) call. For more details, see:"
                )
                + f"\n\n{_URL_ATTRIBUTE_ERROR}"
            )
        elif self._lazy:
            message = f"{message}\n\n" + textwrap.fill(
                f"If you tried to access object attributes returned from the server, 
"
                f"note that {self.__class__!r} was created as a `lazy` object and 
was "
                f"not initialized with any data."
            )
      raise AttributeError(message)
E       AttributeError: 'Project' object has no attribute '__annotations__'
E
E       If you tried to access object attributes returned from the server,
E       note that <class 'gitlab.v4.objects.projects.Project'> was created as
E       a `lazy` object and was not initialized with any data.. Did you mean: 
'__annotate_func__'?

/usr/lib/python3/dist-packages/gitlab/base.py:134: AttributeError

python-gitlab is now several major versions behind (#1089627), and the changes in 5.0.0 look quite relevant here:

  
https://github.com/python-gitlab/python-gitlab/blob/main/CHANGELOG.md#v500-2024-10-28

Federico, please could you upgrade python-gitlab, and then we'll see what's left in python-semantic-release?

Thanks,

--
Colin Watson (he/him)                              [[email protected]]

Reply via email to