aboutcode-org / aboutcode-org/purldb
Preserve version ordering in packagedb VersionResponse
- Lenguaje dominante
- HTML
- Estrellas
- 67
- Forks
- 69
- Merge medio
- 8 d 8 h
- PR fusionados (30 d)
- 1
Descripción
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`
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Línea de trabajo
Start in packagedb/package_managers.py at VersionAPI.get_until() and inspect how VersionResponse.valid_versions and newer_versions are built from fetch(). Then review packagedb/tests/test_package_managers.py and add or update coverage for preserving fetch order while removing duplicates; done means the response lists retain first-seen ordering and the tests pass.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python
- Área
- api, backend
- Tipo de issue
- Error
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Estado de actividad
- Tranquilo
- Claridad
- Bien especificado
- Aptitud para principiantes
- 85/100