opencobra / cobrapy

COBRApy is a package for constraint-based modeling of metabolic networks.
http://opencobra.github.io/cobrapy/
GNU General Public License v2.0
467 stars 218 forks source link

Make COBRApy compatible with pydantic version 2 #1346

Closed teddygroves closed 1 year ago

teddygroves commented 1 year ago

This change addresses issue #1345, allowing projects that use any pydantic version greater than 1.6 to also use COBRApy.

I thought it would be better not to pin a specific version number as the parts of pydantic that COBRApy currently uses aren't specific to a particular version and should be supported by future versions.

teddygroves commented 1 year ago

I think the flake8 failure relates to this line which is not part of this PR.

the error

flake8: commands[0]> flake8 /home/runner/work/cobrapy/cobrapy/src/cobra /home/runner/work/cobrapy/cobrapy/setup.py /home/runner/work/cobrapy/cobrapy/tests
  /home/runner/work/cobrapy/cobrapy/tests/test_core/test_core_reaction.py:1039:12: E721 do not compare types, for exact checks use `is` / `is not`, for instance checks use `isinstance()`

The line:

    assert type(state["_gpr"]) == str