From: Ihor Radchenko <yantar92@posteo.net>
To: Jack Kamm <jackkamm@gmail.com>
Cc: emacs-orgmode@gnu.org, Liu Hui <liuhui1610@gmail.com>
Subject: Re: [PATCH] ob-python results handling for dicts, dataframes, arrays, and plots
Date: Thu, 17 Aug 2023 11:57:05 +0000 [thread overview]
Message-ID: <87cyzlriem.fsf@localhost> (raw)
In-Reply-To: <87a5ur6f7w.fsf@gmail.com>
Jack Kamm <jackkamm@gmail.com> writes:
> Following up on a discussion from last month [1], I am reviving my
> proposal from a couple years ago [2] to improve ob-python results
> handling. Since it's a relatively large change, I am sending it to the
> list for review before applying the patch.
Some comments on the patch itself.
> @@ -2041,8 +2056,8 @@ to switch to the new signature.
> *** Python session return values must be top-level expression statements
>
> Python blocks with ~:session :results value~ header arguments now only
> -return a value if the last line is a top-level expression statement.
> -Also, when a None value is returned, "None" will be printed under
> +return a value if the last line is a top-level expression statement,
> +otherwise the result is None. Also, None will now show up under
> "#+RESULTS:", as it already did with ~:results value~ for non-session
> blocks.
This is an ORG-NEWS entry for Version 9.4. Is it an intentional change?
> @@ -142,7 +144,9 @@ (defun org-babel-python-table-or-string (results)
> "Convert RESULTS into an appropriate elisp value.
> If the results look like a list or tuple, then convert them into an
> Emacs-lisp table, otherwise return the results as a string."
> - (let ((res (org-babel-script-escape results)))
> + (let ((res (if (string-equal "{" (substring results 0 1))
> + results ;don't covert dicts to elisp
> + (org-babel-script-escape results))))
You may also need to update the docstring for
`org-babel-python-table-or-string' after this change.
> - body)))
> - (`value (let ((tmp-file (org-babel-temp-file "python-")))
> + (if graphics-file
> + (format org-babel-python--output-graphics-wrapper
> + body graphics-file)
> + body))))
> + (`value (let ((results-file (or graphics-file
> + (org-babel-temp-file "python-"))))
What about :results graphics file ?
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
next prev parent reply other threads:[~2023-08-17 11:57 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-15 23:46 [PATCH] ob-python results handling for dicts, dataframes, arrays, and plots Jack Kamm
2023-08-16 9:32 ` Ihor Radchenko
2023-08-17 4:04 ` Jack Kamm
2023-08-17 9:14 ` gerard.vermeulen
2023-08-17 12:10 ` Ihor Radchenko
2023-08-18 4:37 ` gerard.vermeulen
2023-08-18 6:01 ` gerard.vermeulen
2023-08-18 23:30 ` Jack Kamm
2023-08-19 8:50 ` Ihor Radchenko
2023-08-20 18:01 ` Jack Kamm
2023-08-20 18:21 ` Ihor Radchenko
2023-08-19 8:58 ` Ihor Radchenko
2023-08-20 18:13 ` Jack Kamm
2023-08-20 18:25 ` Ihor Radchenko
2023-08-22 23:37 ` Jack Kamm
2023-08-17 12:07 ` Ihor Radchenko
2023-08-18 22:49 ` Jack Kamm
2023-08-17 5:35 ` Liu Hui
2023-08-18 23:09 ` Jack Kamm
2023-08-20 12:13 ` Liu Hui
2023-08-20 18:31 ` Jack Kamm
2023-08-21 6:21 ` Liu Hui
2023-08-22 23:44 ` Jack Kamm
2023-08-17 11:57 ` Ihor Radchenko [this message]
2023-08-18 23:18 ` Jack Kamm
2023-08-19 8:54 ` Ihor Radchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87cyzlriem.fsf@localhost \
--to=yantar92@posteo.net \
--cc=emacs-orgmode@gnu.org \
--cc=jackkamm@gmail.com \
--cc=liuhui1610@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.