NowanIlfideme / pydantic-yaml

YAML support for Pydantic models

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Something is wrong with the semver package

apirogov opened this issue · comments

I have two venvs, in one of those I get:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/local/home/a.pirogov/.local/share/virtualenvs/irdm-dev-e7pFVQEY/lib/python3.9/site-packages/pydantic_yaml/__init__.py", line 20, in <module>
    from .main import (
  File "/local/home/a.pirogov/.local/share/virtualenvs/irdm-dev-e7pFVQEY/lib/python3.9/site-packages/pydantic_yaml/main.py", line 24, in <module>
    from .ext.semver import SemVer
  File "/local/home/a.pirogov/.local/share/virtualenvs/irdm-dev-e7pFVQEY/lib/python3.9/site-packages/pydantic_yaml/ext/semver.py", line 6, in <module>
    from semver import VersionInfo
ImportError: cannot import name 'VersionInfo' from 'semver' (/local/home/a.pirogov/.local/share/virtualenvs/irdm-dev-e7pFVQEY/lib/python3.9/site-packages/semver/__init__.py)

In the other one everything is fine.

In both environments I have semver 2.13.0

but if I open the installed files, the code is different. So something looks very wrong to me and I have no idea where to even start looking (I also did multiple reinstalls of the package with disabled caching, I have no ideas anymore).

Could the versioning feature of pydantic_yaml be optional? I don't need it anyway, but now I am stuck with a problem with the semver package :(

Ok I figured out the issue in my case... It was a very unfortunate collision of semver package and node-semver package in an old version where it used the same module namespace semver. So I guess there is nothing intrinsically problematic with semver here. Apparently I ran into "undefined behavior" due to module name clashing.

Whether it should be optional or not is a different question. In any case, sorry for the confusion.

Alright, thanks for the update. I think the semver part should indeed be optional. I wonder what portion of users actually import that feature...

FYI this was fixed by #39, thanks @mustafasoylu 😄

Available as of 0.11.1