unionai-oss / pandera

A light-weight, flexible, and expressive statistical data testing library
https://www.union.ai/pandera
MIT License
3.05k stars 281 forks source link

support typeguard < 3 for better compatability #1563

Closed cosmicBboy closed 1 month ago

cosmicBboy commented 1 month ago

This PR loosens the typeguard version dependency to support version < 3. Addresses the comment here: https://github.com/unionai-oss/pandera/issues/1365#issuecomment-2047026850

z4m0 commented 1 month ago

Hi @cosmicBboy, thank you for your extremely fast response and solution! :)

For us it would work without problems as we don't use these generic types.

However if I understand correctly there is a tradeoff because this may introduce silent bugs in somebody else's code. Imagine something like this:

  1. Having some working Pandera pandera code with generic types
  2. Install jaxtyping => typeguard downgrades to v2 and tools like pip-compile wouldn't raise errors.
  3. Pandera now works different and if the code is not very well tested this may go unnoticed.

Another thing in the case you decide to proceed the requirements.in file, shouldn't be changed as well? setting typeguard >= 2.13.3

cosmicBboy commented 1 month ago

Pandera now works different and if the code is not very well tested this may go unnoticed.

Will add a warning so that the behavior is more transparent

yuenherny commented 1 month ago

Hi @cosmicBboy , thank you for the prompt solution. With this change, would Series[TYPE] gets affected as well or it is just LIST[TYPE] and DICT[TYPE, TYPE]?

E.g.

from pandera.typing import DataFrame, Series

class DataFrameSchema(pa.DataFrameModel):
    Index: Series[pa.Int]
    TimeStamp: Series[pa.Timestamp]
    Value: Series[pa.Float]

TimeSeries = DataFrame[DataFrameSchema]
cosmicBboy commented 1 month ago

Hi @cosmicBboy , thank you for the prompt solution. With this change, would Series[TYPE] gets affected as well or it is just LIST[TYPE] and DICT[TYPE, TYPE]?

Just the typing module types