-
Notifications
You must be signed in to change notification settings - Fork 274
Closed
Labels
backlogImportant but currently unprioritizedImportant but currently unprioritizedcleanupCode hygiene and cleanupCode hygiene and cleanup
Description
The Ecosystem class is confusing to use:
- It has abstract methods
sort_keyandenumerate_versionsthat are not required to be implemented (but must be overwritten with a function that raises aNotImplementedError) - To check whether these are implemented, the respective (and poorly named)
supports_comparingandsupports_orderingproperties must be manually implemented & checked.
In my opinion, it would be better to have a few interfaces:
Ecosystem(), a replacement for the currentOrderingUnsupportedEcosystem, with whatever base things are neededComparableEcosystem(Ecosystem, ABC), which are ecosystems which we can create orderings of version strings (i.e. which implementsort_key)EnumerableEcosystem(ComparableEcosystem), which are ecosystems which we can find all concrete versions for (i.e. which implementenumerate_versions)
With this, we could replace the supports_x properties with isinstance calls. It also would make reusing logic for ecosystems which use the same versioning scheme but have different enumerations (e.g. APK/RPM ecosystems #3431)
Metadata
Metadata
Assignees
Labels
backlogImportant but currently unprioritizedImportant but currently unprioritizedcleanupCode hygiene and cleanupCode hygiene and cleanup