Hi, On Tue, Sep 13, 2016 at 3:55 PM, Donald Stufft <don...@stufft.io> wrote: > >> On Sep 13, 2016, at 6:41 PM, Steve Dower <steve.do...@python.org> wrote: >> >> I think it's one of these things where we should suck it up and let the 90% >> case work fine, then display a big fat warning if anything weird may have >> happened and let users sort it out themselves. > > > I am unsure. One of the really egregious and hard to debug weirdness is going > to be something like: > > >>>> import foo.bar # foo, and foo.bar are in sys.modules >>>> pip.install(“thing”) # This implicitly upgrades foo >>>> import foo.widget # the old foo is in sys.modules, but the new foo.widget. > > The 90% case works when it’s *only* pure python and there’s no > upgrading/downgrading involved, however you can’t control whether there are > going to be upgrades/downgrades or not when dependencies are in play because > of ==, >=, >, <, <=, etc. > > Another problem, particularly on Windows, is going to be stuff like: > >>>> import someclibrary >>>> pip.install(“thing”) # Implicitly upgrades someclibrary > > In this case, this would explode because Python will have the > someclibrary.dll locked and the upgrade will attempt to remove it. > > My fears here are that people are going to get really confused when they make > state modifications to their Python environment and they don’t see those > modifications reflected (because of sys.modules caching or what have you). > You can possibly get around that with reload(), but we already know the > problems that reload() has. Of course, that doesn’t stop Python from offering > reload(), but I think the difference is that reload() is targeted towards > people with weird edge cases who can understand the caveats while the > hypothetical ``pip.install()`` is targeted towards people who are beginners > who are still having problems figuring out the difference between the REPL > and their shell, much less the vagaries of Python’s global state and > attempting to modify that in a now running Python program. > > Perhaps a better idea would be to add some smarts to the REPL (but not to > Python itself) that would detect something like: > >>>> pip install > > And print a better error message that gives a better indication about what’s > gone wrong besides a SyntaxError?
I was thinking the same thing. If it could also catch accidental >>> python3 -m pip install commands, that would be even better. Cheers, Matthew _______________________________________________ Distutils-SIG maillist - Distutils-SIG@python.org https://mail.python.org/mailman/listinfo/distutils-sig