These are chat archives for ipython/ipython

31st
Dec 2014
Thomas Wiecki
@twiecki
Dec 31 2014 16:14
is there a way to have %%bash execute .bashrc?
or some other way to set the environment variables for %%bash
Andreas Klostermann
@akloster
Dec 31 2014 16:45

@twiecki there is:

import os
os.environ['TEST'] = "Hello World"

%%bash
echo $TEST

I'm having trouble getting the latest ipython git version to run a notebook in a Docker container... Server starts fine, Kernel seems to start, but doesn't execute anything and crashes immediately.
Andreas Klostermann
@akloster
Dec 31 2014 17:07
solved that... sort of
Thomas Wiecki
@twiecki
Dec 31 2014 17:25
ah, it's executed in the os environment of the Python process
Andreas Klostermann
@akloster
Dec 31 2014 17:25
yes I think. This sort of "basic" linux stuff eludes me often times
Thomas Wiecki
@twiecki
Dec 31 2014 17:26
so I wonder if I couldn't execute the python kernel after running .bashrc
Andreas Klostermann
@akloster
Dec 31 2014 17:27
from my understanding if you started ipython notebook from bash itself, you should have all the parent environment variables present.
Thomas Wiecki
@twiecki
Dec 31 2014 17:29
what I really need is access to an ssh-agent
or actually, I really want to be able to access github from inside the NB
Andreas Klostermann
@akloster
Dec 31 2014 17:29
ah, I think that's something different...
Thomas Wiecki
@twiecki
Dec 31 2014 17:29
but I can't enter my ssh password
of the key
Andreas Klostermann
@akloster
Dec 31 2014 17:30
did you specify the ssh identity/host for github in your .ssh/config file? Maybe it loads that automatically then
also try to call "ssh-add" inside the notebook, sometimes it helps when ssh gets forgetful of passwords
another solution is to create another "identity", a key pair just for this purpose, which isn't encrypted
Thomas Wiecki
@twiecki
Dec 31 2014 17:35
ssh-add requires me to type the password :)
yeah, non-pw ssh keys would be one solution
but I'd rather not do that
actually this would be a nice opportunity for a widget, prompting for a passphrase which is then used in the ssh agent.
Thomas Wiecki
@twiecki
Dec 31 2014 17:41
that'd be perfect!
so I write a function that takes the password and executes ssh-agent with os.spawn()
and put that into an ipython text widget
neat
Andreas Klostermann
@akloster
Dec 31 2014 17:44
not so easy
Thomas Wiecki
@twiecki
Dec 31 2014 17:44
damn, it never is
Andreas Klostermann
@akloster
Dec 31 2014 17:45
ssh-add doesn't read from stdin but from tty
but it should somehow work, the above link contains a snippet to it in bash
Thomas Wiecki
@twiecki
Dec 31 2014 17:46
using "expect"
Andreas Klostermann
@akloster
Dec 31 2014 17:47
in the simples case that snipped could be templated and executed
Thomas Wiecki
@twiecki
Dec 31 2014 17:49
templated how?
Andreas Klostermann
@akloster
Dec 31 2014 17:51

something like

code = """etc 
send "%{0}"
""".format(password)

and then execute that bash code

Thomas Wiecki
@twiecki
Dec 31 2014 17:52
but I can't run bash, no? it'd have to be via os.popen()
or subprocess rather
Andreas Klostermann
@akloster
Dec 31 2014 17:53
yes, but using shell=True might work too... also I think that the snippet is a one-liner as far as bash is concerned because the multiple instructions are fed to expect itself)
Thomas Wiecki
@twiecki
Dec 31 2014 17:54
right
Thomas Wiecki
@twiecki
Dec 31 2014 18:02
beautiful -- thanks!
frohes neues :)
Andreas Klostermann
@akloster
Dec 31 2014 18:03
Gleichfalls...
Andreas Klostermann
@akloster
Dec 31 2014 19:03
My holiday project: Table Cleaner, a validation framework for tabular data, using Pandas. Tests and Documentation come with Docker files and bash scripts to build and run the Docker containers. https://github.com/akloster/table-cleaner
Jonathan Frederic
@jdfreder
Dec 31 2014 19:08
Cool
Kyle Kelley
@rgbkrk
Dec 31 2014 19:25
My holiday project has been creating an open source implementation of the picloud/multyvac api
If anyone wants to try out our pre-pre-pre-pre-alpha deployed version, let me know.
Jonathan Frederic
@jdfreder
Dec 31 2014 20:38
woah cool!
lol
I love the logo
@rgbkrk I'm not familiar with that API
Fernando Perez
@fperez
Dec 31 2014 20:47
My holiday project is to get my inbox back under control... :( It's the little things guys, the little things... ;)
BTW, cloudpipe looks great! I'm starting to imagine already cool use cases for it...
Kyle Kelley
@rgbkrk
Dec 31 2014 21:10
:D
In [30]: import multyvac; multyvac.config.set_key(api_key='admin', api_secret_key='12345', api_url='http://api.cloudpi.pe/v1')

In [31]: multyvac.get(multyvac.submit(lambda x,y: x*y, 11,13)).get_result()
Out[31]: 143
@jdfreder PiCloud was this service you could run code on, just pure compute
Basically, batch jobs on demand
If you pip install multyvac
then run the code above, it will run on the demo box I have running right now
Kyle Kelley
@rgbkrk
Dec 31 2014 21:17
ok, will do live demo in https://appear.in/jupyter momentarily if anyone wants to join
Kyle Kelley
@rgbkrk
Dec 31 2014 21:49
nice
Jon ran code against cloudpi.pe
:)
Fernando Perez
@fperez
Dec 31 2014 22:24
sorry I missed it, was on another call!