Skip to content

Commit 341923f

Browse files
mpizenbergEh2406
authored andcommitted
release: prepare 0.2.0 (#63)
* docs(readme): update readme * docs(readme): note on friendly contribution * docs(changelog): fill v0.1.0 section * docs(changelog): fill v0.2.0 section * docs(changelog): add a summary of the release * docs(readme): everyone welcome message * docs(changelog): update unreleased diff * build(cargo.toml): add Jacob to authors * build(cargo.toml): update crate version * docs(changelog): fix unreleased diff link * docs(changelog): improve changelog Co-authored-by: Alex Tokarev <[email protected]> * docs(changelog): change ErrorShouldCancel Co-authored-by: Alex Tokarev <[email protected]> * docs(changelog): rephrasing Co-authored-by: Alex Tokarev <[email protected]> * docs(changelog): proper capitalization for GitHub Co-authored-by: Alex Tokarev <[email protected]> * docs(changelog): update v02 release date * docs(readme): use 'pink' for guide badge Co-authored-by: Alex Tokarev <[email protected]> * fix: make `cargo publish --dry-run` work Co-authored-by: Jacob Finkelman <[email protected]>
1 parent deb8f09 commit 341923f

File tree

6 files changed

+180
-34
lines changed

6 files changed

+180
-34
lines changed

.commitlintrc.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
extends:
22
- '@commitlint/config-conventional'
33

4+
# https://commitlint.js.org/#/reference-rules
45
rules:
5-
footer-max-line-length: [ 2, 'always', 72 ]
66
header-max-length: [ 2, 'always', 72 ]
7-
body-max-line-length: [ 2, 'always', 72 ]
7+
body-max-line-length: [ 1, 'always', 72 ]
8+
footer-max-line-length: [ 1, 'always', 72 ]
9+
footer-leading-blank: [ 1, 'always' ]
810
type-enum: [
911
2,
1012
'always',
@@ -16,6 +18,7 @@ rules:
1618
'fix',
1719
'perf',
1820
'refactor',
21+
'release',
1922
'revert',
2023
'style',
2124
'test',

.github/workflows/ci.yml

-1
Original file line numberDiff line numberDiff line change
@@ -111,4 +111,3 @@ jobs:
111111
uses: wagoid/commitlint-github-action@v2
112112
with:
113113
configFile: .commitlintrc.yml
114-
failOnWarnings: true

CHANGELOG.md

+137
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
## Unreleased [(diff)][diff-unreleased]
6+
7+
## [0.2.0] - 2020-11-19 - [(diff with 0.1.0)][diff-0.2.0]
8+
9+
This release brings many important improvements to PubGrub.
10+
The gist of it is:
11+
12+
- A bug in the algorithm's implementation was [fixed](https://github.com/pubgrub-rs/pubgrub/pull/23).
13+
- The solver is now implemented in a `resolve` function taking as argument
14+
an implementer of the `DependencyProvider` trait,
15+
which has more control over the decision making process.
16+
- End-to-end property testing of large synthetic registries was added.
17+
- More than 10x performance improvement.
18+
19+
### Changes affecting the public API
20+
21+
#### Added
22+
23+
- Links to code items in the code documenation.
24+
- New `"serde"` feature that allows serializing some library types, useful for making simple reproducible bug reports.
25+
- New variants for `error::PubGrubError` which are `DependencyOnTheEmptySet`,
26+
`SelfDependency`, `ErrorChoosingPackageVersion` and `ErrorInShouldCancel`.
27+
- New `type_alias::Map` defined as `rustc_hash::FxHashMap`.
28+
- New `type_alias::SelectedDependencies<P, V>` defined as `Map<P, V>`.
29+
- The types `Dependencies` and `DependencyConstraints` were introduced to clarify intent.
30+
- New function `choose_package_with_fewest_versions` to help implement
31+
the `choose_package_version` method of a `DependencyProvider`.
32+
- Implement `FromStr` for `SemanticVersion`.
33+
- Add the `VersionParseError` type for parsing of semantic versions.
34+
35+
#### Changed
36+
37+
- The `Solver` trait was replaced by a `DependencyProvider` trait
38+
which now must implement a `choose_package_version` method
39+
instead of `list_available_versions`.
40+
So it now has the ability to choose a package in addition to a version.
41+
The `DependencyProvider` also has a new optional method `should_cancel`
42+
that may be used to stop the solver if needed.
43+
- The `choose_package_version` and `get_dependencies` methods of the
44+
`DependencyProvider` trait now take an immutable reference to `self`.
45+
Interior mutability can be used by implementor if mutability is needed.
46+
- The `Solver.run` method was thus replaced by a free function `solver::resolve`
47+
taking a dependency provider as first argument.
48+
- The `OfflineSolver` is thus replaced by an `OfflineDependencyProvider`.
49+
- `SemanticVersion` now takes `u32` instead of `usize` for its 3 parts.
50+
- `NumberVersion` now uses `u32` instead of `usize`.
51+
52+
#### Removed
53+
54+
- `ErrorRetrievingVersions` variant of `error::PubGrubError`.
55+
56+
### Changes in the internal parts of the API
57+
58+
#### Added
59+
60+
- `benches/large_case.rs` enables benchmarking of serialized registries of packages.
61+
- `examples/caching_dependency_provider.rs` an example dependency provider caching dependencies.
62+
- `PackageTerm<P, V> = (P, Term<V>)` new type alias for readability.
63+
- `Memory.term_intersection_for_package(&mut self, package: &P) -> Option<&Term<V>>`
64+
- New types were introduces for conflict resolution in `internal::partial_solution`
65+
to clarify the intent and return values of some functions.
66+
Those types are `DatedAssignment` and `SatisfierAndPreviousHistory`.
67+
- `PartialSolution.term_intersection_for_package` calling the same function
68+
from its `memory`.
69+
- New property tests for ranges: `negate_contains_opposite`, `intesection_contains_both`
70+
and `union_contains_either`.
71+
- A large synthetic test case was added in `test-examples/`.
72+
- A new test example `double_choices` was added
73+
for the detection of a bug (fixed) in the implementation.
74+
- Property testing of big synthetic datasets was added in `tests/proptest.rs`.
75+
- Comparison of PubGrub solver and a SAT solver
76+
was added with `tests/sat_dependency_provider.rs`.
77+
- Other regression and unit tests were added to `tests/tests.rs`.
78+
79+
#### Changed
80+
81+
- CI workflow was improved (`./github/workflows/`), including a check for [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) and [Clippy ](https://github.com/rust-lang/rust-clippy) for source code linting.
82+
- Using SPDX license identifiers instead of MPL-2.0 classic file headers.
83+
- `State.incompatibilities` is now wrapped inside a `Rc`.
84+
- `DecisionLevel(u32)` is used in place of `usize` for partial solution decision levels.
85+
- `State.conflict_resolution` now also returns the almost satisfied package
86+
to avoid an unnecessary call to `self.partial_solution.relation(...)` after conflict resolution.
87+
- `Kind::NoVersion` renamed to `Kind::NoVersions` and all other usage of `noversion`
88+
has been changed to `no_versions`.
89+
- Variants of the `incompatibility::Relation` enum have changed.
90+
- Incompatibility now uses a deterministic hasher to store packages in its hash map.
91+
- `incompatibility.relation(...)` now takes a function as argument to avoid computations
92+
of unnecessary terms intersections.
93+
- `Memory` now uses a deterministic hasher instead of the default one.
94+
- `memory::PackageAssignments` is now an enum instead of a struct.
95+
- Derivations in a `PackageAssignments` keep a precomputed intersection of derivation terms.
96+
- `potential_packages` method now returns a `Range`
97+
instead of a `Term` for the versions constraint of each package.
98+
- `PartialSolution.relation` now takes `&mut self` instead of `&self`
99+
to be able to store computation of terms intersection.
100+
- `Term.accept_version` was renamed `Term.contains`.
101+
- The `satisfied_by` and `contradicted_by` methods of a `Term`
102+
now directly takes a reference to the intersection of other terms.
103+
Same for `relation_with`.
104+
105+
#### Removed
106+
107+
- `term` field of an `Assignment::Derivation` variant.
108+
- `Memory.all_terms` method was removed.
109+
- `Memory.remove_decision` method was removed in favor of a check before using `Memory.add_decision`.
110+
- `PartialSolution` methods `pick_package` and `pick_version` have been removed
111+
since control was given back to the dependency provider to choose a package version.
112+
- `PartialSolution` methods `remove_last_decision` and `satisfies_any_of` were removed
113+
in favor of a preventive check before calling `add_decision`.
114+
- `Term.is_negative`.
115+
116+
#### Fixed
117+
118+
- Prior cause computation (`incompatibility::prior_cause`) now uses the intersection of package terms
119+
instead of their union, which was an implementation error.
120+
121+
## [0.1.0] - 2020-10-01
122+
123+
### Added
124+
125+
- `README.md` as the home page of this repository.
126+
- `LICENSE`, code is provided under the MPL 2.0 license.
127+
- `Cargo.toml` configuration of this Rust project.
128+
- `src/` containing all the source code for this first implementation of PubGrub in Rust.
129+
- `tests/` containing test end-to-end examples.
130+
- `examples/` other examples, not in the form of tests.
131+
- `.gitignore` configured for a Rust project.
132+
- `.github/workflows/` CI to automatically build, test and document on push and pull requests.
133+
134+
[0.2.0]: https://github.com/pubgrub-rs/pubgrub/releases/tag/v0.2.0
135+
[0.1.0]: https://github.com/pubgrub-rs/pubgrub/releases/tag/v0.1.0
136+
[diff-unreleased]: https://github.com/pubgrub-rs/pubgrub/compare/release...dev
137+
[diff-0.2.0]: https://github.com/mpizenberg/elm-pointer-events/compare/v0.1.0...v0.2.0

Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22

33
[package]
44
name = "pubgrub"
5-
version = "0.1.0"
6-
authors = ["Matthieu Pizenberg <[email protected]>", "Alex Tokarev <[email protected]>"]
5+
version = "0.2.0"
6+
authors = ["Matthieu Pizenberg <[email protected]>", "Alex Tokarev <[email protected]>", "Jacob Finkelman <[email protected]>"]
77
edition = "2018"
88
description = "PubGrub version solving algorithm"
99
readme = "README.md"
1010
repository = "https://github.com/mpizenberg/pubgrub-rs"
1111
license = "MPL-2.0"
1212
keywords = ["dependency", "pubgrub", "semver", "solver", "version"]
1313
categories = ["algorithms"]
14-
include = ["Cargo.toml", "LICENSE", "README.md", "src/**", "tests/**", "examples/**"]
14+
include = ["Cargo.toml", "LICENSE", "README.md", "src/**", "tests/**", "examples/**", "benches/**"]
1515

1616
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1717

README.md

+34-28
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1-
# PubGrub version solving algorithm.
1+
# PubGrub version solving algorithm
22

3-
It consists in efficiently finding a set of packages and versions
3+
![license](https://img.shields.io/crates/l/pubgrub.svg)
4+
[![crates.io](https://img.shields.io/crates/v/pubgrub.svg?logo=rust)][crates]
5+
[![docs.rs](https://img.shields.io/badge/docs.rs-pubgrub-yellow)][docs]
6+
[![guide](https://img.shields.io/badge/guide-pubgrub-pink?logo=read-the-docs)][guide]
7+
8+
Version solving consists in efficiently finding a set of packages and versions
49
that satisfy all the constraints of a given project dependencies.
510
In addition, when that is not possible,
611
PubGrub tries to provide a very human-readable and clear
712
explanation as to why that failed.
8-
Below is an example of an explanation present in
9-
the introductory blog post about PubGrub.
13+
The [introductory blog post about PubGrub][medium-pubgrub] presents
14+
one such example of failure explanation:
1015

1116
```txt
1217
Because dropdown >=2.0.0 depends on icons >=2.0.0 and
@@ -23,37 +28,32 @@ So, because root depends on both menu >=1.0.0 and intl >=5.0.0,
2328
version solving failed.
2429
```
2530

26-
The algorithm is generic and works for any type of dependency system
31+
This pubgrub crate provides a Rust implementation of PubGrub.
32+
It is generic and works for any type of dependency system
2733
as long as packages (P) and versions (V) implement
28-
the `Package` and `Version` traits.
29-
`Package` is strictly equivalent and automatically generated
30-
for any type that implement `Clone + Eq + Hash + Debug + Display`.
31-
`Version` simply states that versions are ordered,
32-
that there should be
33-
a minimal `lowest` version (like 0.0.0 in semantic versions),
34-
and that for any version, it is possible to compute
35-
what the next version closest to this one is (`bump`).
36-
For semantic versions, `bump` corresponds to an increment of the patch number.
37-
34+
the provided `Package` and `Version` traits.
3835

39-
## API
4036

41-
```rust
42-
let solution = resolve(&dependency_provider, package, version)?;
43-
```
37+
## Using the pubgrub crate
4438

45-
Where `dependency_provider` supplies the list of available packages and versions,
46-
as well as the dependencies of every available package
47-
by implementing the `DependencyProvider` trait.
48-
The call to `resolve` for a given package at a given version
49-
will compute the set of packages and versions needed
50-
to satisfy the dependencies of that package and version pair.
51-
If there is no solution, the reason will be provided as clear as possible.
39+
A [guide][guide] with both high-level explanations and
40+
in-depth algorithm details is available online.
41+
The [API documentation is available on docs.rs][docs].
42+
A version of the [API docs for the unreleased functionality][docs-dev] from `dev` branch is also
43+
accessible for convenience.
5244

5345

5446
## Contributing
5547

56-
Discussion and development happens here on github and on our [Zulip stream](https://rust-lang.zulipchat.com/#narrow/stream/260232-t-cargo.2FPubGrub). Please join in!
48+
Discussion and development happens here on GitHub and on our
49+
[Zulip stream](https://rust-lang.zulipchat.com/#narrow/stream/260232-t-cargo.2FPubGrub).
50+
Please join in!
51+
52+
Remember to always be considerate of others,
53+
who may have different native languages, cultures and experiences.
54+
We want everyone to feel welcomed,
55+
let us know with a private message on Zulip if you don't feel that way.
56+
5757

5858
## PubGrub
5959

@@ -66,12 +66,18 @@ An introductory blog post was
6666
[published on Medium][medium-pubgrub] by its author.
6767

6868
The detailed explanation of the algorithm is
69-
[provided on GitHub][github-pubgrub].
69+
[provided on GitHub][github-pubgrub],
70+
and complemented by the ["Internals" section of our guide][guide-internals].
7071
The foundation of the algorithm is based on ASP (Answer Set Programming),
7172
and a book called
7273
"[Answer Set Solving in Practice][potassco-book]"
7374
by Martin Gebser, Roland Kaminski, Benjamin Kaufmann and Torsten Schaub.
7475

76+
[crates]: https://crates.io/crates/pubgrub
77+
[guide]: https://pubgrub-rs-guide.netlify.app/
78+
[guide-internals]: https://pubgrub-rs-guide.netlify.app/internals/intro.html
79+
[docs]: https://docs.rs/pubgrub
80+
[docs-dev]: https://pubgrub-rs.github.io/pubgrub/pubgrub/
7581
[medium-pubgrub]: https://medium.com/@nex3/pubgrub-2fb6470504f
7682
[github-pubgrub]: https://github.com/dart-lang/pub/blob/master/doc/solver.md
7783
[potassco-book]: https://potassco.org/book/

src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@
206206
//! with a cache, you may want to know that some versions
207207
//! do not exist in your cache.
208208
209+
#![allow(clippy::rc_buffer)]
209210
#![warn(missing_docs)]
210211

211212
pub mod error;

0 commit comments

Comments
 (0)