PVP versioning requirements #31663
Closed
ysangkok
started this conversation in
Suggest an Idea
Replies: 4 comments 6 replies
-
From a Haskell point of view, this seems reasonable. Thank you for it! |
Beta Was this translation helpful? Give feedback.
0 replies
This comment has been hidden.
This comment has been hidden.
-
@secustor Is there anything I can do to advance this? |
Beta Was this translation helpful? Give feedback.
6 replies
-
Submitted PR to add what was discussed here: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
@rarkins suggested in #31493 that I detail some possible requirements for a PVP versioning module (BTW, see the FAQ, which contains a comparison with semver). The PVP scheme is widely used, so it would make sense to configure it for use as the default with the Hackage datasource, that I can also contribute (see linked thread).
I have continued working on a PVP prototype which supports a subset of the Cabal version expression syntax:
>=X.Y && <N.M
. Here are some differences to the NPM semver flavour, that I found:Major version has two components in PVP, but only one in NPM semver
Because the first two components in PVP are part of the major component, they both go into the major component, meaning that
getMajor
returns differing results:PVP accepts an arbitrary number of components
In PVP, there are versions that wouldn't even be valid NPM versions. Because
getPatch
returns a float, we can put all those digits into the float. We'd get precision issues if there are many patch digits, but I think that is an edge case that doesn't happen often.Syntax differences
Because the versioning needs to produce the new version string with
getNewVersion
, I think it might be best to use the Cabal format consistently, instead of e.g. trying to use NPM syntax (i.e. without&&
) in a PVP context.This means having e.g.
>=1.0 && <1.1
in range arguments instead of>=1.0 <1.1
.getSatisfyingVersion
In queries like these, you can see how PVP and NPM yield different results.
Why support just this Cabal expression syntax?
In the above example, we use NPM's caret syntax to try to select all compatible versions. In PVP, there is a syntax like this, called
^>=
, but I propose not supporting this at first, to start out small. Similar functionality is achievable with>= && <
and this particular syntax is popular since it allows for specifying compatibility with multiple major versions, instead of just one. Many libraries have frequent breaking changes in Haskell, e.g. the standard library, which changes in every version. It shouldn't be too difficult to support^>= 4.17 || ^>= 4.18 || ...
in the future too.Supporting an arbitrary amount of components in the lower end of the range
Sometimes, release
X.Y
has a bug, which is fixed inX.Y.Z
. A dependency bound will then be specified with the.Z
even though PVP dictates thatX.Y.W
(whereW
<Z
) is also API compatible. This shouldn't be hard to support, so I'd include this requirement. I just haven't mentioned it above because it's not controversial.getNewVersion
I'd like to wait with implementing
getNewVersion
until we have the manager in place. Is that ok?What's next?
I have a prototype that I'd like to extend with more tests. I'd like to then submit that in a PR. After we add versioning, I'd like to continue with the data source and manager (subject to discussion in #31493).
For now, my questions are: Do you have any concerns with adding PVP as a versioning scheme?
Beta Was this translation helpful? Give feedback.
All reactions