vulnerablecode icon indicating copy to clipboard operation
vulnerablecode copied to clipboard

Update version ordering for packages

Open Rishi-source opened this issue 1 year ago • 0 comments

Issue: #1549

Hey everyone, this pull request brings a few key improvements to how we handle package versions. Here’s what’s new:

Version Handling Improvements:

introduced a new Version Handler class to make version parsing much more reliable and standardized. It now covers:

Date-based versions like YYYY-MM-DD. Versions that have underscores (e.g., 1.2.3_4). Versions with build metadata like 1.2.3-alpha. Even Git commit hashes (those long 40-character strings).

This will help us ensure package versions are consistently and accurately ordered.

Batch Processing:

We’ve added batch processing for updating packages, with a default batch size of 1,000. This means we can process larger datasets without slowing things down. The command goes through each package batch-by-batch and updates the version_order and is_pre_release fields to maintain consistency.

Error Handling:

Improved the error handling for invalid version strings. We’re now better at logging and identifying problematic versions, which should make debugging easier.

Pre-Release Flag Identification:

We’ve also improved how we identify pre-release versions, so it’s clearer which versions are stable and which are still in the pre-release phase.

How to Run:

  1. You can first Run command python manage.py update_packages so that it can create a version order for all the existing entries.
  2. Then you can Clearly see that now the packages is sorted on the basis of the version.If you add a new version entry for a same package then it would adjust the version order in some float value accordingly.

Rishi-source avatar Oct 13 '24 10:10 Rishi-source