I'm disappointed to see so many negative HN comments about this project. I think it is really cool! You shouldn't use this in a production web service--and the author says as much in the README--I think there are some great uses for this code: 1. Demonstrating how the Python import system works. There is a lot of nuance at hand that other programming languages (like C) don't have an analogy for. 2. Creating truly sel…
Magicimport.py: Python code that fetches its dependencies without complaining
31–40 of 49 posts
Re: Magicimport.py: Python code that fetches its dependencies without complaining
#32Since moving to Nix, I've been forced to setup virtual envs for my more interesting projects (oh sure, I install the common libraries at the system level), and though I resisted this workflow a lot initially (I like to keep a tight ship), I've come to embrace its practicality when working on projects that have libs with breaking changes due to rapid releases. it's saved me a world of pain a number of times to have di…
I would discourage distros from even shipping easy_install and pip by default. One should never mess with the system Python.
Re: Magicimport.py: Python code that fetches its dependencies without complaining
#33Compared to R, pythons imports syntax and handling is a god-sent when sharing code, but we still saw a lot of people get stuck after cloning a notebook or dashboard trying to figure out all the dependencies they needed to set up to run it.
Now they just copy the notebook/dashboard and first run configures everything For them referencing both internal and external dependencies.
It’s a small but important difference especially for juniors.
In the future I would love for python just to support something like “import pandas==1.1.3@pypi” and having that automatically do what every python developer who works with virtual envs would do if they saw the “==1.1.3@pupi” in a comment after the import. But then obviously also supporting installs from other sources than pypi.
Re: Magicimport.py: Python code that fetches its dependencies without complaining
#34As 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…
In my personal case, I have loads of dead code directories for various half-remembered Python ideas. It'd be convenient to have a lighter-weight "experiments" dir using something like this.
Re: Magicimport.py: Python code that fetches its dependencies without complaining
#35Earlier quoted context omitted.
I would discourage distros from even shipping easy_install and pip by default. One should never mess with the system Python.
The existence of "the system python" as the default has annoyed me endlessly.
Re: Magicimport.py: Python code that fetches its dependencies without complaining
#36Repl.it also offers a more production ready version called Universal Package Manager https://github.com/replit/upm
Re: Magicimport.py: Python code that fetches its dependencies without complaining
#37I'm disappointed to see so many negative HN comments about this project. I think it is really cool! You shouldn't use this in a production web service--and the author says as much in the README--I think there are some great uses for this code: 1. Demonstrating how the Python import system works. There is a lot of nuance at hand that other programming languages (like C) don't have an analogy for. 2. Creating truly sel…
I'm concerned people will take it as a good idea instead of a demonstration of what can, but shouldn't, be done.
[0]: https://en.parceljs.org/hmr.html#automagically-installed-dep...
Re: Magicimport.py: Python code that fetches its dependencies without complaining
#38Earlier quoted context omitted.
This is a toy/neat experiment that someone made and they explicitly say you should not use it for production. This sort of criticism is inappropriate (or at best, poorly framed). This is Hacker News, and this is a Hack. 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…
You're basically saying that I am not allowed to give my opinion on this project, because it happens to be critical. I don't know how we can have interesting discussions in this forum if criticism is not allowed. At the end of the day, I think you're saying it's a fun toy and I shouldn't worry, whereas my point was that I wouldn't even want to use it as a toy, and I am afraid it will lead especially less experienced…
People are allowed to point out when that comment is appropriate for a different context. They're allowed to do that with imperfect language too.
You're allowed to acknowledge you're wrong, and move on. You're also allowed to push back and explain why you think it's fine for this context.
The only person who has control over you is you. This is a web forum. A Random Stranger on the Internet calling a comment inappropriate shouldn't lead one to believe that "criticism is not allowed" in a particular forum.
And I think it's a nice toy. I haven't seen people break for using toys. I've mostly seen people break when they only do things one way, and habituate to believe other ways are wrong or bad. Toys are for playing, and great ways to discover which things work and which ones don't. Even IOCCC didn't result in broken programmers. Java sometimes did.
So I don't see either your comment or their response as ideal, but that's okay. I'd estimated 25% of my comments are poor, and you'd probably estimate me at 50% since I probably don't always realize my comments are poor. That's okay. Poor comments are parts of conversations. Pointing out they're poor is part of conversation too. Continuing to talk (and sometimes make poor comments) is too.
Re: Magicimport.py: Python code that fetches its dependencies without complaining
#39Another 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".
You can check https://pypi.org/project/smart_imports/
If it finds multiple functions / objects with the same name, it gives you choices. For me on larger projects it shows choices ~80% of the time.
I wonder how can this work correctly on anything larger than the provided example.
Re: Magicimport.py: Python code that fetches its dependencies without complaining
#40[0](https://www.zdnet.com/article/two-malicious-python-libraries...)