-
Notifications
You must be signed in to change notification settings - Fork 6
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
Reduce dependency on pydantic._internal
#835
Comments
Raising this again: It will be useful if we don't need to have too strict opinions on the pydantic version eventually. Currently, using pixi to set up environments (which some of our users are starting to do & then reporting issues to me) can lead to issues, because pixi is very strict in the dependency resolving and other libraries start to depend on e.g. pydantic 2.9.2. In that specific case, I'm having an issue making napari-ome-zarr-navigator (which depends on fractal-tasks-core for some NGFF library functionality) work in a pixi environment with napari-ome-zarr, because they apparently pin pydantic==2.9.2. I then get:
(I am not sure why pixi finds a disagreement within just fractal-tasks-core 1.3.2. It's fine installing just that, but runs into conflicts when I add napari or napari-ome-zarr. My suspicion is that because we don't pin napari, that exploration of finding compatible napari versions & their dependencies leads to issues. I apparently can't put fractal-tasks-core & napari >=0.5.0 into the same pixi project) |
See resulting dependency hell here: fractal-napari-plugins-collection/napari-ome-zarr-navigator#29 But there will be other solutions to solve this than changing things in fractal-tasks-core |
For the record, there's hope for some activity on the pydantic side, re: schema generation for optional attributes:
(see also pydantic/pydantic#7161) If/when this lands upstream, we can review whether we can find a supported way of producing the same JSON Schemas as we do now. This option would be clearly better than implementing custom solutions (which we are already doing, but which would become even more custom if we need to support different incompatible pydantic versions as <2.9 and >=2.9). Meanwhile, I'll explore/propose a different solution to mitigate or fix the dependency issue for napari-ome-zarr-navigator - see upcoming issue. |
Great, thanks a lot @tcompa and then let's just keep an eye on the upstream developments here before we do more work on the schema & pydantic version! |
Part of the current issue is made a bit less urgent by fractal-napari-plugins-collection/napari-ome-zarr-navigator#29, but I'll still mention what I had in mind.
diff --git a/pyproject.toml b/pyproject.toml
index fb083afa..8474615f 100755
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -30,7 +30,11 @@ zarr = ">=2.13.6,<3"
numpy = "<=2.1.0"
pandas = ">=1.2.0"
lxml = "^4.9.1"
-pydantic = ">2,<=2.8.2"
+
+pydantic = [
+ { version = ">2", optional = false },
+ { version = ">2, <2.9", markers = "extra == 'xxx'", optional = true}
+]
docstring-parser = "^0.15"
anndata = ">=0.8.0,<0.11.0"
filelock = "3.13.*"
@@ -50,6 +54,7 @@ image_registration = { version = ">=0.2.9", optional = true }
[tool.poetry.extras]
fractal-tasks = ["Pillow", "imageio-ffmpeg", "scikit-image", "llvmlite", "napari-segment-blobs-and-things-with-membranes", "napari-workflows", "stackview", "napari-skimage-regionprops", "napari-tools-menu", "cellpose", "torch", "image_registration"]
+xxx = ["pydantic"]
[tool.poetry.group.dev]
optional = true |
Agreed! Let's have manifest creation in a separate package eventually (by fractal-tasks-core 2.0) and longer term, let's try to avoid this coming with a pydantic upper bound. A lower bound for pydantic seems necessary though. |
See #834.
We currently have these imports
I think we can at least get rid of the specific
_typing_extra.add_module_globals
function that changed when passing from 2.8.2 to 2.9.0 (pydantic/pydantic@8dc0ce3), and maybe we can also reduce dependency onConfigWrapper
. Whether we can also avoid depending on_generate_schema.GenerateSchema
is TBD.The text was updated successfully, but these errors were encountered: