Skip to content

Loader registry silently overwrites loaders for the same source software #903

Description

@swagat-mishra28

While reviewing movement/io/load.py, I noticed that the loader registry
(_LOADER_REGISTRY) silently overwrites existing loaders if a loader is
registered multiple times for the same source_software.

Currently, register_loader() performs:

_LOADER_REGISTRY[source_software] = wrapper

If multiple loaders are registered for the same software (possibly across
different modules or during imports), the previous loader is silently replaced
without any warning or error.

This could make debugging difficult and lead to unexpected behavior if
duplicate registrations occur.

Possible approaches could include:

  • raising an error if a loader is already registered
  • emitting a warning before overwriting an existing loader

I'd be happy to open a PR implementing a safeguard if this behavior should be
restricted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    🤔 Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions