From nobody Thu Jan 12 05:25:28 2023 X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4NstL06mYPz2r4J8; Thu, 12 Jan 2023 05:25:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4NstL063D2z3PwX; Thu, 12 Jan 2023 05:25:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1673501128; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9EMXix4qxaI2QVNLFybM20kUscFxJdYbiQrrKMNaP/Y=; b=JH7Msq9yXZ37OpY8rgx+OIF6+5guqwk23Eu6WaTOnWCOvxA2CBxOddB/6UEC42Mdg9zQjB Yog9vbm2xUYgqg2cN7X+nLnfMIZVoT5zAvTIygBDh4j+c8SNi5+BgUqNyaDlqmPgK7Y9Bf YRu9Ro4VKb9g8/rk6hOC6HIfbSny0cgx+s+d/BVcIISj2AUYiBMb63/UYdnsiimDaZE3ps 2+8ogKrzbqC1/bvWIquJOgVwqNic11DQZj65jUe0RNmK+A82m/gEPnuG6KbPZfzWa519R1 rlaLgtpxAib3NsIxVJqegCt/+ARJLoLU967OS6zaqybwQLOTmss+TFukPFhF6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1673501128; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9EMXix4qxaI2QVNLFybM20kUscFxJdYbiQrrKMNaP/Y=; b=vMtvyA7eX33c3zKSij+P+T9YC7UkZ+ullqklFqOxUpEdxZfcB6RHBdKOpI3t2uZHF7UQO/ IOl6+BeZ4vBIrxIHrNTeHk83O7S2HbZNvqewQz7vrDgwrCz+FghZHAEiZ1Tz6SXB4etUZ6 5TtxB98DPuwkx8sE7dU5wwfDoP/qaDhXNZrFu8cBgxM/OrQuDGmfApyyZHJiUf2MmFA1le m/LKoGM+1LFyd7XvLcewMM4hmLmP+5ZUHfkzVdSAxnjQLn+6AcWT3KL1E5AD7i7+9mbLmD NTN65V4kMI527R5k+t0fglB5cPH9XfaakOnHrFZ9ZPFv+bSzMRLrgwHlWK2nBQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1673501128; a=rsa-sha256; cv=none; b=pIuNcSipZKPbuqTLrOUZ2VIdIKTwmaiO9OT78yM/BckATc6a7+bVqOPzR7rsep2LLfET6p 2tFikqLYtL2k3NmLEN3/OQLOCJXnR18o4YqWa7XysTX8MTBsyVW+Fio8brKhOrRk1uQJ7b k+YrznitnPDd9BebTOFJ42oDi5J4KltwpSrbvxSIqtZVfhu2sEMXedeKkZlwbeLqhkxNbG d+FEZEjVHFCy7zdTGnCCSeY9UY5VKSHu1o2yCoBQg4Zhbuxx1/7IZ8R4lA7LEbSWWMpJxj try1ZsvAAz+ue5UIsgU507FjPe9zT9bt1RSLPtbKJ7iLD8AON940A4j3YQLgcw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4NstL059MFzGjQ; Thu, 12 Jan 2023 05:25:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 30C5PSPW007796; Thu, 12 Jan 2023 05:25:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30C5PSE2007795; Thu, 12 Jan 2023 05:25:28 GMT (envelope-from git) Date: Thu, 12 Jan 2023 05:25:28 GMT Message-Id: <202301120525.30C5PSE2007795@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Yuri Victorovich Subject: git: c5c128b186be - main - math/py-annoy: New port: Approximate Nearest Neighbors in C++ List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-all@freebsd.org X-BeenThere: dev-commits-ports-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: yuri X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c5c128b186be0150e2d4885d9dde759fc93b25c9 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by yuri: URL: https://cgit.FreeBSD.org/ports/commit/?id=c5c128b186be0150e2d4885d9dde759fc93b25c9 commit c5c128b186be0150e2d4885d9dde759fc93b25c9 Author: Yuri Victorovich AuthorDate: 2023-01-12 05:24:48 +0000 Commit: Yuri Victorovich CommitDate: 2023-01-12 05:25:23 +0000 math/py-annoy: New port: Approximate Nearest Neighbors in C++ --- math/Makefile | 1 + math/py-annoy/Makefile | 37 ++++++++++++++++++++++++++++ math/py-annoy/distinfo | 3 +++ math/py-annoy/files/patch-setup.py | 10 ++++++++ math/py-annoy/files/patch-src_annoymodule.cc | 11 +++++++++ math/py-annoy/files/test-load.py | 7 ++++++ math/py-annoy/files/test-save.py | 12 +++++++++ math/py-annoy/pkg-descr | 4 +++ 8 files changed, 85 insertions(+) diff --git a/math/Makefile b/math/Makefile index 6392ae0c3cdd..b1feac913044 100644 --- a/math/Makefile +++ b/math/Makefile @@ -867,6 +867,7 @@ SUBDIR += py-amply SUBDIR += py-animatplot SUBDIR += py-animatplot-ng + SUBDIR += py-annoy SUBDIR += py-apgl SUBDIR += py-arviz SUBDIR += py-arybo diff --git a/math/py-annoy/Makefile b/math/py-annoy/Makefile new file mode 100644 index 000000000000..f60de58fde88 --- /dev/null +++ b/math/py-annoy/Makefile @@ -0,0 +1,37 @@ +PORTNAME= annoy +DISTVERSIONPREFIX= v +DISTVERSION= 1.17.1 +CATEGORIES= math +PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} + +MAINTAINER= yuri@FreeBSD.org +COMMENT= Approximate Nearest Neighbors in C++ +WWW= https://github.com/spotify/annoy + +LICENSE= APACHE20 +LICENSE_FILE= ${WRKSRC}/LICENSE + +TEST_DEPENDS= ${PYTHON_PKGNAMEPREFIX}h5py>0:science/py-h5py@${PY_FLAVOR} \ + ${PYNUMPY} + +USES= python +USE_PYTHON= distutils autoplist pytest # tests fail because nose is broken + +USE_GITHUB= yes +GH_ACCOUNT= spotify + +TEST_ENV= ${MAKE_ENV} PYTHONPATH=${STAGEDIR}${PYTHONPREFIX_SITELIBDIR} +TEST_WRKSRC= ${WRKSRC}/test + +post-install: + @${STRIP_CMD} ${STAGEDIR}${PYTHON_SITELIBDIR}/annoy/annoylib${PYTHON_EXT_SUFFIX}.so + +do-test: + cd ${TEST_WRKSRC} && \ + ${ECHO} "saving data" && \ + ${SETENV} ${TEST_ENV} ${PYTHON_CMD} ${FILESDIR}/test-save.py && \ + ${ECHO} "loading data" && \ + ${SETENV} ${TEST_ENV} ${PYTHON_CMD} ${FILESDIR}/test-load.py && \ + ${ECHO} "tests succeeded" + +.include diff --git a/math/py-annoy/distinfo b/math/py-annoy/distinfo new file mode 100644 index 000000000000..7820871881b9 --- /dev/null +++ b/math/py-annoy/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1673498821 +SHA256 (spotify-annoy-v1.17.1_GH0.tar.gz) = 4f7a2f2d86d45b432de68dba06667b23d0ce2b03595d64bd5c05f42dc32e7f4b +SIZE (spotify-annoy-v1.17.1_GH0.tar.gz) = 674087 diff --git a/math/py-annoy/files/patch-setup.py b/math/py-annoy/files/patch-setup.py new file mode 100644 index 000000000000..f1bf9c98ae64 --- /dev/null +++ b/math/py-annoy/files/patch-setup.py @@ -0,0 +1,10 @@ +--- setup.py.orig 2023-01-12 05:20:26 UTC ++++ setup.py +@@ -104,6 +104,6 @@ setup(name='annoy', + 'Programming Language :: Python :: 3.9', + ], + keywords='nns, approximate nearest neighbor search', +- setup_requires=['nose>=1.0'], ++ setup_requires=[], + tests_require=['numpy', 'h5py'] + ) diff --git a/math/py-annoy/files/patch-src_annoymodule.cc b/math/py-annoy/files/patch-src_annoymodule.cc new file mode 100644 index 000000000000..6c0be8088fde --- /dev/null +++ b/math/py-annoy/files/patch-src_annoymodule.cc @@ -0,0 +1,11 @@ +--- src/annoymodule.cc.orig 2023-01-12 04:57:07 UTC ++++ src/annoymodule.cc +@@ -179,7 +179,7 @@ py_an_init(py_annoy *self, PyObject *args, PyObject *k + int f; + static char const * kwlist[] = {"f", "metric", NULL}; + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i|s", (char**)kwlist, &f, &metric)) +- return (int) NULL; ++ return 0; + return 0; + } + diff --git a/math/py-annoy/files/test-load.py b/math/py-annoy/files/test-load.py new file mode 100644 index 000000000000..3eecbf6bb041 --- /dev/null +++ b/math/py-annoy/files/test-load.py @@ -0,0 +1,7 @@ +from annoy import AnnoyIndex + +f = 40 # Length of item vector that will be indexed + +u = AnnoyIndex(f, 'angular') +u.load('test.ann') # super fast, will just mmap the file +print(u.get_nns_by_item(0, 1000)) # will find the 1000 nearest neighbors diff --git a/math/py-annoy/files/test-save.py b/math/py-annoy/files/test-save.py new file mode 100644 index 000000000000..21a8f50df0c0 --- /dev/null +++ b/math/py-annoy/files/test-save.py @@ -0,0 +1,12 @@ +from annoy import AnnoyIndex +import random + +f = 40 # Length of item vector that will be indexed + +t = AnnoyIndex(f, 'angular') +for i in range(1000): + v = [random.gauss(0, 1) for z in range(f)] + t.add_item(i, v) + +t.build(10) # 10 trees +t.save('test.ann') diff --git a/math/py-annoy/pkg-descr b/math/py-annoy/pkg-descr new file mode 100644 index 000000000000..8d40cf570d67 --- /dev/null +++ b/math/py-annoy/pkg-descr @@ -0,0 +1,4 @@ +Annoy (Approximate Nearest Neighbors Oh Yeah) is a C++ library with Python +bindings to search for points in space that are close to a given query point. +It also creates large read-only file-based data structures that are mmapped +into memory so that many processes may share the same data.