-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Currently when inserting a new release, PyPI legacy will load all of the releases for a particular project and then sort them in memory and it will then record in the database what the integer based order number is for each release. This makes it possible to sort the releases inside of the database.
Warehouse needs a solution to sorting releases inside of the database as well. Ideally this would be something that didn't require loading all of the releases, sorting, then saving all of the releases back to the database. However that is an OK solution as long as it's done using something like SQLAlchemy's event system so that the fact it's doing that is transparent to code that is adding a new release.
A better solution would be to figure out if we can somehow manage to create a PostgreSQL function that we can use to massage a PEP 440 version string into something that will naturally sort the correct way inside of PostgreSQL. Then wen can simply use that to handle our sorting.