Deprecating importlib.resources legacy API

Currently, test suites of projects that use the API fail (if they treat deprecation warnings as errors, which is a common default).
The error message is: “DeprecationWarning: path is deprecated. Use files() instead. Refer to https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy for migration advice.” The linked page says to “refer to the _legacy module to see simple wrappers that enable drop-in replacement based on the preferred API, and either copy those or adapt the usage to utilize the files and Traversable interfaces directly.”
However, the wrappers in _legacy use a private _common module (which then uses _compat and _adapters). So simply copying the functions won’t work, and it’s not clear how to adapt them.
And Traversable is currently undocumented.

Since this spans several repos, I’m not sure where to ask for clearer advice.

1 Like