NowanIlfideme / pydantic-yaml

YAML support for Pydantic models
MIT License
138 stars 11 forks source link

`safe_load` is gonna be deprecated #21

Closed wst24365888 closed 2 years ago

wst24365888 commented 2 years ago

Thank you for this awesome package, but I got a warning while running pytest:

PendingDeprecationWarning:
  safe_load will be removed, use

    yaml=YAML(typ='safe', pure=True)
    yaml.load(...)

  instead
    obj = cfg.yaml_loads(b)

my environment:

$ python --version
Python 3.10.4
ruamel-yaml==0.17.21
pydantic-yaml==0.6.3

Hope this one can be fix soon, thanks!

NowanIlfideme commented 2 years ago

Hi, got it - added this to my TODOs. Honestly, supporting both Ruamel and PyYaml seems to require more and more effort over time, but I think this can be fixed by just refactoring and wrapping a custom safe_load operator.