1{
2 lib,
3 buildPythonPackage,
4 cython,
5 fetchFromGitHub,
6 narwhals,
7 pandas,
8 python,
9 readstat,
10 setuptools,
11 zlib,
12}:
13
14buildPythonPackage rec {
15 pname = "pyreadstat";
16 version = "1.3.1";
17 pyproject = true;
18
19 src = fetchFromGitHub {
20 owner = "Roche";
21 repo = "pyreadstat";
22 tag = "v${version}";
23 hash = "sha256-EiQKsz4+PdUNXAniw8ftZbF5B+BegUx40zumE3Z7Xmo=";
24 };
25
26 build-system = [
27 cython
28 setuptools
29 ];
30
31 buildInputs = [ zlib ];
32
33 dependencies = [
34 narwhals
35 readstat
36 pandas
37 ];
38
39 pythonImportsCheck = [ "pyreadstat" ];
40
41 preCheck = ''
42 export HOME=$(mktemp -d);
43 '';
44
45 checkPhase = ''
46 runHook preCheck
47
48 ${python.interpreter} tests/test_basic.py
49
50 runHook postCheck
51 '';
52
53 meta = with lib; {
54 description = "Module to read SAS, SPSS and Stata files into pandas data frames";
55 homepage = "https://github.com/Roche/pyreadstat";
56 changelog = "https://github.com/Roche/pyreadstat/blob/${src.tag}/change_log.md";
57 license = licenses.asl20;
58 maintainers = with maintainers; [ swflint ];
59 };
60}