PypiVersionAPI.get_latest_date() crashes when a release entry is missing upload_time_iso_8601

Open Beginner friendly
#863 0 comments 0 reactions 0 assignees View on GitHub

@drawliin is already working on this.

Since Apr 4, 2026.

  • #864 by @drawliin — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
python
Domain
backend

Research direction

Open packagedb/package_managers.py and locate PypiVersionAPI.get_latest_date(). Reproduce the failure with the downloads list shown in the issue, then verify that an entry without upload_time_iso_8601 is skipped and the valid release date is still handled without an UnboundLocalError.

Written by the indexing model from the issue text.

Description

Summary

PypiVersionAPI.get_latest_date() in packagedb/package_managers.py can fail when a PyPI release entry is missing upload_time_iso_8601.

The current implementation only assigns current_date when that field is present, but still uses current_date later in the loop even when it was never set. That can raise UnboundLocalError instead of skipping the malformed entry.

Current behavior

A case like this can fail:

downloads = [
    {},
    {"upload_time_iso_8601": "2010-12-23T05:14:23.509436Z"},
]
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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from aboutcode-org/purldb

All issues in aboutcode-org/purldb

Similar issues

More Backend & API Design issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.