From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id 6DKyIxHau18IfwAA0tVLHw (envelope-from ) for ; Mon, 23 Nov 2020 15:49:37 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id 2BOfHxHau19NDgAA1q6Kng (envelope-from ) for ; Mon, 23 Nov 2020 15:49:37 +0000 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 9E9B9940630 for ; Mon, 23 Nov 2020 15:49:35 +0000 (UTC) Received: from localhost ([::1]:38314 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1khE5u-0000nD-Ci for larch@yhetil.org; Mon, 23 Nov 2020 10:49:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33152) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1khE3P-0006Ia-OZ for emacs-orgmode@gnu.org; Mon, 23 Nov 2020 10:46:59 -0500 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:57599) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1khE3J-0000i4-LR for emacs-orgmode@gnu.org; Mon, 23 Nov 2020 10:46:59 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 23A555C0160 for ; Mon, 23 Nov 2020 10:46:50 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Mon, 23 Nov 2020 10:46:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.fm; h= from:to:subject:date:message-id:mime-version:content-type; s= fm1; bh=+1agA1iZbgaT4li3aRY8IRHMciQFRLAgttrIAIibqhU=; b=iyPm3CAh kkWt6ajQIldmS9skQBnS1WaRkQ4R2+uwUktxFsbER8ozSoDDqV0Pm3B8nSWHa5I2 8ll86dFfMjOL0AVjhgnZ2CgJKM1FHS2XpbHPyqX5T8kYjYsTE9HeKWMz/w1IhvS+ LeRvCry0twuzPUY9S4NtekEbfpDtDKjlQVFtIwK+HcsDFCZNWXU3M9wb+6vEW0tg yG9OVbv2kEGhRbQ4cPBp6teH1bMmus+MZyDAQ3MloWsdGbuZ3MogXO39EBZ7ZaNe Bbp4TWymSlJy1UpxC1xmV/9NWWa3uIe/n00XjCibo/nEWMaGb7yYZiK0Z+h9nYwN /DEKizs6WaLy7Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:message-id :mime-version:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=+1agA1iZbgaT4li3aRY8IRHMciQFR LAgttrIAIibqhU=; b=jlOO+URDne53HO1DkjwOcnnk7XlmRu4OPeUmW4EAlu745 hrzPmBZCWHR7P2iFnRp+vKwn9f1SXQ9/RAnnVovgPNG+cNnW2X5/ukqJC4Xv+WSU 7XNmL8cTYnOV5hWNy49FZRUsoA7yKgwvOBtoqTcg8vT7Xh2M0dq34xiqAmeAFAQC WyBf0VjNGwPAgaVN7JPstdMCYu4r2yKZmmQh4A8umBEB8t4eGZdMYfZjrb1uNWVc fvM7lMkpuq0K9LGBM0hJJBOY/KrD1lgBaptWd/HyRiyyR4jXT/HLQrVqdTsnYXMA 1Lcat3wBtP5nI7ljMP8qmXsCwJ+KCIjmm8wb9UqDg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrudegiedgkedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpegfhffvufffkfggtgesthdtredttd ertdenucfhrhhomheplfhoohhsthcumfhrvghmvghrshcuoehjohhoshhtkhhrvghmvghr shesfhgrshhtmhgrihhlrdhfmheqnecuggftrfgrthhtvghrnhepudeufedttefgleekhe eihfegtdelvdeutddvvedukedtieffiefhgfdvhfdtudefnecukfhppeelhedrledtrddv vdegrddvfeefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepjhhoohhsthhkrhgvmhgvrhhssehfrghsthhmrghilhdrfhhm X-ME-Proxy: Received: from Swift.fastmail.com (ip5f5ae0e9.dynamic.kabel-deutschland.de [95.90.224.233]) by mail.messagingengine.com (Postfix) with ESMTPA id 311683064ABF for ; Mon, 23 Nov 2020 10:46:49 -0500 (EST) User-agent: mu4e 1.5.6; emacs 27.1.50 From: Joost Kremers To: emacs-orgmode@gnu.org Subject: ob-python: import local package into a session Date: Mon, 23 Nov 2020 16:46:46 +0100 Message-ID: <87eekkt6s9.fsf@fastmail.fm> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=66.111.4.26; envelope-from=joostkremers@fastmail.fm; helo=out2-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-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.23 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" X-Scanner: ns3122888.ip-94-23-21.eu Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=fastmail.fm header.s=fm1 header.b=iyPm3CAh; dkim=pass header.d=messagingengine.com header.s=fm1 header.b=jlOO+URD; dmarc=pass (policy=none) header.from=fastmail.fm; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: -1.71 X-TUID: Zyf/Ox5bLwwC Hi all, If I have an Org file with Python source blocks, I can run them in a session with the `:session` header arg. That way, I can include packages installed in `site-packages` and have them available in all code blocks. But is there a way to import my own packages into a session? In particular, packages I haven't installed system-wide? What I'm trying to do is to import a Python file with a bunch of utility functions into the ob-python session. I thought this might be possible if I'd structure my code as a regular Python package, because that works if I want to import my utility functions into another Python file. But it doesn't seem to work for the ob-python session. Is there a way to achieve this? I don't *have* to structure my utility functions as a Python package, so if there's another way of doing this, I'd be interested as well. TIA Joost -- Joost Kremers Life has its moments