From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id qPktF4fhEGBkGwAA0tVLHw (envelope-from ) for ; Wed, 27 Jan 2021 03:44:07 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id 8IDvEofhEGDVKQAAB5/wlQ (envelope-from ) for ; Wed, 27 Jan 2021 03:44:07 +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 AC02B9402C2 for ; Wed, 27 Jan 2021 03:44:06 +0000 (UTC) Received: from localhost ([::1]:44100 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l4bkT-0002I2-NF for larch@yhetil.org; Tue, 26 Jan 2021 22:44:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54576) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l4bk3-0002GE-NM for guix-devel@gnu.org; Tue, 26 Jan 2021 22:43:39 -0500 Received: from mail-qk1-x730.google.com ([2607:f8b0:4864:20::730]:44507) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l4bjx-0003FY-J5 for guix-devel@gnu.org; Tue, 26 Jan 2021 22:43:39 -0500 Received: by mail-qk1-x730.google.com with SMTP id v126so556681qkd.11 for ; Tue, 26 Jan 2021 19:43:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=Ll/TGcGQqnY2Wpgg8xTSD3LojTpauaIqIvfkCGYQh4E=; b=Bj5YIbut3tjwO6tetvkb9CjdVcLvPjix/GNxBIXxAm0RHJBdVqW3N25JtPTX3F0p+P 9X2U5LQbTs1GFozflZbKHBMRDuoO/N6k4FBBDS3F/9GR5cdZm8cO8NAyMBeN2iFf0VMe 2T2N23HBhtTyQ2hUsjbr4AxZWW3+x9yssm16yTMB4jSzI+ok3tAVAMHJqkswT48ZAyWU +pNX7YajfIu9Av1fAfLO4eocVPPlLna/ZiUa6T8wvgPQVjWHd4xULg8YS+ax0WtqiW9b 0/vwpPy/fc8gJw6wiw8S/bK/tX6vQkcNG96y6Cl6B6HO8nwQJR7BezurfkM6kqh9IOLc scDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=Ll/TGcGQqnY2Wpgg8xTSD3LojTpauaIqIvfkCGYQh4E=; b=KK3caDMxpF1e5gjPjAThQ8aH/IyZJJXF/bSRHHnpIbgiYFHA5nMRVtxg+Q3qRh2GBL /+WQnKbLKIoqcfH80GaOdjbUlS7Hp3rCPL6EdxxvKG+V/hrSrngD0VpT7ZA7A9CgFJ7o 9JRm0OE1ZbYpBEkL57yiuLWjIDxWbOtDtOv5T1vBRCj8HqWEyK9qHnXxOueJjIwqjMc2 I4ju0Qsdl11F1I5zl6YIIEvhYafwk6gDs9u7FBdFik5oLPkEtEbXcfF3G6Lx1l9o2rTX y08HMSUQAlZA8NubRyFNRrG3NQb2Q/w/UaQQ0rfV1ha68WVSoZ6TdWT5l5Rn5mLvdQ3d 3HCg== X-Gm-Message-State: AOAM531g/ANmbeo6c8EqHX4AXOCe9H04ZvaQ9CY0B40WNy3sMiTdLZpo G5lZOMDcoUnuaSTVaIyEZ7fqbAvFMWM= X-Google-Smtp-Source: ABdhPJx3gVW8jOFSKdI+gvPuPPqAm7238eKsoHIeFmvtNIo5BfZA3CkdL2jCq1suYYCE7foDRDccpA== X-Received: by 2002:a37:6697:: with SMTP id a145mr3797211qkc.255.1611719012005; Tue, 26 Jan 2021 19:43:32 -0800 (PST) Received: from hurd (dsl-10-132-34.b2b2c.ca. [72.10.132.34]) by smtp.gmail.com with ESMTPSA id f26sm499511qtp.97.2021.01.26.19.43.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jan 2021 19:43:30 -0800 (PST) From: Maxim Cournoyer To: Tanguy LE CARROUR Subject: Re: Questions regarding Python packaging References: <20201108142717.lmud5h4gh44vtjc6@melmoth> <1609946775.8blxygrg9p.astroid@rafflesia.none> <1611303651.35tpgtn1z1.astroid@melmoth.none> <1611645480.1t06ie9pyf.astroid@melmoth.none> Date: Tue, 26 Jan 2021 22:43:29 -0500 In-Reply-To: <1611645480.1t06ie9pyf.astroid@melmoth.none> (Tanguy LE CARROUR's message of "Tue, 26 Jan 2021 08:21:22 +0100") Message-ID: <87im7j11um.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2607:f8b0:4864:20::730; envelope-from=maxim.cournoyer@gmail.com; helo=mail-qk1-x730.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: guix-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Guix Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -1.25 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20161025 header.b=Bj5YIbut; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Migadu-Queue-Id: AC02B9402C2 X-Spam-Score: -1.25 X-Migadu-Scanner: scn0.migadu.com X-TUID: nWenFrcgnwGQ Hello, Tanguy LE CARROUR writes: > Excerpts from Tanguy LE CARROUR's message of January 22, 2021 9:38 am: >> Excerpts from Tanguy LE CARROUR's message of January 6, 2021 4:32 pm: >>> Excerpts from Lars-Dominik Braun's message of January 5, 2021 11:25 am: >>>>> So, I've tried packaging `python-keyring` with those two=E2=80=A6 >>>>>=20 >>>>> `pep517` keeps on trying to download dependencies, which won't work. >>>>>=20 >>>>> `build` crashes with "ZIP does not support timestamps before 1980", >>>>> which, I guess is related to the fact that everything in the store is >>>>> timestamped to January 1st 1970. >>>> have you been looking into a python-build-system using `build`[1]? I= =E2=80=99ve >>>> had the same issue with egg versions set to 0.0.0 and think in the long >>>> run moving to a PEP 517-style build is the way forward. >>>=20 >>> I agree! Unfortunately, I haven't had much time (so far) to work on it!= :-( >>>=20 >>> I'll revive the thread as soon as I've made progress=E2=80=A6 >>=20 >> Done! :-) >> I've eventually succeeded in ("properly") packaging a software managed >> with Poetry. And I've learned quite a lot on the way! > > Just for the sake of having it documented somewhere, here is the > relevant part of the `guix.scm` file: > > ``` > (define-public nowty > (package > (name "nowty") > (version (string-append %pyproject-version "+" %git-commit)) > (source (local-file %source-dir #:recursive? #t)) > (build-system python-build-system) > (arguments > `(#:phases > (modify-phases %standard-phases > (replace 'build > (lambda* (#:key #:allow-other-keys) > (substitute* "pyproject.toml" > (((string-append "version =3D \"" ,%pyproject-version "\"" )) > (string-append "version =3D \"" ,version "\""))))) > (replace 'install > (lambda* (#:key outputs #:allow-other-keys) > (let ((out (assoc-ref outputs "out"))) > (invoke "python" "-m" "pip" "install" > "--no-dependencies" "--no-build-isolation" "--prefix" = out ".")))) > (replace 'check > (lambda* (#:key inputs outputs #:allow-other-keys) > (add-installed-pythonpath inputs outputs) > (invoke "python" "-m" "invoke" "test.unit")))))) > (native-inputs > `(("python-invoke" ,python-invoke-patched) > ("python-mamba" ,python-mamba) > ("python-poetry-core" ,python-poetry-core) > ("python-robber" ,python-robber) > ("python-termcolor" ,python-termcolor))) > (propagated-inputs > `(("python-mpd2" ,python-mpd2) > ("python-typer" ,python-typer))) > (synopsis "Music notification daemon for MPD") > (description "A music notification daemon that monitors songs being p= layed by MPD > and displays notifications with the song's details.") > (home-page "http://projects.bioneland.org/nowty") > (license license:gpl3+))) > ``` As another PEP 517 package build example, you may want to look at python-isort on core-updates (commit 812a2931de553d12c01b0a4d53d03613b09adaaf). Here's the definition: --8<---------------cut here---------------start------------->8--- (define-public python-isort (package (name "python-isort") (version "5.7.0") (source (origin (method git-fetch) (uri (git-reference ;; Tests pass only from the Github sources (url "https://github.com/timothycrosley/isort") (commit version))) (file-name (git-file-name name version)) (modules '((guix build utils))) (snippet '(for-each delete-file (find-files "." "\\.whl$"))) (sha256 (base32 "0phq4s911mjjdyr5h5siz93jnpkqb2qgphgcfk6axncgxr8i7vi1")))) (build-system python-build-system) (arguments `(#:phases (modify-phases %standard-phases ;; A foretaste of what our future python-build-system will need to ;; do. (replace 'build (lambda _ (invoke "python" "-m" "build" "--wheel" "--no-isolation" "."))) (replace 'install (lambda* (#:key outputs #:allow-other-keys) (let ((out (assoc-ref outputs "out")) (whl (car (find-files "dist" "\\.whl$")))) (invoke "pip" "--no-cache-dir" "--no-input" "install" "--no-deps" "--prefix" out whl)))) (add-after 'install 'install-example-plugins (lambda* (#:key outputs #:allow-other-keys) (let ((out (assoc-ref outputs "out"))) ;; Patch to use the core poetry API. (substitute* '("example_isort_formatting_plugin/pyproject.to= ml" "example_shared_isort_profile/pyproject.toml") (("poetry>=3D0.12") "poetry-core>=3D1.0.0") (("poetry.masonry.api") "poetry.core.masonry.api")) ;; Build the example plugins. (for-each (lambda (source-directory) (invoke "python" "-m" "build" "--wheel" "--no-isolation" "--outdir=3Ddist" source-directory)) '("example_isort_formatting_plugin" "example_shared_isort_profile")) ;; Install them to temporary storage, for the test. (setenv "HOME" (getcwd)) (let ((example-whls (find-files "dist" "^example.*\\.whl$"))) (apply invoke "pip" "--no-cache-dir" "--no-input" "install" "--user" "--no-deps" example-whls))))) (replace 'check (lambda* (#:key tests? inputs outputs #:allow-other-keys) (when tests? (let ((bin (string-append (assoc-ref outputs "out") "/bin"))) (setenv "PATH" (string-append (getenv "PATH") ":" bin))) (add-installed-pythonpath inputs outputs) (invoke "pytest" "-vv" "tests/unit/" "--ignore=3Dtests/unit/test_deprecated_finders.py"))= ))))) (native-inputs `(("git" ,git-minimal) ("python-black" ,python-black) ("python-colorama" ,python-colorama) ("python-hypothesmith" ,python-hypothesmith) ("python-libcst" ,python-libcst-minimal) ("python-poetry-core" ,python-poetry-core) ("python-pylama" ,python-pylama) ("python-pypa-build" ,python-pypa-build) ("python-pytest-mock" ,python-pytest-mock) ("python-pytest" ,python-pytest))) (home-page "https://github.com/PyCQA/isort") (synopsis "Python utility/library to sort python imports") (description "@code{python-isort} is a python utility/library to sort imports alphabetically, and automatically separated into sections. It provides a command line utility, a python library and plugins for various editors.") (license license:expat))) --8<---------------cut here---------------end--------------->8--- That's an ad-hoc solution pending an update to our Python build system phases. HTH! Maxim