gitsetuptoolstox

tox fails at setuptools: assert version is not None


When trying to set up a tox environment with tox -e my_env_name the setup fails:

packaging backend failed (code=1), with AssertionError: C:\github\my-package-name.tox.pkg\Lib\site-packages\setuptools_scm\version.py:84: UserWarning: tag 'c0.1.2' no version found warnings.warn(f"tag {tag!r} no version found")

[...] File "C:\github\my-package-name.tox.pkg\Lib\site-packages\setuptools_scm\version.py", line 203, in _parse_tag assert version is not None AssertionError

There is a valid version tag v0.1.2 on the commit I checked out.


Solution

  • Turns out there's not only the one valid tag at the commit but also a commit with a typo c0.1.2 additionally to v0.1.2.

    Somehow setuptools crashed because it tried to make sense of the wrong tag (c0.1.2) first.

    Deleting the wrong tag (at least locally) fixed the issue.

    Answering this here because it took me way to long to find out about the wrong tag, although the wrong tag is included in the error message.