{ lib, buildPythonPackage, python, fetchFromGitHub, # build-system cython, meson-python, numpy, setuptools-scm, # dependencies packaging, pandas, scipy, statsmodels, # tests pytestCheckHook, }: buildPythonPackage (finalAttrs: { pname = "arch"; version = "8.0.0"; pyproject = true; __structuredAttrs = true; src = fetchFromGitHub { owner = "bashtage"; repo = "arch"; tag = "v${finalAttrs.version}"; hash = "sha256-qw8sSgsMu6YTiQlzsrePnDKkFBtrxD9RK6ZZE5jFeX0="; }; # nixpkgs ships setuptools-scm 10, upstream pins <10 postPatch = '' substituteInPlace pyproject.toml \ --replace-fail '"setuptools_scm>=9.2.0,<10"' '"setuptools_scm"' ''; build-system = [ cython meson-python numpy setuptools-scm ]; dependencies = [ numpy packaging pandas scipy statsmodels ]; pythonImportsCheck = [ "arch" ]; nativeCheckInputs = [ pytestCheckHook ]; # Replace the source tree's arch/ with symlinks to the installed package. # pytest adds rootdir to sys.path, so the source arch/ always shadows the # installed one. The source tree lacks _version.py (generated by setuptools-scm) # and compiled Cython extensions, causing import failures. # Symlinking to the installed package makes all imports resolve correctly. preCheck = '' rm -rf arch ln -s $out/${python.sitePackages}/arch arch ''; disabledTestPaths = [ # Skip long-running/failing tests "arch/tests/univariate/test_forecast.py" "arch/tests/univariate/test_mean.py" ]; meta = { description = "Autoregressive Conditional Heteroskedasticity (ARCH) and other tools for financial econometrics"; homepage = "https://github.com/bashtage/arch"; changelog = "https://github.com/bashtage/arch/releases/tag/${finalAttrs.src.tag}"; license = lib.licenses.ncsa; maintainers = with lib.maintainers; [ jherland ]; }; })