From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id oHx3OQuG3GYeagAAe85BDQ:P1 (envelope-from ) for ; Sat, 07 Sep 2024 16:57:48 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id oHx3OQuG3GYeagAAe85BDQ (envelope-from ) for ; Sat, 07 Sep 2024 18:57:48 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=tdhfhAHW; dkim=fail ("headers rsa verify failed") header.d=ngraves.fr header.s=ovhmo4487190-selector1 header.b="Ee/Ha59P"; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1725728267; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=a9IJwNMVg+UimD6j2vBkMVbhVqHLEOGWc4FfCSE2VJI=; b=sRYupiMpDVY/tqp3ddfApA+5X0karujbg2fN+9c+KVTUxkoouT5cbZZm74sYoAJ41muO1B 2CwZcfPhkWNb4HilKWVbFpfo9ZNnNIS2GlN1TSvgJbD2lSIRcWO0XxXnIVwmksUcZiIu5g tElqKNtTIIazaBbvp4xRCTQxXOOLK12FVE0KPhVlWxUoaATCOEcF3DcmQnSccW4rCnCNSf 1f9tO69PuMr25r5Xw7IHIfNQCeW6lNEjXRdvBozH4TMFalNSyFc+Zgm2O6Ms5Qc2hyGvR1 LCShs/65b8CmECu8o8daOPbcPqvSeNgCRxf4JekwBjZehTPMnsUk/EajPnQ1gg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1725728267; a=rsa-sha256; cv=none; b=QXj4duC9DJ40GpQ1+dHdZNskFqREsbgOnyiP/MF1J4FQV36MvnkPgEo0bsHk+gIwkjz5o1 LAG8MMAOO6/3oXb99rCiQdk/EB8x7LoCBlBDXBrkI3/Lh2pNh7ZgPAfg8rX7pu5KYfROir jRY8P0IvITD46XdtWiOM62eISYjNhYjqB4D4DkchvlwY+VSHKHqfb61lnOHLgCMfl9A0P3 mxO2FGle0iHnF30pXr9WJsqmu21OQvidtK09Hd3oNgWk0SXt1yAfBldN360vtfz9JPJ/qw DW8kuC3u7z7KeAeEyaeR2QkZ1SNrd0tgBPp02Ldsy2Xa3k5vXkfqS5518o5cOQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=tdhfhAHW; dkim=fail ("headers rsa verify failed") header.d=ngraves.fr header.s=ovhmo4487190-selector1 header.b="Ee/Ha59P"; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" 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 6C61181640 for ; Sat, 7 Sep 2024 18:57:47 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1smykG-0000tm-5W; Sat, 07 Sep 2024 12:57:08 -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 1smykD-0000sJ-MQ for guix-patches@gnu.org; Sat, 07 Sep 2024 12:57:06 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1smykD-0001c9-D8 for guix-patches@gnu.org; Sat, 07 Sep 2024 12:57:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=a9IJwNMVg+UimD6j2vBkMVbhVqHLEOGWc4FfCSE2VJI=; b=tdhfhAHWQmBaox2bAIvAt4i31xV4P5ZfOcy2nzM01iZVZhEnNujLOwCMUViPDKblSnnY1Q/J6SrPzVlzjp5/aiRW8M8ya2/f9b55o5reJJVguDBgilIXmu+Q+NOrmqEWRZMNATZQpyQ9cS+a+txMtsbFak+AahmWAme88FF3cRxCfXsiWoYGRr9RzIoDsTuDZWUEP8HSRz8X76YxSR8PWAi3ymjzYdEYjIvkGyExzg5Ir07QE8k23gJdXkcGBunpt9eE/i3yxY9M7U89qDel0tSpv4ii5h/ghHo8sA36/Pqq4j7Q7YjVu5swaD2ppj6yyj+R0CCcbDjc1CfLqiSGnQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1smykE-0007wh-CC for guix-patches@gnu.org; Sat, 07 Sep 2024 12:57:06 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#73106] [PATCH 10/10] gnu: Add python-tokenizers. Resent-From: Nicolas Graves Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 07 Sep 2024 16:57:06 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73106 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 73106@debbugs.gnu.org Cc: ngraves@ngraves.fr Received: via spool by 73106-submit@debbugs.gnu.org id=B73106.172572820630446 (code B ref 73106); Sat, 07 Sep 2024 16:57:06 +0000 Received: (at 73106) by debbugs.gnu.org; 7 Sep 2024 16:56:46 +0000 Received: from localhost ([127.0.0.1]:57455 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1smyjt-0007uu-GF for submit@debbugs.gnu.org; Sat, 07 Sep 2024 12:56:46 -0400 Received: from 7.mo583.mail-out.ovh.net ([178.32.124.100]:58157) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1smyjp-0007u3-7S for 73106@debbugs.gnu.org; Sat, 07 Sep 2024 12:56:42 -0400 Received: from director7.ghost.mail-out.ovh.net (unknown [10.109.140.39]) by mo583.mail-out.ovh.net (Postfix) with ESMTP id 4X1K4k6C6Sz1TJd for <73106@debbugs.gnu.org>; Sat, 7 Sep 2024 16:56:38 +0000 (UTC) Received: from ghost-submission-55b549bf7b-ttspb (unknown [10.110.168.221]) by director7.ghost.mail-out.ovh.net (Postfix) with ESMTPS id 992EC1FD63; Sat, 7 Sep 2024 16:56:38 +0000 (UTC) Received: from ngraves.fr ([37.59.142.105]) by ghost-submission-55b549bf7b-ttspb with ESMTPSA id l+/lHcaF3GbMtgEAqJuKVw (envelope-from ); Sat, 07 Sep 2024 16:56:38 +0000 X-OVh-ClientIp: 81.67.146.208 Date: Sat, 7 Sep 2024 18:56:16 +0200 Message-ID: <20240907165626.22651-10-ngraves@ngraves.fr> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240907165626.22651-1-ngraves@ngraves.fr> References: <20240907165626.22651-1-ngraves@ngraves.fr> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Ovh-Tracer-Id: 9639392055524713186 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeeftddrudeifedguddutdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecunecujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomheppfhitgholhgrshcuifhrrghvvghsuceonhhgrhgrvhgvshesnhhgrhgrvhgvshdrfhhrqeenucggtffrrghtthgvrhhnpeekgeejtdeigeeiteekjeeujeegtdekkedvgeehveefiedvieeuvdfhvddutdfgteenucffohhmrghinhephhhughhgihhnghhfrggtvgdrtghonecukfhppeduvdejrddtrddtrddupdekuddrieejrddugeeirddvtdekpdefjedrheelrddugedvrddutdehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepuddvjedrtddrtddruddpmhgrihhlfhhrohhmpehnghhrrghvvghssehnghhrrghvvghsrdhfrhdpnhgspghrtghpthhtohepuddprhgtphhtthhopeejfedutdeiseguvggssghughhsrdhgnhhurdhorhhgpdfovfetjfhoshhtpehmohehkeefpdhmohguvgepshhmthhpohhuth DKIM-Signature: a=rsa-sha256; bh=a9IJwNMVg+UimD6j2vBkMVbhVqHLEOGWc4FfCSE2VJI=; c=relaxed/relaxed; d=ngraves.fr; h=From; s=ovhmo4487190-selector1; t=1725728198; v=1; b=Ee/Ha59P81bFONZvRIPVu6pCN3BoDX/407gdnSifdym73CGq/c62N56WjXadxfXrhNlBgJyk DxtKpVtvkI3bsdo26nl7TmDcqiptFm3Pfn9jyX0G+BlDvoiUWjrchNkNlizEk1cXQy8wBzMVWtY jOfXOjrbD6oJJq6McPsK0BILuSMid1HExJTTAsdhE3kB/OVAKvF+9BaaVHBhZeOUtxOtH+Pcmou HgYP0PF4i20fFWmlVRDUynOdi5Us7UU+GSFWS2+9k/ToKMvtzUslR7yYkvLEmmH5Zy9jeLpHv3I MCg7jrXPopqiU91nN4+SRpP+6tZlZOuVocqWOcUwrwXvQ== X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Nicolas Graves X-ACL-Warn: , Nicolas Graves via Guix-patches From: Nicolas Graves via Guix-patches via Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Queue-Id: 6C61181640 X-Migadu-Scanner: mx12.migadu.com X-Migadu-Spam-Score: -6.49 X-Spam-Score: -6.49 X-TUID: nnUhrFq6G3zc * gnu/packages/machine-learning.scm (python-tokenizers): New variable. Change-Id: I5db95172255dc4635c2a417f3b7252454eea27d7 --- gnu/packages/machine-learning.scm | 111 ++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm index 3b601f6c91..412499d424 100644 --- a/gnu/packages/machine-learning.scm +++ b/gnu/packages/machine-learning.scm @@ -5735,6 +5735,117 @@ (define-public rust-tokenizers tokenizers, with a focus on performances and versatility.") (license license:asl2.0))) +(define-public python-tokenizers + (package + (name "python-tokenizers") + (version "0.19.1") + (source + (origin + (method url-fetch) + (uri (pypi-uri "tokenizers" version)) + (sha256 + (base32 "1qw8mjp0q9w7j1raq1rvcbfw38000kbqpwscf9mvxzfh1rlfcngf")) + (modules '((guix build utils) + (ice-9 ftw))) + (snippet + #~(begin ;; Only keeping bindings. + (for-each (lambda (file) + (unless (member file '("." ".." "bindings" "PKG-INFO")) + (delete-file-recursively file))) + (scandir ".")) + (for-each (lambda (file) + (unless (member file '("." "..")) + (rename-file (string-append "bindings/python/" file) file))) + (scandir "bindings/python")) + (delete-file-recursively ".cargo"))))) + (build-system cargo-build-system) + (arguments + (list + #:cargo-test-flags ''("--no-default-features") + #:imported-modules `(,@%cargo-build-system-modules + ,@%pyproject-build-system-modules) + #:modules '((guix build cargo-build-system) + ((guix build pyproject-build-system) #:prefix py:) + (guix build utils) + (ice-9 regex) + (ice-9 textual-ports)) + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack-rust-crates 'inject-tokenizers + (lambda _ + (substitute* "Cargo.toml" + (("\\[dependencies\\]") + (format #f " +[dev-dependencies] +tempfile = ~s +pyo3 = { version = ~s, features = [\"auto-initialize\"] } + +[dependencies] +tokenizers = ~s" + #$(package-version rust-tempfile-3) + #$(package-version rust-pyo3-0.21) + #$(package-version rust-tokenizers)))) + (let ((file-path "Cargo.toml")) + (call-with-input-file file-path + (lambda (port) + (let* ((content (get-string-all port)) + (top-match (string-match + "\\[dependencies.tokenizers" content))) + (call-with-output-file file-path + (lambda (out) + (format out "~a" (match:prefix top-match)))))))))) + (add-after 'patch-cargo-checksums 'loosen-requirements + (lambda _ + (substitute* "Cargo.toml" + (("version = \"6.4\"") + (format #f "version = ~s" + #$(package-version rust-onig-6)))))) + (add-after 'check 'python-check + (lambda _ + (copy-file "target/release/libtokenizers.so" + "py_src/tokenizers/tokenizers.so") + (invoke "python3" + "-c" (format #f + "import sys; sys.path.append(\"~a/py_src\")" + (getcwd)) + "-m" "pytest" + "-s" "-v" "./tests/"))) + (add-after 'install 'install-python + (lambda _ + (let* ((pversion #$(version-major+minor (package-version python))) + (lib (string-append #$output "/lib/python" pversion + "/site-packages/")) + (info (string-append lib "tokenizers-" + #$(package-version this-package) + ".dist-info"))) + (mkdir-p info) + (copy-file "PKG-INFO" (string-append info "/METADATA")) + (copy-recursively + "py_src/tokenizers" + (string-append lib "tokenizers")))))) + #:cargo-inputs + `(("rust-rayon" ,rust-rayon-1) + ("rust-serde" ,rust-serde-1) + ("rust-serde-json" ,rust-serde-json-1) + ("rust-libc" ,rust-libc-0.2) + ("rust-env-logger" ,rust-env-logger-0.11) + ("rust-pyo3" ,rust-pyo3-0.21) + ("rust-numpy" ,rust-numpy-0.21) + ("rust-ndarray" ,rust-ndarray-0.15) + ("rust-onig" ,rust-onig-6) + ("rust-itertools" ,rust-itertools-0.12) + ("rust-tokenizers" ,rust-tokenizers)) + #:cargo-development-inputs + `(("rust-tempfile" ,rust-tempfile-3)))) + (native-inputs + (list python-minimal python-pytest)) + (home-page "https://huggingface.co/docs/tokenizers") + (synopsis "Implementation of various popular tokenizers") + (description + "This package provides bindings to a Rust implementation of the most used +tokenizers, @code{rust-tokenizers}.") + (license license:asl2.0))) + (define-public python-hmmlearn (package (name "python-hmmlearn") -- 2.45.2