From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id sJIMMzEA0WPGmAAAbAwnHQ (envelope-from ) for ; Wed, 25 Jan 2023 11:10:57 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id QBfzMjEA0WNbZQAAauVa8A (envelope-from ) for ; Wed, 25 Jan 2023 11:10:57 +0100 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 8C3D6181AA for ; Wed, 25 Jan 2023 11:10:57 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pKcjU-0001hD-7B; Wed, 25 Jan 2023 05:10:20 -0500 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 1pKcjS-0001gs-MP for help-guix@gnu.org; Wed, 25 Jan 2023 05:10:18 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pKcjR-00046b-1w for help-guix@gnu.org; Wed, 25 Jan 2023 05:10:18 -0500 Received: by mail-wm1-x32d.google.com with SMTP id l41-20020a05600c1d2900b003daf986faaeso879670wms.3 for ; Wed, 25 Jan 2023 02:10:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:to:from :from:to:cc:subject:date:message-id:reply-to; bh=OGzlMbajOm+m1PtySIEZrKldVMQEOgFuNIIKR7y+35c=; b=YFPt1SrC+lXNK7aFwuc85o3H6hRs2XrNpO3S/m27emJeGQGawWS6Pp6EC5It+Y5Szy wNIpHJydLKeG9Bx5Hdcz2mVfZwz1jPntTn2p27VhJ3c5zzS6fKB1qFiQbkBICyYBsAn+ EIl4YHoZgsgDCTkvKLci9KOvsbipvT+f1JPWyGYsbtFrYr9rh/EAT5Y0cAgOTQp9EcPJ rnKKsmTdbHTg0+9nnut9gGktG0fjH/618QpO2FpiqCQjf5bq2hq71rhoHnTGH+EwV88L 49Gwa4P1hGCY10y8/uSURijr9wPE+mETWGrWOpPJb07Sc0rCizK20Y07xyd4BZ7GV86J 8MEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=OGzlMbajOm+m1PtySIEZrKldVMQEOgFuNIIKR7y+35c=; b=ZQK4FZ4F6IVTQTqPWro4MAOiv68x8U/y3wnH09GimjOOygoFX1JqWoQ9cLUIlvV9GB GKaOaDcSfvAH/ehKLQBJgtKWkOpxxSxRyY2OSwetQAV6QPFulVV09Fq6wdbWwdKLL9Io Dj8Qi1dCIPVdiqPf/sdudMJ+CVh9B/aQPiQsA7TQVjooDR9RU161Yh9LjnoDkkDhFLcD sEo/L7/7IeH9cjQdM8sDNHnvo7M/xW3TaUOwU6Y2L539uEbSuugxJU/vV8RX+HHXBsn8 /33q6feXLVGnRbaD9RXcDxpPwnoRoONrgBDQG7VV2kfHb8uUkNYN/tvErWmajavVpfNq lH5A== X-Gm-Message-State: AFqh2koHQ6QQRhWoh/aVFu2uVjsKebPMiRl2JcHbzgBTGPRLfu4wcoB3 g9i3gJZjk4AAGi2Y03oJeJIgv40VxHs= X-Google-Smtp-Source: AMrXdXuzuzOjTRt0wEV7frquCNtQOqVO6OdaTB8pAqfbWz1tg+NQ9HtAyzGm5l6P37m+2FCDA/30hA== X-Received: by 2002:a05:600c:3b06:b0:3d3:446a:b493 with SMTP id m6-20020a05600c3b0600b003d3446ab493mr8423555wms.4.1674641415407; Wed, 25 Jan 2023 02:10:15 -0800 (PST) Received: from lili ([2a01:e0a:59b:9120:65d2:2476:f637:db1e]) by smtp.gmail.com with ESMTPSA id r9-20020a5d6949000000b002be36beb2d9sm3882505wrw.113.2023.01.25.02.10.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jan 2023 02:10:15 -0800 (PST) From: zimoun To: jgart , help-guix@gnu.org Subject: Re: shebang for python script? In-Reply-To: References: Date: Wed, 25 Jan 2023 10:35:17 +0100 Message-ID: <86zga7554a.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=zimon.toutoune@gmail.com; helo=mail-wm1-x32d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-guix@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+larch=yhetil.org@gnu.org Sender: help-guix-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1674641457; a=rsa-sha256; cv=none; b=ss39ERdkypV9/4/jPucnB+kbd0Xkr1mny9tsfE0FafsHIZbdy32zAwaqssjUaXScojj2sL f7z1RfzLymXQgFSj3yZxV2qT3gAwA39L77UsJPVqsymdDCHHItBJAAg73/9JjF+hjnQckV ELeEy83Qmd/+CtSVGptSDvOfay+j+bwnErayMjVhuycBH2oMeD80zMz+MDR1DJZiA+5bBp D/EOGz8t1IiR0CoEVA1RAAEyTTJr4R1KC9RHyxRwEuVfuUhHuPFUHw0APZw0WjMRKSzvwA HNmQAsxZnryo/XmV74V9jfh4L67c/ekCQdVRkTodgvy6t16kmk//OrhZ8zpDoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1674641457; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=OGzlMbajOm+m1PtySIEZrKldVMQEOgFuNIIKR7y+35c=; b=gDVm97BuT8/WHP8y1rBjPsbPTjUIqifjJKmSFj2R8TCKHu37GuJOIYkJjw+AOdMHdFwZb0 SYjRG3fx81k555N+dNDDEiGIiljqD57GtT61BG/avxZLNMyq7HX5kUEov82UYAgLEtrTil StgHG0FcA385FQZttjobrJkd2wwvyZ7w86Un3nmwgYu2uh6tC3nzR9Jo4kVVEkA+N8d32R X0NI0IhL2XYoTF91+Y7aDG5FDV2IbT0jRRqZQ5qChxpN/1GsjrgTyBAEO0M0RHJLcHRJLq k41dYI/er5/vsuYtebgm6iUjO44MAAGaU13ZWXkJMhVY1E47ie7ZxD1zEWJceg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=YFPt1SrC; spf=pass (aspmx1.migadu.com: domain of "help-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="help-guix-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gmail.com X-Migadu-Scanner: scn0.migadu.com X-Migadu-Spam-Score: -7.05 X-Spam-Score: -7.05 X-Migadu-Queue-Id: 8C3D6181AA Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=YFPt1SrC; spf=pass (aspmx1.migadu.com: domain of "help-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="help-guix-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gmail.com X-TUID: xeFIGMzzYWGJ Hi, On Wed, 25 Jan 2023 at 06:09, "jgart" wrote: > What's the current recommended way to do this in Guix? > > #!/usr/bin/env nix-shell > #!nix-shell -i python3 -p "python3.withPackages(ps: [ ps.numpy ])" > import numpy as np > a = np.array([1,2]) > b = np.array([3,4]) > print(f"The dot product of {a} and {b} is: {np.dot(a, b)}") Something like: --8<---------------cut here---------------start------------->8--- #!/usr/bin/env -S guix shell python -- python3 import numpy as np a = np.array([1,2]) b = np.array([3,4]) print(f"The dot product of {a} and {b} is: {np.dot(a, b)}") --8<---------------cut here---------------end--------------->8--- works for me. And to answer your other question about specific revision, I would do: --8<---------------cut here---------------start------------->8--- #!/usr/bin/env -S guix time-machine --commit=29efa27 -- shell python -- python3 import numpy as np a = np.array([1,2]) b = np.array([3,4]) print(f"The dot product of {a} and {b} is: {np.dot(a, b)}") --8<---------------cut here---------------end--------------->8--- Cheers, simon