1{
2 stdenv,
3 lib,
4 pythonOlder,
5 buildPythonPackage,
6 fetchFromGitHub,
7 numpy,
8 scipy,
9 pandas,
10 matplotlib,
11 nbval,
12 pyvisa,
13 networkx,
14 ipython,
15 ipykernel,
16 ipywidgets,
17 jupyter-client,
18 sphinx-rtd-theme,
19 sphinx,
20 nbsphinx,
21 openpyxl,
22 setuptools,
23 pytestCheckHook,
24 pytest-mock,
25}:
26
27buildPythonPackage rec {
28 pname = "scikit-rf";
29 version = "1.7.0";
30 pyproject = true;
31
32 disabled = pythonOlder "3.8";
33
34 src = fetchFromGitHub {
35 owner = "scikit-rf";
36 repo = "scikit-rf";
37 tag = "v${version}";
38 hash = "sha256-Ovrr1U7VuuGKDNSBSCyYSz3DNpaJrA57ccl4AFdzC5E=";
39 };
40
41 postPatch = ''
42 substituteInPlace pyproject.toml \
43 --replace-fail "--cov=skrf" ""
44 '';
45
46 build-system = [ setuptools ];
47
48 dependencies = [
49 numpy
50 scipy
51 pandas
52 ];
53
54 optional-dependencies = {
55 plot = [ matplotlib ];
56 xlsx = [ openpyxl ];
57 netw = [ networkx ];
58 visa = [ pyvisa ];
59 docs = [
60 ipython
61 ipykernel
62 ipywidgets
63 jupyter-client
64 sphinx-rtd-theme
65 sphinx
66 nbsphinx
67 openpyxl
68 nbval
69 ];
70 };
71
72 env = lib.optionalAttrs stdenv.hostPlatform.isDarwin { MPLBACKEND = "Agg"; };
73
74 nativeCheckInputs = [
75 pytest-mock
76 matplotlib
77 pyvisa
78 openpyxl
79 networkx
80 pytestCheckHook
81 ];
82
83 # test_calibration.py generates a divide by zero error on darwin
84 # https://github.com/scikit-rf/scikit-rf/issues/972
85 disabledTestPaths = lib.optional (
86 stdenv.hostPlatform.isAarch64 && stdenv.hostPlatform.isDarwin
87 ) "skrf/calibration/tests/test_calibration.py";
88
89 pythonImportsCheck = [ "skrf" ];
90
91 meta = with lib; {
92 description = "Python library for RF/Microwave engineering";
93 homepage = "https://scikit-rf.org/";
94 changelog = "https://github.com/scikit-rf/scikit-rf/releases/tag/${src.tag}";
95 license = licenses.bsd3;
96 maintainers = with maintainers; [ lugarun ];
97 };
98}