nazrulworld / fhir.resources

FHIR Resources https://www.hl7.org/fhir/resourcelist.html
https://pypi.org/project/fhir.resources/
Other
365 stars 104 forks source link

Restrict Pydantic to <2.0.0 #134

Closed anmolmittal1 closed 1 year ago

anmolmittal1 commented 1 year ago

Description

Latest version errors out as it is trying to install pydantic v2 which includes some breaking changes. https://github.com/nazrulworld/fhir.resources/blob/main/setup.py#L20 - min version is restricted but please add max version cap to <2.0.0 as well

What I Did

Relevant traceback

<redacted>: in <module>
    from fhir.resources.bundle import Bundle
/usr/local/lib/python3.7/dist-packages/ddtrace/internal/module.py:220: in _exec_module
    self.loader.exec_module(module)
/usr/local/lib/python3.7/dist-packages/fhir/resources/__init__.py:5: in <module>
    from fhir.resources.core.fhirabstractmodel import FHIRAbstractModel
/usr/local/lib/python3.7/dist-packages/ddtrace/internal/module.py:220: in _exec_module
    self.loader.exec_module(module)
/usr/local/lib/python3.7/dist-packages/fhir/resources/core/fhirabstractmodel.py:13: in <module>
    from pydantic.class_validators import ROOT_VALIDATOR_CONFIG_KEY, root_validator
E   ImportError: cannot import name 'ROOT_VALIDATOR_CONFIG_KEY' from 'pydantic.class_validators' (/usr/local/lib/python3.7/dist-packages/pydantic/class_validators.py)
nazrulworld commented 1 year ago

Relevant issue is https://github.com/nazrulworld/fhir.resources/issues/133 | I think we should move with Pydantic v2.X. For now unfortunately you have to self restrict lower version pydantic until we make a minor release.

anmolmittal1 commented 1 year ago

@nazrulworld I have restricted the pydantic version manually for my use case currently. I also agree with the move to Pydantic v2 as it brings in a lot of performance improvements but created this issue as the package would be breaking for a lot of users who have not locked their pydantic version. Hopefully we can get a quick minor/patch release with pydantic v1 cap for now!

nazrulworld commented 1 year ago

https://pypi.org/project/fhir.resources/7.0.2/