From f1dc23578e991a12c3ce62dc77ba2d16e8b2e0eb Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Sun, 22 Mar 2026 16:49:13 +0000 Subject: [PATCH] python3Packages.thinc: 8.3.6 -> 8.3.12 Changelog: https://github.com/explosion/thinc/releases/tag/release-v8.3.12 --- .../python-modules/thinc/default.nix | 63 +++++++++++++------ .../thinc/fix-blas-ctypedefs.patch | 49 +++++++++++++++ 2 files changed, 94 insertions(+), 18 deletions(-) create mode 100644 pkgs/development/python-modules/thinc/fix-blas-ctypedefs.patch diff --git a/pkgs/development/python-modules/thinc/default.nix b/pkgs/development/python-modules/thinc/default.nix index 8da83f9766fb..0663dd68023d 100644 --- a/pkgs/development/python-modules/thinc/default.nix +++ b/pkgs/development/python-modules/thinc/default.nix @@ -1,33 +1,44 @@ { lib, - blas, - blis, buildPythonPackage, - catalogue, - confection, + fetchFromGitHub, + + # build-system + blis, cymem, cython, - fetchPypi, - hypothesis, - mock, murmurhash, numpy, preshed, - pydantic, - pytestCheckHook, setuptools, + + # buildInputs + blas, + + # dependencies + catalogue, + confection, + pydantic, srsly, wasabi, + + # tests + coverage, + hypothesis, + mock, + pytestCheckHook, }: -buildPythonPackage rec { +buildPythonPackage (finalAttrs: { pname = "thinc"; - version = "8.3.6"; + version = "8.3.12"; pyproject = true; - src = fetchPypi { - inherit pname version; - hash = "sha256-SZg/m33cQ0OpUyaUqRGN0hbXpgBSCiGEmkO2wmjsbK0="; + src = fetchFromGitHub { + owner = "explosion"; + repo = "thinc"; + tag = "release-v${finalAttrs.version}"; + hash = "sha256-8nf+AWAD7Fy50XRJDINmyk42F7KMDhGgATwqbln3r04="; }; build-system = [ @@ -57,25 +68,41 @@ buildPythonPackage rec { wasabi ]; + pythonImportsCheck = [ "thinc" ]; + nativeCheckInputs = [ + coverage hypothesis mock pytestCheckHook ]; + # avoid local paths, relative imports wont resolve correctly preCheck = '' - # avoid local paths, relative imports wont resolve correctly mv thinc/tests tests rm -r thinc ''; - pythonImportsCheck = [ "thinc" ]; + pytestFlags = [ + # UserWarning: Core Pydantic V1 functionality isn't compatible with Python 3.14 or greater. + "-Wignore::UserWarning" + ]; + + disabledTestPaths = [ + # pydantic.v1.error_wrappers.ValidationError: 1 validation error for DefaultsSchema + "tests/test_config.py" + ]; + + disabledTests = [ + # RecursionError: Stack overflow (used 8148 kB) + "test_pickle_with_flatten" + ]; meta = { description = "Library for NLP machine learning"; homepage = "https://github.com/explosion/thinc"; - changelog = "https://github.com/explosion/thinc/releases/tag/v${version}"; + changelog = "https://github.com/explosion/thinc/releases/tag/${finalAttrs.src.tag}"; license = lib.licenses.mit; maintainers = [ ]; }; -} +}) diff --git a/pkgs/development/python-modules/thinc/fix-blas-ctypedefs.patch b/pkgs/development/python-modules/thinc/fix-blas-ctypedefs.patch new file mode 100644 index 000000000000..03dd549002d3 --- /dev/null +++ b/pkgs/development/python-modules/thinc/fix-blas-ctypedefs.patch @@ -0,0 +1,49 @@ +diff --git a/thinc/backends/cblas.pxd b/thinc/backends/cblas.pxd +index c608d87..1ae1281 100644 +--- a/thinc/backends/cblas.pxd ++++ b/thinc/backends/cblas.pxd +@@ -2,21 +2,21 @@ from libcpp.memory cimport shared_ptr + + ctypedef void (*sgemm_ptr)(bint transA, bint transB, int M, int N, int K, + float alpha, const float* A, int lda, const float* B, +- int ldb, float beta, float* C, int ldc) nogil ++ int ldb, float beta, float* C, int ldc) noexcept nogil + ctypedef void (*dgemm_ptr)(bint transA, bint transB, int M, int N, int K, + double alpha, const double* A, int lda, const double* B, +- int ldb, double beta, double* C, int ldc) nogil ++ int ldb, double beta, double* C, int ldc) noexcept nogil + + + ctypedef void (*saxpy_ptr)(int N, float alpha, const float* X, int incX, +- float *Y, int incY) nogil ++ float *Y, int incY) noexcept nogil + + + ctypedef void (*daxpy_ptr)(int N, double alpha, const double* X, int incX, +- double *Y, int incY) nogil ++ double *Y, int incY) noexcept nogil + +-ctypedef void (*sscal_ptr)(int N, float alpha, float* X, int incX) nogil +-ctypedef void (*dscal_ptr)(int N, double alpha, double* X, int incX) nogil ++ctypedef void (*sscal_ptr)(int N, float alpha, float* X, int incX) noexcept nogil ++ctypedef void (*dscal_ptr)(int N, double alpha, double* X, int incX) noexcept nogil + + # Forward-declaration of the BlasFuncs struct. This struct must be opaque, so + # that consumers of the CBlas class cannot become dependent on its size or +diff --git a/thinc/backends/cblas.pyx b/thinc/backends/cblas.pyx +index 896b604..9a9e63e 100644 +--- a/thinc/backends/cblas.pyx ++++ b/thinc/backends/cblas.pyx +@@ -5,10 +5,10 @@ from libcpp.memory cimport make_shared + + + # Single- and double-precision wrappers for `blis.cy.scalv` +-cdef void blis_sscal(int N, float alpha, float* X, int incX) nogil: ++cdef void blis_sscal(int N, float alpha, float* X, int incX) noexcept nogil: + blis.cy.scalv(blis.cy.NO_CONJUGATE, N, alpha, X, incX) + +-cdef void blis_dscal(int N, double alpha, double* X, int incX) nogil: ++cdef void blis_dscal(int N, double alpha, double* X, int incX) noexcept nogil: + blis.cy.scalv(blis.cy.NO_CONJUGATE, N, alpha, X, incX) + +