From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id EF95DV9PomRB6gAASxT56A (envelope-from ) for ; Mon, 03 Jul 2023 06:32:31 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id KERoDV9PomSINgAAauVa8A (envelope-from ) for ; Mon, 03 Jul 2023 06:32:31 +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 2FAE013CE3 for ; Mon, 3 Jul 2023 06:32:30 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qGBDp-00073N-SK; Mon, 03 Jul 2023 00:31:33 -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 1qGBDo-000736-M1 for emacs-orgmode@gnu.org; Mon, 03 Jul 2023 00:31:32 -0400 Received: from mail-oi1-x231.google.com ([2607:f8b0:4864:20::231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qGBDm-0007Rf-U8 for emacs-orgmode@gnu.org; Mon, 03 Jul 2023 00:31:32 -0400 Received: by mail-oi1-x231.google.com with SMTP id 5614622812f47-3a3ad1f39ebso335631b6e.1 for ; Sun, 02 Jul 2023 21:31:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688358689; x=1690950689; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=1ttKw7S2EGWLahtyapUvPqCSXA78JrOpGtJMEnLFq5Q=; b=bV7i4okGXVXTKdkKLgobvvv/nUAb1gtsF1xupw1t659qRcHhp28ogSYj0Exu/xqQkp LsKViWAqO4rEd8FAuw1wyz/ULFMviX/dMTbjAmdft/Qd41NKl5xcql5vTrewuzR/GCHS HYnS5I0BzVhPlKoSxqac44WXacregolbGkD0syXRb49QdMFcCxPf1WwbCsth3VjTJILR Q54yU4blBacaz0ZvDftzFSrTWDqFkW6/bYKrGz+aU3aOFFG/OsfKWYRJVruK4VbJo1Xn 24Nvti7OMGLNRynvmh2qySV9Cz8Q1tlp6glWBuUjkpWaa5biHESRuCW4JdQop5gUMpdM mFwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688358689; x=1690950689; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=1ttKw7S2EGWLahtyapUvPqCSXA78JrOpGtJMEnLFq5Q=; b=JUvZYnFcxSyS/gSqwHlKSQLIEjXjprC1p76WN7qcNVbBDsRyVj/mSIBv3kaIY13pia 6R+tTB53SfFhB0+xrbxuXhXUhWU/qS7vmtRc3D4cR605MTgwDcyg2nI4xzAUJ6Lnli0P Y3ukkMz+hkrI8Fxk5zXe5DJZK8Wjhffk68z12jUAsF4e7XZG5WXr9E2qUvANWOCn3P1g pNM6FAQl+weZ+RPhHr/WJag3y7cdxiLdAT4vQYEvJ0l5mU8uH3yJAqltlQCkEpbAWfUz L9RzoF/Cd9/vPXECSjM61Hp+7dlBTZG1oBAyk7O6phsqFI2TO+ad57K5SI1bQFq8VpoA P5Zg== X-Gm-Message-State: ABy/qLYwXn3fgc2t+Tjeo66j/2rt6Lp12YMZEOc9OzvBbIfaLKtSK7xz p8G9eJsrl73Kt17B9DnYG0A9/ZJVCf2Nv2ScmKXjRYSuHdPDsw== X-Google-Smtp-Source: APBJJlEjK80S9DHFc7WuH3MRE7z3Vek4ZjSCWcotKKUHg67t0ndAS4s310yCto7+/7TZzmcjSgAxQTYjRNyt17I9kc4= X-Received: by 2002:a05:6808:1a17:b0:3a3:9b4a:3959 with SMTP id bk23-20020a0568081a1700b003a39b4a3959mr2426307oib.17.1688358688996; Sun, 02 Jul 2023 21:31:28 -0700 (PDT) MIME-Version: 1.0 From: Liu Hui Date: Mon, 3 Jul 2023 12:31:17 +0800 Message-ID: Subject: [PATCH] ob-python: support header argument `:results file graphics' To: emacs-orgmode@gnu.org Content-Type: multipart/mixed; boundary="000000000000e9614f05ff8da338" Received-SPF: pass client-ip=2607:f8b0:4864:20::231; envelope-from=liuhui1610@gmail.com; helo=mail-oi1-x231.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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-Country: US X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1688358750; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=1ttKw7S2EGWLahtyapUvPqCSXA78JrOpGtJMEnLFq5Q=; b=ZSXTNwj7sdIx0dSiZnmYsEoz6/LpYKyNglY04Bd11kIctJc5y2S5ae6/GBx59gFChtCywZ bz9yfzVVXIAwVcefLIpWudSjy0PzQzwCr8C4MPBmjkFA65G16y66hUn2vSLTzkSkVidLzA ppl+VdZ4Txtbq0GYyqFnCzWWVQYKxEDe0nOlWz1k8luEmPiybBNoIp/X62MBJxifG8gx/Y EwPBN2r7XU3FT9lA6oSxIPPPJTNtlkQc+fnivbJPBqE2KAJh/zyY0+8WZWQjgBBtq5tqds AMkHpDgI0NvDnwDkruiRSVb3WnWy/X9h+AFMIlvHIECq7pUfMYeXjWkD7b1zmg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=bV7i4okG; dmarc=pass (policy=none) header.from=gmail.com; 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" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1688358750; a=rsa-sha256; cv=none; b=RLNBbXcKN9yKcaiUQlPhOrxf3tiFPHKjXQnlG+8/KjsPidMwJvbqu/wXYk4EggB5YwrvBA 0euSKLGFiUV2Qq1pkBo7yAylV/iG+7O7DIH+Q91XpE7Gz3gMJHNWuVobb4kplRtqNyzERn sD2kLTprsgmzfYXW2srutb1M7d5EPqTiPBQXs/r//TzNTYFO8Vl45ZhA2E0sLZcd78TifX F9GDj1zGY+cZRirsnUSHu30b0ObB/TxDqBDQmDol94Jst07FaLoBsQyiwxh4t+bdyMFYNK 4Ogpq4IT63ooWR4r98NvN8Q8HH1PELiiCH26A9l2UgtN/mCxVHFYm0qgxAR1Vw== X-Migadu-Scanner: scn1.migadu.com X-Migadu-Spam-Score: -5.33 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=bV7i4okG; dmarc=pass (policy=none) header.from=gmail.com; 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" X-Migadu-Queue-Id: 2FAE013CE3 X-Spam-Score: -5.33 X-TUID: u9u9EUe8Q6ce --000000000000e9614f05ff8da338 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, This patch adds graphics output support for ob-python via matplotlib. Specifically, it allows to use header argument `:results file graphics' as follows: #+begin_src python :file "test.png" :results graphics file import matplotlib.pyplot as plt plt.plot([1,2,3,4,5]) #+end_src The feature is described in the documentation as follows and has been supported by ob-R, ob-julia, etc. > =E2=80=98graphics=E2=80=99 > When used along with =E2=80=98file=E2=80=99 type, the result is a li= nk to the file > specified in =E2=80=98:file=E2=80=99 header argument. --000000000000e9614f05ff8da338 Content-Type: text/x-patch; charset="US-ASCII"; name="0001-ob-python-support-header-argument-results-file-graph.patch" Content-Disposition: attachment; filename="0001-ob-python-support-header-argument-results-file-graph.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_ljmd577e0 RnJvbSBlZThkMjM2MzEwY2Q0YmRlNGUzMzYxMGIyYjc5NDAyMjg2MWZiZDZhIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBMaXUgSHVpIDxsaXVodWkxNjEwQGdtYWlsLmNvbT4KRGF0ZTog TW9uLCAzIEp1bCAyMDIzIDExOjEzOjU4ICswODAwClN1YmplY3Q6IFtQQVRDSF0gb2ItcHl0aG9u OiBzdXBwb3J0IGhlYWRlciBhcmd1bWVudCBgOnJlc3VsdHMgZmlsZSBncmFwaGljcycKCiogbGlz cC9vYi1weXRob24uZWwgKG9yZy1iYWJlbC1leGVjdXRlOnB5dGhvbik6IFNhdmUgY3VycmVudCBm aWd1cmUgdG8KZmlsZSB3aGVuIHRoZS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dSBuZWVkIHRvIHVzZSBtYXRwbG90bGliXAorIGZ1bmN0aW9u cywgc3VjaCBhcyBwbG90IGFuZCBpbXNob3csIHRvIHByb2R1Y2UgdGhlIGdyYXBoaWNzLicpCitl eGNlcHQgTW9kdWxlTm90Rm91bmRFcnJvcjoKKyAgICByYWlzZSBSdW50aW1lRXJyb3IoJ29iLXB5 dGhvbiBkZXBlbmRzIG9uIG1hdHBsb3RsaWIgZm9yIHNhdmluZyBncmFwaGljcycpCisiCisgICAg ICAgICAgb3V0LWZpbGUpKQorCiAoZGVmdmFyIG9yZy1iYWJlbC1weXRob24tYnVmZmVycyAnKCg6 ZGVmYXVsdCAuICIqUHl0aG9uKiIpKSkKIAogKGRlZnVuIG9yZy1iYWJlbC1weXRob24tc2Vzc2lv bi1idWZmZXIgKHNlc3Npb24pCi0tIAoyLjI1LjEKCg== --000000000000e9614f05ff8da338--