Skip to content

Allow users to bypass deepcopy in from_dict methods #453

@lossyrob

Description

@lossyrob

As described in stac-utils/pystac-client#49, a lot of time is spent in the deepcopy for a large Item dict when deserializing to a pystac.Item. The deepcopy is done to avoid mutating the parameter dict, which I think is good practice, but also wholly unnecessary when you've just created the dict from e.g. reading from a file or deserializing from a HTTP response and are not planning on using the dict any further. In these cases, the deepcopy is only a performance hit with no benefit.

The goal of this issue is to introduce a parameter to to_dict methods that allow users to avoid copying the dict. This should be used in PySTAC codepaths such as from_file methods where the incoming dict is a temporary data structure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions