Skip to content

Use dataclasses for all objects returned by HfApi #1911

Closed
@mariosasko

Description

@mariosasko

Currently, we use TypedDict to represent some of the objects' attributes returned by the HfApi methods. To be consistent, we should only use dataclasses, as suggested in #1809 (comment):

I think we should open a separate PR to switch all of them (BlobLfsInfo, LastCommitInfo, BlobSecurityInfo, TransformersInfo, SafeTensorsInfo) to dataclasses, in a backward compatible way (and with a deprecation warning when dict-only method is used). This way we'll finally have a single type to represent data returned by the server (now that you've removed ReprMixin).

This work can be split in several PRs to make it easier to implement and review.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions