7 ms·
> This is Python. Hidden monkeypatching isn’t how we do things. The author didn't make this pattern up, it's how fsspec officially recommends implementing back
by lolinder 3y ago
> This is Python. Hidden monkeypatching isn’t how we do things.
The author didn't make this pattern up, it's how fsspec officially recommends implementing backends [0]. Given how widely used fsspec is I think it's fair to say that hidden monkeypatching is how we do things... sometimes.
[0] https://filesystem-spec.readthedocs.io/en/latest/developer.html#implementing-a-backend https://filesystem-spec.readthedocs.io/en/latest/developer.h...
- kuchenbecker 3y agoMonkeypatching, dll injection, Jar Classpath - Huge sources of pain. It Is how it's done but in certain contexts any benefit is immediately outweighed as the bugs start accumulating.
- lolinder 3y agoRight, in certain contexts (I would even say most contexts) it can be a problem. However, it's not obvious to me that this—a well-defined interface for injecting plugins that's specified by a library that functions as low-level infrastructure—is one of those contexts.
- kuchenbecker 3y agoIt needs to be scoped to the dep so conflicting deps have independent dependencies. If foo 1.1 takes a dep on Bar 1.2, and baz 2.3 takes a dep on Bar 1.4, both Bar contexts are tested with their respective libraries but forcing Bar to a particular global version can have problems and both versions of Bar are needed to have tested behavior. Examples mentioned and OP change the global behavior vs proper dependency management.