FLAML icon indicating copy to clipboard operation
FLAML copied to clipboard

Unpin Pydantic

Open OlivierBinette-UpStart opened this issue 5 months ago • 7 comments

Why are these changes needed?

FLAML currently uses a pinned version of Pydantic, version 1.10.9. This makes it impossible to install FLAML alongside libraries that use other versions of Pydantic or Pydantic v2.

Unclear why that limitation is required. Pydantic is only imported in a single place within the whole of the package.

Changes:

  • I the single import of pydantic to be compatible with both version 1 and version 2.
  • I unpinned the Pydantic version in setup.py.

Checks

  • [x] I've used pre-commit to lint the changes in this PR (note the same in integrated in our CI checks).
  • [] I've included any doc changes needed for https://microsoft.github.io/FLAML/. See https://microsoft.github.io/FLAML/docs/Contribute#documentation to build and test documentation locally.
  • [] I've added tests (if relevant) corresponding to the changes introduced in this PR.
  • [] I've made sure all auto checks have passed.

OlivierBinette-UpStart avatar Jul 31 '25 19:07 OlivierBinette-UpStart

@microsoft-github-policy-service agree company="Individual"

OlivierBinette-UpStart avatar Jul 31 '25 19:07 OlivierBinette-UpStart

@thinkall I'm not sure who to ping about this. Could you take a look?

OlivierBinette-UpStart avatar Aug 01 '25 17:08 OlivierBinette-UpStart

@thinkall It seems like older versions of ray[tune] are not compatible with pydantic v2. I bumped it to ray[tune]>=2.9 in setup.py, but that might be a more significant dependency change.

OlivierBinette-UpStart avatar Aug 04 '25 16:08 OlivierBinette-UpStart

@thinkall It seems like older versions of ray[tune] are not compatible with pydantic v2. I bumped it to ray[tune]>=2.9 in setup.py, but that might be a more significant dependency change.

Hi @OlivierBinette-UpStart , ray 2 is not tested yet. Let's see will it work.

thinkall avatar Aug 05 '25 02:08 thinkall

In fact, pydantic is not pinned in FLAML. If you don't install ray[tune], you're good to go with any pydantic version. autogen module is not updated in FLAML for a long time, if you need autogen, checkout microsoft/autogen repo. @OlivierBinette-UpStart

thinkall avatar Aug 05 '25 02:08 thinkall

@thinkall Oh you're totally right. We're using ray[tune], which is where the Pydantic dependency must be coming from.

Do you think FLAML can be compatible with newer versions of Ray?

OlivierBinette-UpStart avatar Aug 05 '25 14:08 OlivierBinette-UpStart

@thinkall Oh you're totally right. We're using ray[tune], which is where the Pydantic dependency must be coming from.

Do you think FLAML can be compatible with newer versions of Ray?

The latest PR for supporting ray is #1392, but I'm not sure will it work for other modules or not. I think some changes will be needed.

thinkall avatar Aug 06 '25 07:08 thinkall