Files
nixpkgs/pkgs/development/python-modules/arch/default.nix
Gaetan Lepage be93b0c66e python3Packages.arch: fix build
- drop property-cached (no longer used since arch 8, which relies on
  functools.cached_property) and add the missing packaging dependency
- relax the setuptools_scm<10 build-system pin
- fix the license (NCSA, not MIT)
- use finalAttrs and enable __structuredAttrs

Assisted-by: Claude Code (claude-opus-5-5)
2026-10-24 10:08:45 +00:00

85 lines
1.9 KiB
Nix

{
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 ];
};
})