Post #2563355
2024-08-27 16:25 UTC
Replies (2)
-
@nobody@mastodon.acm.org 2024-08-27 16:29
@corbin@defcon.social @stargirl@hachyderm.io Maybe I should elaborate: imagine you have a project that uses protobuf-python, and you want to use it together with tensorflow. Chances are, tensorflow's outdated protobuf does not work for you. Rather trying to patch your project or patch tensorflow for compatibility with the older/newer protobuf, I'd want a solution where we instruct python to resolve `import protobuf` into one "package" when the import happens under `${prefix}/tensorflow`, and another package elsewhere
-
@corbin@defcon.social 2024-08-27 16:39
@nobody@mastodon.acm.org @stargirl@hachyderm.io Sure. Those hints would be populated from a mapping either maintained via Cheeseshop or via local choices. Either way, there's politics going on; each individual mapping is a policy choice. In terms of Zooko's triangle, this would be the "centralized" option, which means that the import keyword would now functionally depend on whatever build/runtime configuration you've imagined. Not that this is a bad thing! Check out PEP 302 for the hooks you'd need to prototype an actual implementation of your idea. Allen Short explained how to use PEP 302 here https://web.archive.org/web/20180411011138/http://washort.twistedmatrix.com/2011/01/introducing-exocet.html and I used it to add hot-reload plugin functionality to a Python Minecraft server.