Live data from Hacker News

Magicimport.py: Python code that fetches its dependencies without complaining

github.com

41–49 of 49 posts

Re: Magicimport.py: Python code that fetches its dependencies without complaining

#41
> The ONLY package it will automatically install to your system (and in user-space, only) is virtualenv itself

I don't understand why it even uses virtualenv, when venv is a) part of the standard library, and b) the recommended way to create virtual environments in Python.

While the import from __future__ indicates that it's supposed to support Python 2, the shebang line is explicitly Python 3...

Re: Magicimport.py: Python code that fetches its dependencies without complaining

#42
post #27
post #19

Earlier quoted context omitted.

This is just a toy but might seem like a great idea for someone less experienced and could normalize bad practices. Specifically stating to not use in production will not stop people from doing just that! Requirement files aren't magic, neither are virtual envs. Every slightly professional IDE supports that. No need to create anti-patterns.

This. The Node.js community is a good example of where this has happened - lots of bad practices with fancy logos making it into the top 50 most depended upon packages (e.g. left-pad). The top-level comment is just being critical. It's not inappropriate. People just don't like having their feelings hurt.

What's left pad's fancy logo? Also how is left pad a bad practice?

Re: Magicimport.py: Python code that fetches its dependencies without complaining

#43
post #31

Earlier quoted context omitted.

I'm concerned people will take it as a good idea instead of a demonstration of what can, but shouldn't, be done.

Sadly, this is already a thing in a relatively common JS bundler..[0] :/ [0]: https://en.parceljs.org/hmr.html#automagically-installed-dep...

> This only occurs in development (using serve or watch), however in production (using build) autoinstall is disabled to prevent unwanted side-effects on deployment.

> You can disable this feature using --no-autoinstall.

Seems fine to me.

Re: Magicimport.py: Python code that fetches its dependencies without complaining

#44

Earlier 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…

I'm with you 100% on this. Someone posted a project that is clearly a bad idea to actually use and your criticisms are perfectly justified and on-topic (not to mention correct).

I've also seen too many things of this nature in production to buy into the "it's just a toy, it's self-evidently not for real use" argument.

Re: Magicimport.py: Python code that fetches its dependencies without complaining

#45

Earlier quoted context omitted.

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…

Nope, your comment is poor because it’s off-topic, not critical. You saw the project and launched into a mild rant about “kids these days who use libraries for everything” when on-topic comments would be “I hope nobody actually uses this ;) Although in all seriousness based on my experience this kind of thinking is unironically already present in the software engineering community”. Your original comment fails to tie…

It's not at all self-evident that something like this is bad to inexperienced or naive developers, even if the readme has the obligatory "this is just for personal projects, don't use it in production" disclaimer. The comment is perfectly on-topic.

Re: Magicimport.py: Python code that fetches its dependencies without complaining

#46
There is the fades utility that installs marked dependencies automatically

For example, one could replace a python shebang with fades' one and mark dependencies using # fades comments:

    #!/usr/bin/fades
    import dependency # fades
https://github.com/PyAr/fades

Re: Magicimport.py: Python code that fetches its dependencies without complaining

#47
post #2

Since 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…

This is what I love about Nix. It has actually completely solved dependency hell for me. It's always a little painful to move an existing project to Nix but I have never regretted it.

Re: Magicimport.py: Python code that fetches its dependencies without complaining

#48

> The ONLY package it will automatically install to your system (and in user-space, only) is virtualenv itself I don't understand why it even uses virtualenv, when venv is a) part of the standard library, and b) the recommended way to create virtual environments in Python. While the import from __future__ indicates that it's supposed to support Python 2, the shebang line is explicitly Python 3...

One big reason is that ubuntu splits out venv into its own package basically "breaking" python. People then don't know about the venv module and continues using the virtualenv, both due to this preceding venv, and because that is usually the word used to describe the concept.

Re: Magicimport.py: Python code that fetches its dependencies without complaining

#49

Earlier quoted context omitted.

Nope, your comment is poor because it’s off-topic, not critical. You saw the project and launched into a mild rant about “kids these days who use libraries for everything” when on-topic comments would be “I hope nobody actually uses this ;) Although in all seriousness based on my experience this kind of thinking is unironically already present in the software engineering community”. Your original comment fails to tie…

It's not at all self-evident that something like this is bad to inexperienced or naive developers, even if the readme has the obligatory "this is just for personal projects, don't use it in production" disclaimer. The comment is perfectly on-topic.

Honestly, even a “this a bad idea to use in production” would be an on-topic comment, and as I said the comment in and of itself is not poor it is just misplaced and such a lead could help it transition between the two topics. The primary issue is that the comment is not “don’t use this in production”, it’s just straight up “importing all the dependencies is what’s wrong in software today” which is no longer connected to the post.
Post reply on HN