JaneliaSciComp / pydantic-ome-ngff

Pydantic models for OME-NGFF
BSD 3-Clause "New" or "Revised" License
20 stars 3 forks source link

TypeError: unsupported operand type(s) #45

Open AdvancedImagingUTSW opened 2 months ago

AdvancedImagingUTSW commented 2 months ago

Found while running our CI pipeline on this module: https://github.com/TheDeanLab/navigate/blob/develop/test/model/data_sources/test_zarr_data_source.py

The tests work with pydantic-ome-ngff==0.5.3. However, they fail with the recent releases (e.g., > 0.6.0) due to the following TypeError.

    from pydantic_ome_ngff.v04.multiscale import Group
/opt/miniconda3/envs/navigate/lib/python3.9/site-packages/pydantic_ome_ngff/v04/__init__.py:3: in <module>
    from pydantic_ome_ngff.v04.label import ImageLabel
/opt/miniconda3/envs/navigate/lib/python3.9/site-packages/pydantic_ome_ngff/v04/label.py:10: in <module>
    from pydantic_ome_ngff.v04 import multiscale
/opt/miniconda3/envs/navigate/lib/python3.9/site-packages/pydantic_ome_ngff/v04/multiscale.py:24: in <module>
    import pydantic_ome_ngff.v04.transform as tx
/opt/miniconda3/envs/navigate/lib/python3.9/site-packages/pydantic_ome_ngff/v04/transform.py:170: in <module>
    Scale = VectorScale | PathScale
E   TypeError: unsupported operand type(s) for |: 'ModelMetaclass' and 'ModelMetaclass'
d-v-b commented 2 months ago

This is a side-effect of dropping python 3.9 support (which should have made it impossible to install that version with python 3.9, so maybe I messed something up). Is it possible for you to run a newer version of python? Alternatively I can look into fixing this, but i'm not sure how much time I will have for it in the next few weeks

AdvancedImagingUTSW commented 2 months ago

No worries, I was able to fix our CI pipeline by specifying version number 0.5.3 in our pyproject.toml file. I just wanted to communicate the issue.

If you want to fix it, I think you need to change your pyproject.toml file to requires-python = ">=3.10".

We are using python 3.9.7, which is >= 3.9.