Preserve version ordering in packagedb VersionResponse
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 85/100
Research direction
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.
Written by the indexing model from the issue text.
Description
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_versionsandnewer_versionsto ordered lists - keep a small
seenset internally inget_until()for deduplication - add/update tests in
packagedb/tests/test_package_managers.py
- Dominant language
- HTML
- Stars
- 70
- Forks
- 76
- Avg merge
- 23m
- Merged PRs (30d)
- 2
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from aboutcode-org/purldb
-
purlcli failsMay be free again @Anurag-S1ngh claimed this 18 days ago, and no pull request is open. Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
aboutcode-org/purldb#891 · 2 comments ·
-
Incorrect set comparison between package names and PURLs in NPM sync logicPossibly taken @MuhammadBilal64 claimed this 45 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
aboutcode-org/purldb#890 · 1 comment ·
-
PypiVersionAPI.get_latest_date() crashes when a release entry is missing upload_time_iso_8601Possibly taken @drawliin claimed this 228 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
aboutcode-org/purldb#863 ·
-
Add doctest and tests for clearcode coordinate helpersPossibly taken @drawliin claimed this 236 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
aboutcode-org/purldb#861 ·
-
NameError: 'e' referenced outside except block in visit_uri() when visit_error is setPossibly taken @mohityadav8 claimed this 243 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
aboutcode-org/purldb#851 ·
All issues in aboutcode-org/purldb
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
hurttlocker/o8#6535 ·
-
area: backend bug priority: low
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
snapotter-hq/SnapOtter#4856 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
-
vLLM metrics adapter tests start the adapter twice and race on its request countersPossibly taken @bhargavchintam claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
llm-d/llm-d-inference-sim#933 ·
Maintainers usually reply within 2 days