From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id yG3tBCcL3mTJPQAASxT56A (envelope-from ) for ; Thu, 17 Aug 2023 13:57:27 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id sK+5BCcL3mTiGQAAauVa8A (envelope-from ) for ; Thu, 17 Aug 2023 13:57:27 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 9ABC63B1B5 for ; Thu, 17 Aug 2023 13:57:26 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=C9ryHaIU; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=posteo.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1692273446; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=8jzGoFlLLwLd36WSj5PK1jyWVTU+qY2v79QricjEsmM=; b=cYyfh86YyWxc9f8lWaIsG4W/LF5O3waxcPnnffiGUS1aYEyTubbk2MWiDuCDVhRN3sDpTX KW/MO2n2ShzjzVHttURlyyH16Qw0gVIalblDEqbQ058KwhPnJjBc15cDbVUoewztKw5V5Y JR7kpklL0bacGVe2HW1abVJ7Mv3znxx9CCHR02k0UAE/ppD4jWpsDoL6gx6yUuBqxy4HbP O7K1lclr7SPk8zE47oPMjIkkU8wNXMUsUvwFC7zMaINu4kuBmBG3XJmX6rMFrKa6N7jQ/k c19N99noHgOeZHm18buSNUvm65a/pz1IFPfEmx9Wvtpr5UnOaYC58/lkmfB0vQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=C9ryHaIU; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=posteo.net ARC-Seal: i=1; s=key1; d=yhetil.org; t=1692273446; a=rsa-sha256; cv=none; b=b21J4rb16udbXfwjfI2ipAldMuVfz2jxjeRIP57shOizgvIvpzc4OdX7NSKnsdJdmAzs7c 6MRAc2dGrZBeJCb22wqdlBYO713KQfjH3gqjD06fRA4tTklhGRfMkql1elGvpbdFzAbVrZ y5IEQlap/j/0WY0SCLaHhrynHi/2AGDKPAaf+1KMb4vu2ffXhXwiHCnYOHRq+3yyUHEPfr K4JhAblwMXSxKspL59jVe4iWOXHHA7WwcwuHElUZX58MMfKj2GiAcNSAx78y65qTNleDPq 50Oq5P9VZAasmYZhVT0CxwLo67X9R1USrNl4darN6pBveMcfVxUTgB6x8XFwDQ== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qWbcK-0002bM-VB; Thu, 17 Aug 2023 07:56:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qWbcI-0002b3-OF for emacs-orgmode@gnu.org; Thu, 17 Aug 2023 07:56:43 -0400 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qWbcF-0000PX-OO for emacs-orgmode@gnu.org; Thu, 17 Aug 2023 07:56:42 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 9280F240106 for ; Thu, 17 Aug 2023 13:56:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1692273397; bh=upjTWNu+ty82W6ikDFTYa0TULVk9FhJhscYjDBjg/Uk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:From; b=C9ryHaIUP8QKwrNMH7s6ceiOEqAdariELTHJf/AKnwoQBItfkRvIqBX4MVgYXzzCK qEe3/SAKOQBQS4ZM5E/vQBhDbMWC2hyDSXB+WdDU/NkAwTuQ0TOdGYUXYPlsI2+Z/H uZzzNBfs52wwhT7TELZKZAieLA4cfCAI93dZKPyR026Xdbzj0BUt7kXXjdfPn9XEHV aIDmuvkaH/hdCjYLDVIai0cnLtUmRp1eIcufaiBfaxVofI9OknYbYCK8eLJLS04cav zAVCZlvq3NrXLzX8Tx+sP8mth2dYcow5uF4pTN2bcXyrmKSdyKaGCqLxp/ScKEZsOy LD3ph3lJsUrmQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4RRNl85mRXz9rxD; Thu, 17 Aug 2023 13:56:36 +0200 (CEST) From: Ihor Radchenko To: Jack Kamm Cc: emacs-orgmode@gnu.org, Liu Hui Subject: Re: [PATCH] ob-python results handling for dicts, dataframes, arrays, and plots In-Reply-To: <87a5ur6f7w.fsf@gmail.com> References: <87a5ur6f7w.fsf@gmail.com> Date: Thu, 17 Aug 2023 11:57:05 +0000 Message-ID: <87cyzlriem.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.66; envelope-from=yantar92@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -9.36 X-Spam-Score: -9.36 X-Migadu-Queue-Id: 9ABC63B1B5 X-Migadu-Scanner: mx1.migadu.com X-TUID: 5NICEfH4fpPa Jack Kamm 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 . Support Org development at , or support my work at