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

Errors from Pydantic 1.8 #63

Closed
brockfanning opened this issue Feb 27, 2021 · 6 comments
Closed

Errors from Pydantic 1.8 #63

brockfanning opened this issue Feb 27, 2021 · 6 comments

Comments

@brockfanning
Copy link

I haven't dug into this yet, but I thought I would post this while it's fresh in my mind. I tried upgrading to the latest code, and I get an error just from an "import sdmx" statement, without initializing anything. Here is a trace:

Traceback (most recent call last):
  File "foo.py", line 1, in <module>
    import sdmx
  File "/home/brockfanning/repos/sdg-data-rwanda/venv/lib/python3.8/site-packages/sdmx/__init__.py", line 5, in <module>
    from sdmx.client import Client, Request, read_url
  File "/home/brockfanning/repos/sdg-data-rwanda/venv/lib/python3.8/site-packages/sdmx/client.py", line 8, in <module>
    from sdmx.message import Message
  File "/home/brockfanning/repos/sdg-data-rwanda/venv/lib/python3.8/site-packages/sdmx/message.py", line 15, in <module>
    from sdmx import model
  File "/home/brockfanning/repos/sdg-data-rwanda/venv/lib/python3.8/site-packages/sdmx/model.py", line 188, in <module>
    class Annotation(BaseModel):
  File "pydantic/main.py", line 287, in pydantic.main.ModelMetaclass.__new__
  File "pydantic/fields.py", line 384, in pydantic.fields.ModelField.infer
  File "pydantic/fields.py", line 369, in pydantic.fields.ModelField._get_field_info
  File "pydantic/fields.py", line 157, in pydantic.fields.FieldInfo._validate
  File "/home/brockfanning/repos/sdg-data-rwanda/venv/lib/python3.8/site-packages/sdmx/model.py", line 166, in __eq__
    return self.localizations == other.localizations
AttributeError: 'UndefinedType' object has no attribute 'localizations'

Where "foo.py" is this:

import sdmx

print('Hello world')
@brockfanning brockfanning changed the title Errors on importing in 2.2.0 Errors on importing Feb 27, 2021
@brockfanning
Copy link
Author

Actually this seems to happen no matter what version I use - so maybe there is a problem in some other project. I'm still investigating.

@brockfanning
Copy link
Author

Ah ok, I think the problem is coming from the pydantic library, which released a new version yesterday. If I pin to the previous version of pydantic, it works fine:

sdmx1==2.2.0
pydantic==1.7.3

@brockfanning brockfanning changed the title Errors on importing Errors from Pydantic 1.8 Feb 27, 2021
@khaeru
Copy link
Owner

khaeru commented Feb 27, 2021

I merged #62 and released v2.2.1 to address this. Have you tried with that version?

I also filed pydantic/pydantic#2422, which the maintainers there have already fixed, though no timeline on when they'll release ≥ 1.8.1 containing the fix. When it's in, I'll check and remove the exclusion.

@brockfanning
Copy link
Author

@khaeru Cool - has 2.2.1 been uploaded to the package manager? I can't seem to access with sdmx1==2.2.1. Should I just pin to its tag in Github for now?

@khaeru
Copy link
Owner

khaeru commented Feb 27, 2021

Sorry—I'd pushed the RC tag, but not the final one. It's on PyPI now—https://pypi.org/project/sdmx1/#history —please try again.

@brockfanning
Copy link
Author

Great, that fixed it, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants