oracle / graalpython

GraalPy – A high-performance embeddable Python 3 runtime for Java
https://www.graalvm.org/python/
Other
1.25k stars 112 forks source link

Support for pydantic-core 2.20 #451

Open ampdot-io opened 2 weeks ago

ampdot-io commented 2 weeks ago

Hi,

My application depends on Pydantic 2.7's support for the generic Secret type, which I use to hide sensitive information from telemetry and logging.

GraalPython currently only supports pydantic-core==2.10.1, which corresponds to Pydantic 2.4, while I need patches for pydantic-core of at least 2.20.

Is there any tool for generating candidate updated patches automatically, or any proposal for a system that allows library upgrades more easily than the current system?

msimacek commented 2 weeks ago

Hi @ampdot-io, I'll a new patch.

Is there any tool for generating candidate updated patches automatically, or any proposal for a system that allows library upgrades more easily than the current system?

There's a already an autopatching system that applies common changes for things that can be done automatically. The patch files are for the things that the automated tool didn't handle. When we have a reasonable confidence a patch will apply on new releases, we don't pin it to specific versions so it will try to apply it on new releases as they are made. But in case of pydantic-core, we know that the patch won't apply to newer releases and will need some additional human work to be adapted to the new version, so we pin it. We already upstreamed GraalPy support in PyO3, the framework that pydantic-core is built upon and recently we upstreamed GraalPy support in jiter which another pydantic-core dependency. We're going to upstream the patch for pydantic-core itself soon and then no patch will be needed anymore.

ampdot-io commented 2 weeks ago

Thanks!

ampdot-io commented 1 day ago

Hi,

Please let me know when this is completed. I can't remove my application's dependency on this version of Pydantic.

msimacek commented 17 hours ago

Hi, sorry for the delay, it was a bit more complex than I anticipated. I have a PR for supporting pydantic-core 2.26. It will still take some time to get merged and build a snapshot, but you can apply the patch manually already. To do that, you can get pydantic-core sources from here and apply the patch from the PR on the unpacked sources with the patch command. Then in a graalpy virtualenv run pip install . from the unpacked directory.