1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 setuptools,
8 versioningit,
9
10 # dependencies
11 broadbean,
12 cf-xarray,
13 dask,
14 h5netcdf,
15 h5py,
16 ipykernel,
17 ipython,
18 ipywidgets,
19 jsonschema,
20 libcst,
21 matplotlib,
22 numpy,
23 opentelemetry-api,
24 packaging,
25 pandas,
26 pillow,
27 pyarrow,
28 pyvisa,
29 ruamel-yaml,
30 tabulate,
31 tqdm,
32 typing-extensions,
33 uncertainties,
34 websockets,
35 wrapt,
36 xarray,
37
38 # optional-dependencies
39 furo,
40 jinja2,
41 nbsphinx,
42 pyvisa-sim,
43 scipy,
44 sphinx,
45 sphinx-issues,
46 towncrier,
47
48 # checks
49 deepdiff,
50 hypothesis,
51 lxml,
52 pip,
53 pytest-asyncio,
54 pytest-mock,
55 pytest-rerunfailures,
56 pytest-xdist,
57 pytestCheckHook,
58}:
59
60buildPythonPackage rec {
61 pname = "qcodes";
62 version = "0.50.1";
63 pyproject = true;
64
65 src = fetchFromGitHub {
66 owner = "microsoft";
67 repo = "Qcodes";
68 rev = "refs/tags/v${version}";
69 hash = "sha256-oNJVOz2FMMhUkYIajeWwRmHzLcXu5qTSQzjk0gciOnE=";
70 };
71
72 build-system = [
73 setuptools
74 versioningit
75 ];
76
77 dependencies = [
78 broadbean
79 cf-xarray
80 dask
81 h5netcdf
82 h5py
83 ipykernel
84 ipython
85 ipywidgets
86 jsonschema
87 matplotlib
88 numpy
89 opentelemetry-api
90 packaging
91 pandas
92 pillow
93 pyarrow
94 pyvisa
95 ruamel-yaml
96 tabulate
97 tqdm
98 typing-extensions
99 uncertainties
100 websockets
101 wrapt
102 xarray
103 ];
104
105 optional-dependencies = {
106 docs = [
107 # autodocsumm
108 furo
109 jinja2
110 nbsphinx
111 pyvisa-sim
112 # qcodes-loop
113 scipy
114 sphinx
115 # sphinx-favicon
116 sphinx-issues
117 # sphinx-jsonschema
118 # sphinxcontrib-towncrier
119 towncrier
120 ];
121 loop = [
122 # qcodes-loop
123 ];
124 refactor = [
125 libcst
126 ];
127 zurichinstruments = [
128 # zhinst-qcodes
129 ];
130 };
131
132 nativeCheckInputs = [
133 deepdiff
134 hypothesis
135 libcst
136 lxml
137 pip
138 pytest-asyncio
139 pytest-mock
140 pytest-rerunfailures
141 pytest-xdist
142 pytestCheckHook
143 pyvisa-sim
144 sphinx
145 ];
146
147 __darwinAllowLocalNetworking = true;
148
149 pytestFlagsArray = [
150 "-v"
151 # Follow upstream with settings
152 "-m 'not serial'"
153 "--hypothesis-profile ci"
154 "--durations=20"
155 ];
156
157 disabledTestPaths = [
158 # Test depends on qcodes-loop, causing a cyclic dependency
159 "tests/dataset/measurement/test_load_legacy_data.py"
160 # TypeError
161 "tests/dataset/test_dataset_basic.py"
162 ];
163
164 disabledTests = [
165 # Tests are time-sensitive and power-consuming
166 # Those tests fails repeatably and are flaky
167 "test_access_channels_by_slice"
168 "test_aggregator"
169 "test_datasaver"
170 "test_do1d_additional_setpoints_shape"
171 "test_dond_1d_additional_setpoints_shape"
172 "test_field_limits"
173 "test_get_array_in_scalar_param_data"
174 "test_get_parameter_data"
175 "test_ramp_safely"
176
177 # more flaky tests
178 # https://github.com/microsoft/Qcodes/issues/5551
179 "test_query_close_once_at_init"
180 "test_step_ramp"
181 ];
182
183 pythonImportsCheck = [ "qcodes" ];
184
185 # Remove the `asyncio_default_fixture_loop_scope` option as it has been introduced in newer `pytest-asyncio` v0.24
186 # which is not in nixpkgs yet:
187 # pytest.PytestConfigWarning: Unknown config option: asyncio_default_fixture_loop_scope
188 postPatch = ''
189 substituteInPlace pyproject.toml \
190 --replace-fail 'default-version = "0.0"' 'default-version = "${version}"' \
191 --replace-fail 'asyncio_default_fixture_loop_scope = "function"' ""
192 '';
193
194 postInstall = ''
195 export HOME="$TMPDIR"
196 '';
197
198 meta = {
199 description = "Python-based data acquisition framework";
200 changelog = "https://github.com/QCoDeS/Qcodes/releases/tag/v${version}";
201 downloadPage = "https://github.com/QCoDeS/Qcodes";
202 homepage = "https://qcodes.github.io/Qcodes/";
203 license = lib.licenses.mit;
204 maintainers = with lib.maintainers; [ evilmav ];
205 };
206}