Closed ghassanmas closed 1 year ago
Can you give me more details about a specific failure case? PEP 440 says to ignore the leading "v" when comparing version numbers, but I would think anyone using scriv would either have a "v" everywhere, or have it nowhere. How is Tutor using versions numbers, and what problem is scriv causing?
The probelm comes when scriv
not detecting that a version arleady exits in the chaneloge entries, the way to reproduce is
scriv create && scrive collect
X times would lead X duplicate entries in changelog filescriv
to python based package. Regarding PEP 440, if I understood correctly for that PEP v.1.2.3 == 1.2.3, and then as I understood when normalizing a version it should be stripped.
When I used the referred package from the same PEP 440 it sripped the v
>>> from packaging import version
>>> version.parse('v1.2.3')
<Version('1.2.3')>
>>> version.parse('1.2.3')
<Version('1.2.3')>
Why not put the "v" character into the __version__
string? Wouldn't it compare correctly then?
CC: @regisb
In the context of Tutor: the __version__
string is used sometimes with and without a preceding "v". For instance, the Changelog titles include "v". But the releases that are pushed to pypi do not include "v". And in many places of the tutor code base, we make use of the Tutor version without the preceding "v".
So we can't really include the preceding "v" in tutor.about.__version__
. We can however modify the scriv configuration to include the prefix in the {{ version }}
. We would have to concatenate a literal
with a string -- is this possible?
Alternatives include:
<a id='changelog-X.Y.Z'></a>
field from the changelog instead of the title.VERSION_REGEX
, for instance using a named expression.Sidenote: while writing this issue, I realized that the {{ version }}
that is included in a GitHub release template is not the same as the scriv version
, but it is sampled from the changelog title -- so it does include the "v" prefix. Is there a reason why the scriv github-release
command is not fetching the version from the scriv configuration file?
This is now released as part of scriv 1.3.1.
Is there a reason why the scriv github-release command is not fetching the version from the scriv configuration file?
Yes, so that it can be used even on projects that don't use scriv to create their changelog (like coverage.py).
Awesome, thanks!
The util
extract_version
function is not ignoring a preceding 'v' when existsIs this intentional ? hence in testing it expect to keep it https://github.com/nedbat/scriv/blob/d86dc040390e5cc136c5260ead35eae2d5f8ee69/tests/test_util.py#L11
Following the linked PEP 0440 it says it should be removed ref
This would lead to not detecting if a version already exists in the entries because 'version' would be
x.y.z
whileeverion
would bevx.y.z
v
exists in the tempalte of the entry, e.g. the pattern followed in tutorThis would lead to
scriv
failing the following condition: https://github.com/nedbat/scriv/blob/d86dc040390e5cc136c5260ead35eae2d5f8ee69/src/scriv/collect.py#L74https://github.com/nedbat/scriv/blob/d86dc040390e5cc136c5260ead35eae2d5f8ee69/src/scriv/util.py#L53-L72