Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'NoneType' object has no attribute 'groups' if tag has the wrong syntax #471

Closed
plijnzaad opened this issue Aug 13, 2020 · 4 comments

Comments

@plijnzaad
Copy link

(I created this issue over in the setuptools repo (see https://github.com/pypa/setuptools/issues/2326 ) but I realize that it should actually be here, sorry)

I happened to have a git tag of the wrong syntax, namely 2.0.0-alpha.5-PMC, leading to the above error. It was very difficult to track down for a lowly end-user of a package (atropos) that uses it, and which I forked in order to fix a few things. I did not know that tags were needed, let alone be of a very specific shape (and 2.0.0-alpha.5-PMC is not that extreme, right?) .

I have appended the stdout and stderr before git tag --delete 2.0.0-alpha.5-PMC (std*-bad.txt) and after deleting the offending tag (std*-good.txt) (done with export SETUPTOOLS_SCM_DEBUG=verbose)

stdout-bad.txt
stderr-bad.txt

stdout-good.txt
stderr-good.txt

I tried various older versions of setuptools-scm (back to 2.0.0 I recall correctly), all had the same or similar problem. I see several reports of people having similar trouble so it appears to be a general problem and one that occurs more often. I would love if this were more robust, i.e. I'd much rather have a version string 'unknown' or somesuch than a package that refuses to install ...

Cheers,
P

@plijnzaad
Copy link
Author

Actually, where can I find the default syntax rules (with examples) for release tags? I can't figure out why 2.0.0-alpha.5-PMC is not allowed (well, it's not even clear it's not allowed, it just crashes), and alternatively what would be allowed instead (short of trying by trial and error)

@RonnyPfannschmidt
Copy link
Contributor

https://github.com/pypa/setuptools_scm/blob/master/src/setuptools_scm/config.py#L9 has the default stuff

for something thats clearly not a valid python package version number we should have a better error

@plijnzaad
Copy link
Author

Thanks for digging this up! However my offending tag 2.0.0-alpha.5-PMC matches this regexp, so something else is wrong. And it would be nice if the tag syntax were documented somewhere more prominent :-)

@RonnyPfannschmidt
Copy link
Contributor

@plijnzaad thanks for calling me out, now that i'm looking a closer look i'm seeing what i missed

https://github.com/pypa/setuptools_scm/blob/1c8bb50e90520a39279f213706ad69b4f180fea1/src/setuptools_scm/version.py#L214-L235

the default implementation for version bumping is too simplicistic and completely falls appart with propperly finding the point where to add a number

setuptools_scm should warn/error in a more comprehensible way when the version that is still "accepted" is not actually handleable by the bump helper itself

if you have a tool for determining the next version you can hook it in

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment