Magicimport.py: Python code that fetches its dependencies without complaining
1–10 of 49 posts
Re: Magicimport.py: Python code that fetches its dependencies without complaining
#2it's saved me a world of pain a number of times to have different versions of the same libs installed in different envs
Re: Magicimport.py: Python code that fetches its dependencies without complaining
#3Re: Magicimport.py: Python code that fetches its dependencies without complaining
#4Would definitely recommend Poetry for anything larger, it's been a great experience.
Re: Magicimport.py: Python code that fetches its dependencies without complaining
#5For example if I do glob.glob("*.txt") it's rather obvious that I also wanted to "import glob".
Re: Magicimport.py: Python code that fetches its dependencies without complaining
#6> You can even specify a version number
Sorry to be sarcastic here but wow, you mean I can even make sure that my code will not break at an arbitrary point in the future, when my dependency inevitably introduces a breaking change? Fantastic.
I understand that installing dependencies is a bit of a hassle. But really, once you have done it twice it takes seconds. And I would not want a mechanism that fetches dependencies as a side effect of my app running. I want to know what's going on when my app runs. The fewer moving parts, the better. Often, it's hard work to achieve this simplicity. But, at least in my experience, it pays off.
Re: Magicimport.py: Python code that fetches its dependencies without complaining
#7Another thing I'd like for small projects is for "obvious" modules to be imported without having to say so. For example if I do glob.glob("*.txt") it's rather obvious that I also wanted to "import glob".
Re: Magicimport.py: Python code that fetches its dependencies without complaining
#8Re: Magicimport.py: Python code that fetches its dependencies without complaining
#9I opened this expecting Python to allow you to define custom import handlers at runtime, but this is cool too.
https://docs.python.org/3/reference/import.html#import-hooks
Re: Magicimport.py: Python code that fetches its dependencies without complaining
#10As someone who has been coding for 20 years, "magic" is a negative adjective for me. I don't want magic code. I want code that is simple and works in obvious ways. > You can even specify a version number Sorry to be sarcastic here but wow, you mean I can even make sure that my code will not break at an arbitrary point in the future, when my dependency inevitably introduces a breaking change? Fantastic. I understand t…
If I made a bot that drives cars around in GTA would you make a post ridiculing how dangerous my lane detection algorithm would be for a self-driving car in snow?
Furthermore, the point OP makes about L5 cars being presumably achievable while "L5 software" is not is a 100% valid point - why should we not aspire to that level of consistency and effectiveness in our systems? Maybe achieving this is actually possible and projects like this inspire the approaches that actually deliver those capabilities in a production-mature form.