Code Monkey home page Code Monkey logo

Comments (5)

dsinghvi avatar dsinghvi commented on August 12, 2024

Hey @lucasgadams -- We've intentionally kept the library to use pydantic.v1 so that the SDK can leverage both pydantic V1 and V2 depending on the consumer's dependency. Once Merge no longer cares about supporting v1 users, we can upgrade the dependency.

Would be helpful to understand the specific issues you are running into as you try to leverage the v1 models and we can share solutions on a case-by-case basis.

from merge-python-client.

andersskog avatar andersskog commented on August 12, 2024

Running into some issues caused by mergepythonclient -> Pydantic V1 today -- pydantic/pydantic#9607.

Think this highlights that attempting to migrate to Pydantic 2.0 can be helpful for stability. Our entire backend is blocked from deployment cause of this pydantic V1 dependency.

On some use-cases that we might like to do, one example is to extend a Merge class with fields that are based on other Pydantic models (V2).

from merge-python-client.

lucasgadams avatar lucasgadams commented on August 12, 2024

While the specific issue noted with pydantic 1.0 not being compatible with python 3.12.4 has been resolved, we are still having broader trouble with the use of v1 pydantic models in our code base. Basically we utilize the merge pydantic objects in various ways, and specifically might wrap them in other pydantic classes or use them as fields in other pydantic classes. Like:

class MergeDocument(BaseModel):  # A v2 pydantic model
    info: File  ## This is merge filestorage.File type, a V1 pydantic model so we have trouble using it as a field here
    integration_type: IntegrationType
    company_id: uuid.UUID

We've migrated our whole codebase to V2, and so incorporating these V1 models presents some challenges.

from merge-python-client.

Andrew-Chen-Wang avatar Andrew-Chen-Wang commented on August 12, 2024

Hi our deployment cycle broke due to Pydantic 2.0 not being supported. In actuality, it's because Pydantic was upgraded to v1.10.15 in our list of dependencies. This patch was a breaking change in Pydantic, but it also introduced an import error in Merge's SDK. Error log:

    from .account import Account
.venv/lib/python3.10/site-packages/ddtrace/internal/module.py:220: in _exec_module
    self.loader.exec_module(module)
.venv/lib/python3.10/site-packages/merge/resources/accounting/types/account.py:6: in <module>
    from ....core.datetime_utils import serialize_datetime
.venv/lib/python3.10/site-packages/ddtrace/internal/module.py:220: in _exec_module
    self.loader.exec_module(module)
.venv/lib/python3.10/site-packages/merge/core/__init__.py:6: in <module>
    from .jsonable_encoder import jsonable_encoder
.venv/lib/python3.10/site-packages/ddtrace/internal/module.py:220: in _exec_module
    self.loader.exec_module(module)
.venv/lib/python3.10/site-packages/merge/core/jsonable_encoder.py:39: in <module>
    encoders_by_class_tuples = generate_encoders_by_class_tuples(pydantic.json.ENCODERS_BY_TYPE)
E   AttributeError: module 'pydantic.v1' has no attribute 'json'. Did you mean: 'Json'?

By supporting Pydantic v1.10.15, Pydantic v2 may as well be supported as the APIs for v1.10.15 and v2 are compatible. Please support so that we may continue to receive security patches from Pydantic which is core to our services. Thanks

from merge-python-client.

lucasgadams avatar lucasgadams commented on August 12, 2024

Would really be great to just upgrade the library so that it is pydantic 2.0 by default and instead has some backwards compat for people who are still using v1. Much more ideal than keeping it on V1

from merge-python-client.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.