unionai-oss / pandera

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

Disable runtime checking with configuration option (environment variable) #1081

Open FRidh opened 1 year ago

FRidh commented 1 year ago

Is your feature request related to a problem? Please describe. We have a situation where we do a tremendous amount of calls and would prefer not to have the overhead of Pandera.

Describe the solution you'd like We would like to be able to disable Pandera runtime checking, e.g., using a environment variable.

Describe alternatives you've considered Wrapper or monkeypatching decorators such as check_types.

Additional context Discussion

cosmicBboy commented 1 year ago

I think this is a great candidate for thinking about pandera config (which is non-existent today).

Basically the idea is to have both env vars and config option to modify pandera's behavior:

Env var:

PANDERA_DISABLE_RUNTIME_CHECKING=1

Config file, e.g. pandera.yml:

disable_runtime_checking:  true

Will also need to define the behavior of:

  1. determining where to find the config file
  2. defining the interaction between env vars and config: I'd imaging the env vars overriding config settings

What do you think @FRidh ?

FRidh commented 1 year ago

Yes, indeed something like that.

I'm quite fresh to pandera so I don't know yet what other kind of configuration could be of interest. Regarding the file, personally I would much more prefer to see a .toml file over a .yml file.

cosmicBboy commented 1 year ago

Would you be able to come up with a PR for the environment variable-based solution? I think basically it should modify the check_types decorator to return the wrapped function if PANDERA_DISABLE_RUNTIME_CHECKING=1