Francesc Alted | 16 Jul 20:22 2015
Picon

Way to retrieve the value of %time?

Hi,

I am trying to come up with a way of accessing the time measured by the magic %time.  That is, in:

In [149]: %time sum(i for i in xrange(1000000))
CPU times: user 118 ms, sys: 27.4 ms, total: 145 ms
Wall time: 121 ms
Out[149]: 499999500000

is there a way to get the 121 ms value of the 'Wall time' above and put that in a variable?  I know I can use something like:

In [150]: from time import time

In [151]: t0 = time(); sum(i for i in xrange(1000000)); mytime = time() - t0

In [152]: mytime
Out[152]: 0.10076594352722168

but %time is so much convenient, specially for tutorials, that I would rather prefer using it.

Thanks!

--
Francesc Alted
_______________________________________________
IPython-User mailing list
IPython-User <at> scipy.org
http://mail.scipy.org/mailman/listinfo/ipython-user
Kudeki, Erhan | 13 Jul 23:36 2015

jupyter Text File editor language feature

Please make the Text File editor of ipython notebook or jupyter recognize *.ipy files
for automatic python language formatting as it does for *.py files.

Thanks,

Erhan 
___________________________________________________
Erhan Kudeki                   Tel: 217 265 0128     erhan <at> illinois.edu
Professor and Associate Head for Undergraduate Affairs
Department of Electrical and Computer Engineering
University of Illinois at Urbana-Champaign
2080 ECEB, 306 N. Wright St., Urbana, IL 61801               

_______________________________________________
IPython-User mailing list
IPython-User <at> scipy.org
http://mail.scipy.org/mailman/listinfo/ipython-user
steve_geo | 9 Jul 01:29 2015
Picon

Markup from file

Hello,

I'm just a new user to ipython notebook, and dont know if I am overlooking functionality.

I would like to store a markdown file in a directory with my data from a test run, when I open a notebook and point it at the directory with my data, I would like to see the markdown file marked up in my notebook. ( This file will specify some of the test run parameters that can change from run to run and intended for human consumption in the form of some headings and bullet points)

To do this I think I either need to be able to pass a filename to  a markdown cell.
or
Do it in a code cell with something like IPython.display "Markdown" object which I dont think exists.

Currently I am using John Gruber's Markdown module to read the markdown file, convert it to a html  file, then display that with IPython.display HTML, however I'd like to acheive my goal without pulling in libraries external to ipython, as it makes my notebook less portable.

Is there a better way to display the "markup" from a markdown file in a cell?

thanks
Steve
Email sent using Optus Webmail
_______________________________________________
IPython-User mailing list
IPython-User <at> scipy.org
http://mail.scipy.org/mailman/listinfo/ipython-user
Jean-Luc Stevens | 7 Jul 01:17 2015
Picon
Picon

ANN: HoloViews 1.3 released

We are pleased to announce the fourth public release of HoloViews,
a Python package for simplifying the exploration of scientific data:

   http://holoviews.org

HoloViews provides composable, sliceable, declarative data
structures for building even complex visualizations easily.
The goal of HoloViews is to let your data just visualize itself,
allowing you to work with large datasets as easily as you work
with simple datatypes at the Python prompt.

You can obtain the new version using conda or pip:

   conda install -c ioam holoviews

   pip install --upgrade 'holoviews[recommended]'

This release includes a substantial number of new features and
API improvements, most of which have been suggested by our growing
userbase:

- Major optimizations throughout, both for working with HoloViews
   data structures and for visualization.

- Improved widget appearance and greatly reduced flickering
   issues when interactively exploring data in the browser.

- Improved handling of unicode and LaTeX text throughout,
   using Python 3's better unicode support (when available).

- New Polygons, ErrorBars, and Spread Element types.

- Support for multiple matplotlib backends (vanilla matplotlib, mpld3
   and nbagg) with support for other plotting systems (such as Bokeh)
   in development. Easily switching between backends allows you to take
   advantage of the unique features of each one, such as good SVG/PDF
   output, interactive zooming and panning, or 3D viewpoint control.

- Streamlined the API based on user feedback; now even more things
   "just work". This includes new, easy to use constructors for
   common Element types as well as easy conversion between them.

- More customizability of plot and style options, including easier
   control over font sizes, legend positions, background color, and
   multiple color bars. Polar projections now supported throughout.

- More flexible and customizable Layouts, allowing the user to
   define blank spaces (using the Empty object) as well as more
   control over positioning and aspect ratios.

- Support for a holoviews.rc file, integration with IPython Notebook
   interact widgets, improvements to the Pandas interface, easy
   saving and loading of data via pickling, and much more.

And of course we have fixed a number of bugs found by our very
dedicated users; please keep filing Github issues if you find any!

For the full list of changes, see:

   https://github.com/ioam/holoviews/releases

HoloViews remains freely available under a BSD license, is Python 2
and 3 compatible, and has minimal external dependencies, making it
easy to integrate into your workflow. Try out the extensive tutorials
at holoviews.org today, and check out our upcoming SciPy and EuroSciPy
talks in Austin and Cambridge (or read the paper at http://goo.gl/NH9FTB)!

Philipp Rudiger
Jean-Luc R. Stevens
James A. Bednar

The University of Edinburgh
School of Informatics

--

-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
Charles Fox | 24 Jun 14:42 2015
Picon

Fast jump to error lines?

Hi all,

I just joined this list to ask a question that's been bugging me for ages, I wonder if anyone has any suggestions:

I'd like to optimize my IPython workflow some more.   I work in IPython and vim, using "ed" to enter Vim for ipython.   When my program dies I see the backtrace, make a mental note of the file and line number of the error, type "ed <filename>" then use ":" in vim to jump to the error line.   I'd like to reduce the cognitive load here by defining an ipython command that does this automatically.   So when I see the backtrace, I type a command and it opens vim with the right file and error line.

I think like most iPython users, doing this debuging dance takes up a significant portion of my day, so it seems worth automating.   But it seems strange that no-one has already built this yet -- is there some reason  for that?   Maybe some feature already exists to do this that I don't yet know about?   Or is there a technical problem to build it?

Is anyone else wanting a tool like this?

I looked at IPython internals just a little bit to tweak the debugger displays before, but I'm not sure where this feature would live, or how to access the backtrace text from the ipython console programatically.   I'd want to parse out the filename and line number than open vim with "+<linenumber>", from within IPython code.  Any suggestions could be really useful?   Could it be done as a magic or does it need changes to IPython code itself?


_______________________________________________
IPython-User mailing list
IPython-User <at> scipy.org
http://mail.scipy.org/mailman/listinfo/ipython-user
triccare | 11 May 16:10 2015
Picon

How to flag code cells to not execute

Greetings,

Often I find myself trying a number of things, creating many, many code
cells. Eventually, I get a set of code cells that do what I want.

However, I do not want to delete the less-desirable code cells, either to
remember what was tried, or provide alternate methods.  But, on reloading
the notebook and/or re-running all the cells, it would be great to be able
to flag these cells to not execute.

Changing the cell type will loose the code formatting. I want the cells to
remain code cells, just not actually execute the code.

Is there a way to get the above? And if not, this would be a feature
request.

Thank you for your time,
t

--
View this message in context: http://python.6.x6.nabble.com/How-to-flag-code-cells-to-not-execute-tp5094568.html
Sent from the IPython - User mailing list archive at Nabble.com.
Emanuele Olivetti | 4 May 16:27 2015

Issues with IPython and emacs (in ubuntu 14.04)

Hi,

I recently upgraded my laptop from Ubuntu 12.04 LTS to 14.04 LTS. As a
consequence, IPython was upgraded from v0.12.1 to v1.2.1. I am very happy
with the more recent IPython, but I am also experiencing a number of
issues with its use within emacs, both v23 and v24, like: "py-execute-buffer"
(C-c C-c) not working, "py-execute-region" (C-c |) not working, TAB-completion
not working, among others.
With IPython v.0.12.1 everything was working well within emacs.

I followed these instructions on the IPython website:
   http://ipython.org/ipython-doc/1/config/editors.html
and removed all my emacs customizations in order to understand where the
issue is. My .emacs is now just
   (require 'ipython)
as suggested there. Notice that the python-mode package shipped with
Ubuntu 14.04 is v6.1.3, which should be recent enough.

I also tried the instructions for the more recent IPtyhon v3.x:
http://ipython.org/ipython-doc/3/config/details.html#editor-configuration
Which boil down to:
   (require 'python)
   (setq python-shell-interpreter "ipython")
Still no luck.

I then upgraded python-mode.el with the most recent one (dev, i.e >v0.6.2.0)
available from here:
   https://launchpad.net/python-mode
and many issues disappeared with the following .emacs:
   (add-to-list 'load-path "/PATH_TO/python-mode/")
   (setq py-install-directory "/PATH_TO/python-mode/")
   (require 'ipython)
   (setq python-shell-interpreter "ipython")
   (require 'python-mode)

Still "py-execute-region" (C-c |) is not working, with different output in
emacs v24 ("Indentation error") vs. emacs v23 (hangs).

What is your working set-up for emacs and IPython? Is there a way to make
it work well as it was before?

Thanks,

Emanuele
Anton Shatenfeld | 25 Apr 08:06 2015

Key "b" does not work

Hi,

For some reason I can't use "b" key in iPython, when I press "b" it does not appear in the input, but it makes a noise like a bell character, on the other hand "B" (Shift + "b") works fine.

I use:
OS X 10.10.3
Darwin Kernel Version 14.3.0
Terminal Version 2.5.3 (343.7)
bash-3.2
Python 3.4.2 and Python 2.7.6
IPython 3.1.0

The regular Python shell works fine.

Best,
Anton.
_______________________________________________
IPython-User mailing list
IPython-User <at> scipy.org
http://mail.scipy.org/mailman/listinfo/ipython-user
Stefan Urbanek | 24 Apr 23:34 2015
Picon

Passing authenticated per-user identity to the server

Hi,

We are running the iPython server (built-in server) to which multiple users are being connected. The users are connecting to a database using SQLAlchemy. We want every user to connect to the database using his own credentials – we don't want to store the connection URL in the notebook. We can put the proper authorization into our library that the user will use in the notebook: special password, host based authorization, ... does not matter, the library can take care of that. However, we need to pass the information about the user (username, id, key, ...) to the library through the server. Something like this:

    from ourdblib import connect

    connnection = connect()

the connect() should get the user credentials for that particular user-browser session somehow (environment variable, python object, notebook variable, ...) . We can provide our own authentication, we can even have a front-end that can pass wsgi params or something, we just need to be able to pass the user's identity to the notebook server so it can be passed to the library.

In other words: if I'm using ipython notebook on the server, I want the server know about me. We can have our own tools to verify me and pass my identity to the server. What is the way to pass this information to the server?


How can we do that?

Thanks,

Stefan
--
I brew data.

Twitter: <at> Stiivi

_______________________________________________
IPython-User mailing list
IPython-User <at> scipy.org
http://mail.scipy.org/mailman/listinfo/ipython-user
Mike Sam | 20 Apr 20:00 2015
Picon

Long running notebooks

What is the best way to run long running (few hours) notebooks where you can close the laptop and come back to a running notebook and sync back to where things are?

Thanks,
Mike
_______________________________________________
IPython-User mailing list
IPython-User <at> scipy.org
http://mail.scipy.org/mailman/listinfo/ipython-user
Rob Clewley | 19 Apr 02:14 2015
Picon

ipython notebook config options ignored unless placed in regular config file

Hi,

I'm using OS X 10.6.8 with ipython that I upgraded from v1 (from fink)
to 3.0.0 (using pip). Everything seems to work fine, except an issue
with configuration.

>From the documentation and my own testing, I am having trouble
understanding the expected behavior of config options in my
.ipython/profile_default/ipython_config.py versus the
ipython_notebook_config.py.

I want to auto-load a couple of extensions and modules for my
notebooks but not for my regular ipython sessions (partly because
those loads create warnings, but it just seems that I'm supposed to be
able to keep these configurations separate). It seemed to make sense
that config options that apply only to the notebook go in the notebook
config. But I can only get the notebook to honour my choices when I
put the options in ipython_config.py. It seems to ignore the notebook
config, and I am stuck with non-notebook ipython also loading these
modules. Am I doing something wrong?

The documentation does not explicitly address the distinctions, and
the inline comments in these files do not make reference to the
distinction between these two config files, only to inheritance of
TerminalIPythonApp from Application and InteractiveShellApp (but same
class names in both config files). What is the rule for notebook
config reading? Does ipython read from one first, then the other?
Currently, it seems to ignore the ipython_notebook_config.py
altogether, so why is it there?

Maybe it's related to this from 2013:
http://mail.scipy.org/pipermail/ipython-user/2013-February/012170.html
But the commit that fixed his problem is in the master repo now, so
maybe not...

The result of ipython notebook --debug is

[D 10:37:52.595 NotebookApp] Config changed:
[D 10:37:52.595 NotebookApp] {'NotebookApp': {'log_level': 10}}
[D 10:37:52.596 NotebookApp] IPYTHONDIR set to: /Users/robclewley/.ipython
[I 10:37:52.598 NotebookApp] Using existing profile dir:
u'/Users/robclewley/.ipython/profile_default'
[D 10:37:52.598 NotebookApp] Searching path
[u'/Users/robclewley/Work/literate_modeling/scenario-local-linear/notebook/project',
u'/Users/robclewley/.ipython/profile_default',
'/usr/local/etc/ipython', '/etc/ipython'] for config files
[D 10:37:52.598 NotebookApp] Attempting to load config file: ipython_config.py
[D 10:37:52.600 NotebookApp] Loaded config file:
/Users/robclewley/.ipython/profile_default/ipython_config.py
[D 10:37:52.601 NotebookApp] Config changed:
[D 10:37:52.601 NotebookApp] {'TerminalInteractiveShell': {'logstart':
True}, 'NotebookApp': {'log_level': 10}, 'TerminalIPythonApp':
{'matplotlib': 'osx'}}
[D 10:37:52.602 NotebookApp] Attempting to load config file:
ipython_notebook_config.py
[D 10:37:52.604 NotebookApp] Loaded config file:
/Users/robclewley/.ipython/profile_default/ipython_notebook_config.py
[D 10:37:52.605 NotebookApp] Config changed:
[D 10:37:52.605 NotebookApp] {'TerminalInteractiveShell': {'logstart':
True}, 'NotebookApp': {'log_level': 10}, 'InteractiveShellApp':
{'exec_lines': ['import notebook_importing'], 'gui': 'osx', 'pylab':
'osx', 'matplotlib': 'osx', 'extensions': ['yaml_magic',
'autoreload'], 'extra_extension': 'yaml_magic'}, 'TerminalIPythonApp':
{'extra_extension': 'yaml_magic', 'extensions': ['yaml_magic'],
'matplotlib': 'osx'}}
[D 10:37:52.611 NotebookApp] searching for local mathjax in
[u'/Users/robclewley/.ipython/nbextensions',
'/sw/share/jupyter/nbextensions',
'/usr/local/share/jupyter/nbextensions',
'/usr/share/jupyter/nbextensions']
[D 10:37:52.613 NotebookApp] searching for local mathjax in
[u'/Users/robclewley/.ipython/profile_default/static',
'/sw/lib/python2.7/site-packages/IPython/html/static']
[I 10:37:52.613 NotebookApp] Using MathJax from CDN:
https://cdn.mathjax.org/mathjax/latest/MathJax.js

For instance, invoking the magic command %%yaml (from my custom
extension) in the notebook results in a complaint that the command is
not recognized. If, instead, I set these extensions to be loaded in
ipython_config.py, then the notebook accepts %%yaml immediately. In
this case, the debug output is:

[D 10:46:50.330 NotebookApp] Config changed:
[D 10:46:50.330 NotebookApp] {'NotebookApp': {'log_level': 10}}
[D 10:46:50.331 NotebookApp] IPYTHONDIR set to: /Users/robclewley/.ipython
[I 10:46:50.332 NotebookApp] Using existing profile dir:
u'/Users/robclewley/.ipython/profile_default'
[D 10:46:50.332 NotebookApp] Searching path
[u'/Users/robclewley/Work/literate_modeling/scenario-local-linear/notebook/project',
u'/Users/robclewley/.ipython/profile_default',
'/usr/local/etc/ipython', '/etc/ipython'] for config files
[D 10:46:50.332 NotebookApp] Attempting to load config file: ipython_config.py
[D 10:46:50.335 NotebookApp] Loaded config file:
/Users/robclewley/.ipython/profile_default/ipython_config.py
[D 10:46:50.336 NotebookApp] Config changed:
[D 10:46:50.337 NotebookApp] {'TerminalInteractiveShell': {'logstart':
True}, 'NotebookApp': {'log_level': 10}, 'InteractiveShellApp':
{'extensions': ['yaml_magic', 'autoreload']}, 'TerminalIPythonApp':
{'matplotlib': 'osx'}}
[D 10:46:50.337 NotebookApp] Attempting to load config file:
ipython_notebook_config.py
[D 10:46:50.338 NotebookApp] Loaded config file:
/Users/robclewley/.ipython/profile_default/ipython_notebook_config.py
[D 10:46:50.339 NotebookApp] Config changed:
[D 10:46:50.340 NotebookApp] {'TerminalInteractiveShell': {'logstart':
True}, 'NotebookApp': {'log_level': 10}, 'InteractiveShellApp':
{'extra_extension': 'yaml_magic', 'extensions': ['yaml_magic',
'autoreload'], 'exec_lines': ['import notebook_importing'], 'gui':
'osx', 'pylab': 'osx', 'matplotlib': 'osx'}, 'TerminalIPythonApp':
{'extra_extension': 'yaml_magic', 'extensions': ['yaml_magic'],
'matplotlib': 'osx'}}
[D 10:46:50.345 NotebookApp] searching for local mathjax in
[u'/Users/robclewley/.ipython/nbextensions',
'/sw/share/jupyter/nbextensions',
'/usr/local/share/jupyter/nbextensions',
'/usr/share/jupyter/nbextensions']
[D 10:46:50.345 NotebookApp] searching for local mathjax in
[u'/Users/robclewley/.ipython/profile_default/static',
'/sw/lib/python2.7/site-packages/IPython/html/static']

Thanks.

Gmane