gregsexton / gregsexton/ob-ipython

RESULTS: return lisp form rather than python representations of results

Open
#98 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Emacs Lisp
Stars
742
Forks
107
PR merge metrics
No merged PRs in 30d

Description

Hello ob-ipython looks like a fantastic tool. I installed it and it looks great. It seems though to return emacs lips results instead of the python representation of the results. Tracing through the code, it looks like ob-python.el does a conversion. I am not a regular emacs lisp user and a I am new to org-mode so I apologize if I am missing something obvious.

I am using a fresh install of org 9.03 and git clone of ob-ipython (I get the same results with elpa install). I am using emacs 25.1.1 on Mac OS (emacs-plus build in home brew)

Examples of how to use results collection and type in headers

#+TBLNAME: data_table
| a | 1 | 2 |
| b | 2 | 3 |
| c | 3 | 4 |

#+BEGIN_SRC ipython :session :exports both :var x=2 :var data=data_table
(x, data)
#+END_SRC

#+RESULTS:
| 2 | ((a 1 2) (b 2 3) (c 3 4)) |

* raw - ":results output raw" - gets rid of formating

#+BEGIN_SRC ipython :session :exports both :var x=2 :var data=data_table :results output raw
print("example of output")
(x, data, [[1,2],3])
#+END_SRC

#+RESULTS:
example of output

* output - capture stdout - ":results output" by itself

#+BEGIN_SRC ipython :session :exports both :var x=2 :var data=data_table :results output
print("example of output")
(x, data, [[1,2],3])
#+END_SRC

#+RESULTS:
: example of output
example of output

* just ":results value" by itself - stdout will now pop up in a buffer

#+BEGIN_SRC ipython :session :exports both :var x=2 :var data=data_table :results value
print("example of output")
(x, data, [[1,2],3])
#+END_SRC

#+RESULTS:
| 2 | ((a 1 2) (b 2 3) (c 3 4)) | ((1 2) 3) |

* pretty printing? - ":results value pp"

#+BEGIN_SRC ipython :session :exports both :var x=2 :var data=data_table :results value pp
(x, data, [[1,2],3])
#+END_SRC

#+RESULTS:
| 2 | ((a 1 2) (b 2 3) (c 3 4)) | ((1 2) 3) |

* "results value drawer"

#+BEGIN_SRC ipython :session :exports both :var x=2 :var data=data_table :results value drawer
(x, data, [[1,2],3])
#+END_SRC

#+RESULTS:
:RESULTS:
| 2 | ((a 1 2) (b 2 3) (c 3 4)) | ((1 2) 3) |
:END:

* "results value code"

#+BEGIN_SRC ipython :session :exports both :var x=2 :var data=data_table :results value code
(x, data, [[1,2],3])
#+END_SRC

#+RESULTS:
#+BEGIN_SRC ipython
| 2 | ((a 1 2) (b 2 3) (c 3 4)) | ((1 2) 3) |
#+END_SRC

* "results value raw"

#+BEGIN_SRC ipython :session :exports both :var x=2 :var data=data_table :results value raw
(x, data, [[1,2],3])
#+END_SRC

#+RESULTS:
| 2 | ((a 1 2) (b 2 3) (c 3 4)) | ((1 2) 3) |

* ":results value verbatim"

#+BEGIN_SRC ipython :session :exports both :var x=2 :var data=data_table :results value verbatim
(x, data, [[1,2],3])
#+END_SRC

#+RESULTS:
| 2 | ((a 1 2) (b 2 3) (c 3 4)) | ((1 2) 3) |

* ":results value list"

#+BEGIN_SRC ipython :session :exports both :var x=2 :var data=data_table :results value list
(x, data, [[1,2],3])
#+END_SRC

#+RESULTS:
- 2
- (("a" 1 2) ("b" 2 3) ("c" 3 4))
- ((1 2) 3)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.