Skip to content

Preserve version ordering in packagedb VersionResponse #857

Description

@drawliin

While looking at packagedb/package_managers.py, I noticed that VersionAPI.get_until() builds VersionResponse.valid_versions and newer_versions using sets.

That means duplicates are removed, but the original version order from fetch() is also lost.

There is already a related note in the file:

# FIXME: DO NOT use set() for storing version lists: they lose the original ordering

I think this should preserve fetch order while still deduplicating values.

A possible fix would be:

  • change valid_versions and newer_versions to ordered lists
  • keep a small seen set internally in get_until() for deduplication
  • add/update tests in packagedb/tests/test_package_managers.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions