With scriv==1.3.1, running collection on a changelog that includes a heading that does not contain a valid Version (as defined by scriv.util) produces a fairly obscure error.
$ scriv collect --keep --version 1.1
Collecting from changelog.d
Reading changelog CHANGELOG.md
Traceback (most recent call last):
File "/home/snoopjedi/repos/scriv-src/.direnv/python-3.7.16/bin/scriv", line 8, in <module>
sys.exit(cli())
File "/home/snoopjedi/repos/scriv-src/.direnv/python-3.7.16/lib/python3.7/site-packages/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
File "/home/snoopjedi/repos/scriv-src/.direnv/python-3.7.16/lib/python3.7/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
File "/home/snoopjedi/repos/scriv-src/.direnv/python-3.7.16/lib/python3.7/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/snoopjedi/repos/scriv-src/.direnv/python-3.7.16/lib/python3.7/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/snoopjedi/repos/scriv-src/.direnv/python-3.7.16/lib/python3.7/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
File "/home/snoopjedi/repos/scriv-src/.direnv/python-3.7.16/lib/python3.7/site-packages/scriv/collect.py", line 74, in collect
if eversion == version:
File "/home/snoopjedi/repos/scriv-src/.direnv/python-3.7.16/lib/python3.7/site-packages/scriv/util.py", line 96, in __eq__
return this.lstrip("v") == that.lstrip("v")
AttributeError: 'NoneType' object has no attribute 'lstrip'
The error is slightly less obscure against main (58fae87), but still confusing:
$ scriv collect --keep --version 1.1
Collecting from changelog.d
Reading changelog CHANGELOG.md
Traceback (most recent call last):
File "/home/snoopjedi/repos/scriv-src/.direnv/python-3.7.16/bin/scriv", line 11, in <module>
load_entry_point('scriv', 'console_scripts', 'scriv')()
File "/home/snoopjedi/repos/scriv-src/.direnv/python-3.7.16/lib/python3.7/site-packages/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
File "/home/snoopjedi/repos/scriv-src/.direnv/python-3.7.16/lib/python3.7/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
File "/home/snoopjedi/repos/scriv-src/.direnv/python-3.7.16/lib/python3.7/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/snoopjedi/repos/scriv-src/.direnv/python-3.7.16/lib/python3.7/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/snoopjedi/repos/scriv-src/.direnv/python-3.7.16/lib/python3.7/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
File "/home/snoopjedi/repos/scriv-src/src/scriv/collect.py", line 74, in collect
if eversion == version:
File "/home/snoopjedi/repos/scriv-src/src/scriv/util.py", line 91, in __eq__
assert isinstance(other, Version)
AssertionError
The problem here is the Older versions heading in the CHANGELOG.md, adding <!-- scriv-end-here --> above this heading avoids the issue, but it would be nice if scriv gave a more explicit report about what went wrong in this case.
Reproduction
These files should be all that is needed to reproduce the above errors.
Description
With
scriv==1.3.1
, running collection on a changelog that includes a heading that does not contain a validVersion
(as defined byscriv.util
) produces a fairly obscure error.The error is slightly less obscure against
main
(58fae87), but still confusing:The problem here is the
Older versions
heading in theCHANGELOG.md
, adding<!-- scriv-end-here -->
above this heading avoids the issue, but it would be nice ifscriv
gave a more explicit report about what went wrong in this case.Reproduction
These files should be all that is needed to reproduce the above errors.
Notes
I discovered this on Python 3.7 but I believe it applies to all supported versions.