On Sunday, October 29, 2017, Paul Moore <p.f.mo...@gmail.com> wrote:

> On 29 October 2017 at 10:40, Stephan Houben <stephan...@gmail.com
> <javascript:;>> wrote:
> > Perhaps slightly off-topic, but I have sometimes wondered if
> > pip could not be made somewhat friendlier for the absolute newbie
> > and the classroom context.
> >
> > Some concrete proposals.
> >
> > 1. Add a function `pip` to the interactive interpreter
> >   (similar to how `help` is available).
> >
> >   def pip(args):
> >       import sys
> >       import subprocess
> >       subprocess.check_call([sys.executable, "-m", "pip"] +
> args.split())
> >
> >    This allows people to install something using pip as long as they
> have a
> >    Python prompt open, and avoids instructors to have to deal with
> > platform-specific
> >    instructions for various shells. Also avoids confusion when multiple
> > Python interpreters
> >    are available (it operates in the context of the current interpreter.)
>
> There are subtle issues around whether newly installed/upgraded
> packages are visible in a running Python interpreter.


If the package is already imported, reload() isn't sufficient; but
deepreload from IPython may be.

IPython also supports shell commands prefixed with '!':

! pip install -U requests regex IPython
! pip install -U --user psfblessedset1
%run pip install -U --user psfblessedset1
%run?

% autoreload?
# http://ipython.readthedocs.io/en/stable/config/extensions/autoreload.html

This:


> It's possible
> that this would result in *more* confusion than the current situation.


Why isn't it upgrading over top of the preinstalled set?

At least with bash, the shell command history is logged to .bash_history by
default. IMO, it's easier to assume that environment-modifying commands are
logged in the shell log; and that running a ``%logstart -o logged-cmds.py``
won't change the versions of packages it builds upon.

Is it bad form to put ``! pip install -U requests `` at the top of every
jupyter notebook?
``! pip install requests==version `` is definitely more reproducible.
(seeAlso: binder, jupyter/docker-stacks)

I'll just include these here unnecessarily from the other curated package
set discussions:

https://github.com/jupyter/docker-stacks

https://github.com/Kaggle/docker-python/blob/master/Dockerfile

https://binderhub.readthedocs.io/en/latest/

I can see the appeal of something like this, but it's not as simple as
> it looks. If you want to discuss this further, I'd definitely suggest
> making it a thread of its own.


> Personally, as a pip maintainer, I'm -0
> on this (possibly even -1).


Same.
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to