Subject: [bug#64134] [PATCH 09/17] gnu: Add python-arch.

From: Vinicius Monego <[email-masked]>
Date: Sat, 17 Jun 2023 15:18:32 +0000

* gnu/packages/finance.scm (python-arch): New variable.
---
 gnu/packages/finance.scm | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/gnu/packages/finance.scm b/gnu/packages/finance.scm
index 23071828ff..9c18e103b7 100644
--- a/gnu/packages/finance.scm
+++ b/gnu/packages/finance.scm
@@ -125,6 +125,7 @@ (define-module (gnu packages finance)
   #:use-module (gnu packages security-token)
   #:use-module (gnu packages sphinx)
   #:use-module (gnu packages sqlite)
+  #:use-module (gnu packages statistics)
   #:use-module (gnu packages tex)
   #:use-module (gnu packages texinfo)
   #:use-module (gnu packages textutils)
@@ -1016,6 +1017,40 @@ (define-public trezor-gpg-pinentry-tk
 settings.")
     (license license:bsd-2)))
 
+(define-public python-arch
+  (package
+    (name "python-arch")
+    (version "6.1.0")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "arch" version))
+              (sha256
+               (base32
+                "15mr5rvxwpfhbj5lg85i9gqpvs37rjhifjzhcp512fg2i7yz3663"))))
+    (build-system pyproject-build-system)
+    (arguments
+     ;; Default check phase failed to detect conftest.py in the subdirectory.
+     (list #:phases #~(modify-phases %standard-phases
+                        (replace 'check
+                          (lambda* (#:key tests? #:allow-other-keys)
+                            (when tests?
+                              (invoke "python" "-m" "pytest"
+                                      "arch/tests" "-vv")))))))
+    (native-inputs (list python-cython python-pytest))
+    ;; XXX: It is preferrable to compile modules with Cython, however it fails
+    ;; without a hint.  Use Numba for now.  TODO: try to build with Cython.
+    (propagated-inputs (list python-numba
+                             python-numpy
+                             python-pandas
+                             python-scipy
+                             python-statsmodels))
+    (home-page "https://github.com/bashtage/arch")
+    (synopsis "ARCH for Python")
+    (description
+     "This package provides Autoregressive Conditional Heteroskedasticity
+(ARCH) and other tools for financial econometrics.")
+    (license license:expat)))
+
 (define-public python-mnemonic
   (package
     (name "python-mnemonic")
-- 
2.34.1