Comment by joouha
2 months ago
Modshim does more than just wrap the external API of a package - it allows you to tweak something internal to the module while leaving its interface alone, without having to re-implement most of the package in order to re-bind new versions of objects.
There are a couple of example of this readme: (1) modifing the TextWrapper object but then use it through the textwrap library's wrap() function, and (2) modifing the requests Session object, but then just using the standard requests.get(). Without modshim (using standard monkey-patching) you would have to re-implement the wrap and get methods in order to bind the new TextWrapper / Session classes.
I'm not necessarily interested in using modshim, but it got me wondering a couple of things out of curiosity:
- what's the performance like for big packages (say, pytorch)? Have you done some benchmarking?
- is typing kept for the shims? My immediate guess, again, without even trying it out, is not. If yes, how?
edit: formatting