Skip to content

Releases: pubgrub-rs/pubgrub

v0.3.0

12 Feb 19:15
Compare
Choose a tag to compare

PubGrub 0.3 has a more flexible interface and speeds resolution significantly. The public API is very different now, we
recommend starting the migration by implementing the new DependencyProvider interface following the
Guide.

All public interfaces are now in the root of the crate.

In the main interface, DependencyProvider, choose_package_version was split into two methods: prioritize
for choosing which package to decide next by assigning a priority to each package, and choose_version. The generic
parameters became associated types. The version set is configurable by an associated type.

Dependencies gained a generic parameter for custom incompatibility type outside version conflicts, such as packages
not available for the current platform or permission errors. This type is on DependencyProvider as
DependencyProvider::M.

pubgrub::range::Range now lives in its own crate as version_ranges::Ranges. A Version can be almost any
ordered type now, it only needs to support set operations through VersionSet.

At a glance, this is the new DependencyProvider interface:

pub trait DependencyProvider {
    type P: Package;
    type V: Debug + Display + Clone + Ord;
    type VS: VersionSet<V = Self::V>;
    type M: Eq + Clone + Debug + Display;
    type Priority: Ord + Clone;
    type Err: Error + 'static;

    fn prioritize(
        &self,
        package: &Self::P,
        range: &Self::VS,
        package_conflicts_counts: &PackageResolutionStatistics,
    ) -> Self::Priority;

    fn choose_version(
        &self,
        package: &Self::P,
        range: &Self::VS,
    ) -> Result<Option<Self::V>, Self::Err>;

    fn get_dependencies(
        &self,
        package: &Self::P,
        version: &Self::V,
    ) -> Result<Dependencies<Self::P, Self::VS, Self::M>, Self::Err>;

}

v0.2.1: Mostly performance improvements

30 Jun 20:56
Compare
Choose a tag to compare

This release is focused on performance improvements and code readability, without any change to the public API.

The code tends to be simpler around tricky parts of the algorithm such as conflict resolution. Some data structures have been rewritten (with no unsafe) to lower memory usage. Depending on scenarios, version 0.2.1 is 3 to 8 times faster than 0.2.0. As an example, solving all elm package versions existing went from 580ms to 175ms on the same laptop. While solving a specific subset of packages from crates.io went from 2.5s to 320ms on the same laptop.