6 ms·
This sounds... not possible for the core problem of how Python handles dependency resolution during the life of an application? How are you setting things up so
by mroche 4mo ago
This sounds... not possible for the core problem of how Python handles dependency resolution during the life of an application? How are you setting things up so that the following scenario is valid?
program
├── dependency_a
│ └── dependency_c (1.0.0)
└── dependency_b
└── dependency_c (2.0.0)
Otherwise, you've created a magic layer hack to enable multi-version dependency chains in a mono-version dependency chain language.
- yorwba 4mo agoPython's import system is extensible: https://docs.python.org/3/reference/import.html#import-hooks https://docs.python.org/3/reference/import.html#import-hooks It might be possible to create a custom finder that will return 1.0.0 when running "import dependency_c" in dependency_a but 2.0.0 for the same import statement in dependency_b. You'll need to work around the module cache in sys.modules, though. And good luck trying this on a package that also hooks the import system...
- skeledrew 4mo agoYep that's pretty much how I do it, along with RPyC[0] for connection. [0] https://rpyc.readthedocs.io/en/latest/ https://rpyc.readthedocs.io/en/latest/
- skeledrew 4mo agoI'll try to get around to a Show HN some time for it, but it's essentially as sibling reply states.