Skip to content

Libdoc does not work with new Secret type #5520

Closed

Description

@aaltat

If I have my_lib.py library:

from robot.api.types import Secret

def mask_secrets(data: Secret):
    print(f"Masked secret: {data}")
    return data

And use libdoc:

> libdoc my_lib.py lib.html
Building library 'my_lib.py' failed: AttributeError: 'NoneType' object has no attribute 'lower'

Try --help for usage information.

If I use bridseye https://birdseye.readthedocs.io/en/latest/index.html I see

Traceback (most recent call last):
  File "/Users/tatuaalto/workspace/tmp/.venv/lib/python3.12/site-packages/robot/libdocpkg/builder.py", line 101, in _build
    return builder.build(source)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/tatuaalto/workspace/tmp/.venv/lib/python3.12/site-packages/robot/libdocpkg/robotbuilder.py", line 49, in build
    libdoc.type_docs = self._get_type_docs(
                       ^^^^^^^^^^^^^^^^^^^^
  File "/Users/tatuaalto/workspace/tmp/.venv/lib/python3.12/site-packages/robot/libdocpkg/robotbuilder.py", line 82, in _get_type_docs
    all_type_docs.setdefault(type_doc, set()).add(kw.name)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/tatuaalto/workspace/tmp/.venv/lib/python3.12/site-packages/robot/utils/sortable.py", line 49, in __hash__
    return hash(self._sort_key)
                ^^^^^^^^^^^^^^
  File "/Users/tatuaalto/workspace/tmp/.venv/lib/python3.12/site-packages/robot/libdocpkg/datatypes.py", line 54, in _sort_key
    return self.name.lower()
           ^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'lower'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/tatuaalto/workspace/tmp/.venv/lib/python3.12/site-packages/robot/libdoc.py", line 203, in main
    libdoc = LibraryDocumentation(lib_or_res, name, version, docformat)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/tatuaalto/workspace/tmp/.venv/lib/python3.12/site-packages/robot/libdocpkg/builder.py", line 56, in LibraryDocumentation
    libdoc = DocumentationBuilder().build(library_or_resource)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/tatuaalto/workspace/tmp/.venv/lib/python3.12/site-packages/robot/libdocpkg/builder.py", line 80, in build
    return self._build(builder, source)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/tatuaalto/workspace/tmp/.venv/lib/python3.12/site-packages/robot/libdocpkg/builder.py", line 117, in _build
    raise DataError(
robot.errors.DataError: Building library 'my_lib.py' failed: AttributeError: 'NoneType' object has no attribute 'lower'

When I set @eye decorator to main https://github.com/robotframework/robotframework/blob/master/src/robot/libdoc.py#L185

Activity

  1. added 2 commits that reference this issue on Oct 18, 2025
    0e2678d
    4148663
  2. added theissue type on Oct 19, 2025
  3. changed the issue type fromtoon Oct 19, 2025
  4. changed the title [-]libdoc does not work if Secret is type hint with RF 7.4[/-] [+]Libdoc does not work with new Secret type[/+] on Oct 19, 2025
  5. added this to the v7.4 milestone on Oct 19, 2025
  6. pekkaklarck commented on Oct 19, 2025

    @pekkaklarck
    Member

    Good catch. It was a bad omission by us that we didn't test Libdoc as part of #4537, but good that this was noticed before the final release. I wonder is this important enough to warrant beta 2 or can it wait for the release candidate.

    I gave this a "task" label to not get listed in the release notes. It would make sense to include it in the beta/rc notes, but not anymore in the final release, but we don't have labels for that purpose. We can discuss that when we look at the Rellu tool at some point.

  7. aaltat commented on Oct 19, 2025

    @aaltat
    ContributorAuthor

    I think this does not warrant for beta 2, but making beta 2 for the standard library type annotations might be good idea. Although release candidate might be also good idea too.

  8. pekkaklarck commented on Oct 19, 2025

    @pekkaklarck
    Member

    Agreed. Let's see what's the status of the other issues and see is beta 2 or rc 1 next. I haven't been able to work much during this school holiday week (especially when our 2yo was also sick) but hopefully next week is better in that regard.

  9. added a commit that references this issue on Oct 19, 2025
    648c45f
  10. added a commit that references this issue on Nov 26, 2025
    ec41551
  11. changed the issue type fromtoon Dec 2, 2025
  12. added
    no notes
    on Dec 2, 2025
  13. changed the issue type fromtoon Dec 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

beta 2effort: smallno notespriority: critical

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions