summaryrefslogtreecommitdiff
path: root/python-atomica.spec
blob: 5c33a30cb6885bdebaefd4ea0f9232b9ee549de1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
%global _empty_manifest_terminate_build 0
Name:		python-atomica
Version:	1.26.0
Release:	1
Summary:	Toolbox for compartment-based dynamic systems with costing and optimization
License:	MIT License
URL:		https://atomica.tools
Source0:	https://mirrors.aliyun.com/pypi/web/packages/36/9a/23c4fe02e46adb707f27832b5f55c2f07d81abbeffa726e9661b23a61fae/atomica-1.26.0.tar.gz
BuildArch:	noarch

Requires:	python3-matplotlib
Requires:	python3-numpy
Requires:	python3-scipy
Requires:	python3-pandas
Requires:	python3-xlsxwriter
Requires:	python3-openpyxl
Requires:	python3-pyswarm
Requires:	python3-hyperopt
Requires:	python3-sciris
Requires:	python3-tqdm

%description
# Atomica

[![Build Status](https://dev.azure.com/AtomicaTeam/Atomica/_apis/build/status/atomicateam.atomica?branchName=master)](https://dev.azure.com/AtomicaTeam/Atomica/_build/latest?definitionId=1&branchName=master)

[![PyPi version](https://badgen.net/pypi/v/atomica/)](https://pypi.com/project/atomica)

Atomica is a simulation engine for compartmental models. It can be used to simulate disease epidemics, health care cascades, and many other things.

For detailed documentation, visit [https://atomica.tools/docs](https://atomica.tools/docs)

## Installation

Atomica is available for Python 3 only. Because we develop using Python 3.7, it is possible that dictionary order is relevant (although we endeavour to use ordered dictionaries via `Sciris` in places where order matters). Therefore, we only _officially_ support Python 3.7, as this is the first Python release that guarantees ordering of all dictionaries.

Atomica is distributed via PyPI, and the PyPI version corresponds to `master` branch of this repository. To install via PyPI, it is only necessary to run

```
pip install atomica
```

Installation of `numpy`, `scipy` and `matplotlib` will automatically take place via `pip` because they are dependencies of Atomica. However, in practice these packages may require system-level setup so it is usually easiest to install them separately beforehand. We recommend using Anaconda, which facilitates getting the binaries and dependencies like QT installed in a platform-agnostic manner. We also recommend working within an Anaconda environment.

You may also wish to install `mkl` first, before installing `numpy` etc. to improve performance. So for example:

```
conda install mkl
conda install numpy scipy matplotlib
```

## Git installation

If you want to install a different branch of Atomica, or plan to make changes to the Atomica source code, you will need to install Atomica via Git rather than via PyPI. This can be performed using

```
git clone https://github.com/atomicateam/atomica.git
cd atomica
pip install -e .
```

## Running tests

Atomica includes a suite of tests, some of which get automatically run and others that are used manually. The automated test suite can be executed with `pytest`, and can be run from within an isolated environment using `tox`. To use the tests, you will need to follow the steps above to perform a 'Git installation' because the tests are not included in the PyPI distribution. After installation, you can run individual test scripts from the `tests` directory with commands like:

```
python tests/testworkflow.py
```

Note that many of the tests open `matplotlib` figures as part of the test. If the test script is run on a machine without a display available, the error

```
_tkinter.TclError: couldn't connect to display "localhost:0.0"
```

will be raised. In that case, simply set the `matplotlib` backend to `agg` which allows the calls to succeed with a display present. For example, run

```
export MPLBACKEND=agg
python tests/testworkflow.py
```

To run the automated suite, install the test dependencies using

```
pip install -r requirements.txt
```

which will install the additional development dependencies. Then, to run the automated suite, from the root directory (the one containing `README.md`) run:

```
pytest
```

To run the tests in an isolated virtual environment, from the root directory, run

```
tox
```

If you don't have `tox`, install it using `pip install tox`. The default configuration expects Python 3.6 and Python 3.7 to be on your system - to test only against a specific version, pass the python version as an argument to `tox` e.g.

```
tox -e py37
```

to test Python 3.7 only. 

## Troubleshooting

### Installation fails due to missing `numpy`

If running `pip install -e .` in a new environment, `numpy` must be installed prior to `scipy`. In some cases,
installing `numpy` may fail due to missing compiler options. In that case, you may wish to install `numpy` via Anaconda
(by installing Python through Anaconda, and using `conda install numpy scipy matplotlib`). In general, our experience
has been that it is easier to set up the C binaries for `numpy` and the QT dependencies for `matplotlib` via Anaconda
rather than doing this via the system, which involves different steps on every platform.

### Figure plotting hangs

On some systems, the default `matplotlib` backend may hang - this is not an issue with `atomica`. To resolve, try changing the backend by including 

```
import matplotlib
matplotlib.use("Qt5Agg")
```

at the very start of your script. A different backend may be required for your system. You can make the change persistant by setting the backend in your `matplotlibrc` file.


%package -n python3-atomica
Summary:	Toolbox for compartment-based dynamic systems with costing and optimization
Provides:	python-atomica
BuildRequires:	python3-devel
BuildRequires:	python3-setuptools
BuildRequires:	python3-pip
%description -n python3-atomica
# Atomica

[![Build Status](https://dev.azure.com/AtomicaTeam/Atomica/_apis/build/status/atomicateam.atomica?branchName=master)](https://dev.azure.com/AtomicaTeam/Atomica/_build/latest?definitionId=1&branchName=master)

[![PyPi version](https://badgen.net/pypi/v/atomica/)](https://pypi.com/project/atomica)

Atomica is a simulation engine for compartmental models. It can be used to simulate disease epidemics, health care cascades, and many other things.

For detailed documentation, visit [https://atomica.tools/docs](https://atomica.tools/docs)

## Installation

Atomica is available for Python 3 only. Because we develop using Python 3.7, it is possible that dictionary order is relevant (although we endeavour to use ordered dictionaries via `Sciris` in places where order matters). Therefore, we only _officially_ support Python 3.7, as this is the first Python release that guarantees ordering of all dictionaries.

Atomica is distributed via PyPI, and the PyPI version corresponds to `master` branch of this repository. To install via PyPI, it is only necessary to run

```
pip install atomica
```

Installation of `numpy`, `scipy` and `matplotlib` will automatically take place via `pip` because they are dependencies of Atomica. However, in practice these packages may require system-level setup so it is usually easiest to install them separately beforehand. We recommend using Anaconda, which facilitates getting the binaries and dependencies like QT installed in a platform-agnostic manner. We also recommend working within an Anaconda environment.

You may also wish to install `mkl` first, before installing `numpy` etc. to improve performance. So for example:

```
conda install mkl
conda install numpy scipy matplotlib
```

## Git installation

If you want to install a different branch of Atomica, or plan to make changes to the Atomica source code, you will need to install Atomica via Git rather than via PyPI. This can be performed using

```
git clone https://github.com/atomicateam/atomica.git
cd atomica
pip install -e .
```

## Running tests

Atomica includes a suite of tests, some of which get automatically run and others that are used manually. The automated test suite can be executed with `pytest`, and can be run from within an isolated environment using `tox`. To use the tests, you will need to follow the steps above to perform a 'Git installation' because the tests are not included in the PyPI distribution. After installation, you can run individual test scripts from the `tests` directory with commands like:

```
python tests/testworkflow.py
```

Note that many of the tests open `matplotlib` figures as part of the test. If the test script is run on a machine without a display available, the error

```
_tkinter.TclError: couldn't connect to display "localhost:0.0"
```

will be raised. In that case, simply set the `matplotlib` backend to `agg` which allows the calls to succeed with a display present. For example, run

```
export MPLBACKEND=agg
python tests/testworkflow.py
```

To run the automated suite, install the test dependencies using

```
pip install -r requirements.txt
```

which will install the additional development dependencies. Then, to run the automated suite, from the root directory (the one containing `README.md`) run:

```
pytest
```

To run the tests in an isolated virtual environment, from the root directory, run

```
tox
```

If you don't have `tox`, install it using `pip install tox`. The default configuration expects Python 3.6 and Python 3.7 to be on your system - to test only against a specific version, pass the python version as an argument to `tox` e.g.

```
tox -e py37
```

to test Python 3.7 only. 

## Troubleshooting

### Installation fails due to missing `numpy`

If running `pip install -e .` in a new environment, `numpy` must be installed prior to `scipy`. In some cases,
installing `numpy` may fail due to missing compiler options. In that case, you may wish to install `numpy` via Anaconda
(by installing Python through Anaconda, and using `conda install numpy scipy matplotlib`). In general, our experience
has been that it is easier to set up the C binaries for `numpy` and the QT dependencies for `matplotlib` via Anaconda
rather than doing this via the system, which involves different steps on every platform.

### Figure plotting hangs

On some systems, the default `matplotlib` backend may hang - this is not an issue with `atomica`. To resolve, try changing the backend by including 

```
import matplotlib
matplotlib.use("Qt5Agg")
```

at the very start of your script. A different backend may be required for your system. You can make the change persistant by setting the backend in your `matplotlibrc` file.


%package help
Summary:	Development documents and examples for atomica
Provides:	python3-atomica-doc
%description help
# Atomica

[![Build Status](https://dev.azure.com/AtomicaTeam/Atomica/_apis/build/status/atomicateam.atomica?branchName=master)](https://dev.azure.com/AtomicaTeam/Atomica/_build/latest?definitionId=1&branchName=master)

[![PyPi version](https://badgen.net/pypi/v/atomica/)](https://pypi.com/project/atomica)

Atomica is a simulation engine for compartmental models. It can be used to simulate disease epidemics, health care cascades, and many other things.

For detailed documentation, visit [https://atomica.tools/docs](https://atomica.tools/docs)

## Installation

Atomica is available for Python 3 only. Because we develop using Python 3.7, it is possible that dictionary order is relevant (although we endeavour to use ordered dictionaries via `Sciris` in places where order matters). Therefore, we only _officially_ support Python 3.7, as this is the first Python release that guarantees ordering of all dictionaries.

Atomica is distributed via PyPI, and the PyPI version corresponds to `master` branch of this repository. To install via PyPI, it is only necessary to run

```
pip install atomica
```

Installation of `numpy`, `scipy` and `matplotlib` will automatically take place via `pip` because they are dependencies of Atomica. However, in practice these packages may require system-level setup so it is usually easiest to install them separately beforehand. We recommend using Anaconda, which facilitates getting the binaries and dependencies like QT installed in a platform-agnostic manner. We also recommend working within an Anaconda environment.

You may also wish to install `mkl` first, before installing `numpy` etc. to improve performance. So for example:

```
conda install mkl
conda install numpy scipy matplotlib
```

## Git installation

If you want to install a different branch of Atomica, or plan to make changes to the Atomica source code, you will need to install Atomica via Git rather than via PyPI. This can be performed using

```
git clone https://github.com/atomicateam/atomica.git
cd atomica
pip install -e .
```

## Running tests

Atomica includes a suite of tests, some of which get automatically run and others that are used manually. The automated test suite can be executed with `pytest`, and can be run from within an isolated environment using `tox`. To use the tests, you will need to follow the steps above to perform a 'Git installation' because the tests are not included in the PyPI distribution. After installation, you can run individual test scripts from the `tests` directory with commands like:

```
python tests/testworkflow.py
```

Note that many of the tests open `matplotlib` figures as part of the test. If the test script is run on a machine without a display available, the error

```
_tkinter.TclError: couldn't connect to display "localhost:0.0"
```

will be raised. In that case, simply set the `matplotlib` backend to `agg` which allows the calls to succeed with a display present. For example, run

```
export MPLBACKEND=agg
python tests/testworkflow.py
```

To run the automated suite, install the test dependencies using

```
pip install -r requirements.txt
```

which will install the additional development dependencies. Then, to run the automated suite, from the root directory (the one containing `README.md`) run:

```
pytest
```

To run the tests in an isolated virtual environment, from the root directory, run

```
tox
```

If you don't have `tox`, install it using `pip install tox`. The default configuration expects Python 3.6 and Python 3.7 to be on your system - to test only against a specific version, pass the python version as an argument to `tox` e.g.

```
tox -e py37
```

to test Python 3.7 only. 

## Troubleshooting

### Installation fails due to missing `numpy`

If running `pip install -e .` in a new environment, `numpy` must be installed prior to `scipy`. In some cases,
installing `numpy` may fail due to missing compiler options. In that case, you may wish to install `numpy` via Anaconda
(by installing Python through Anaconda, and using `conda install numpy scipy matplotlib`). In general, our experience
has been that it is easier to set up the C binaries for `numpy` and the QT dependencies for `matplotlib` via Anaconda
rather than doing this via the system, which involves different steps on every platform.

### Figure plotting hangs

On some systems, the default `matplotlib` backend may hang - this is not an issue with `atomica`. To resolve, try changing the backend by including 

```
import matplotlib
matplotlib.use("Qt5Agg")
```

at the very start of your script. A different backend may be required for your system. You can make the change persistant by setting the backend in your `matplotlibrc` file.


%prep
%autosetup -n atomica-1.26.0

%build
%py3_build

%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
	find usr/lib -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
	find usr/lib64 -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
	find usr/bin -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
	find usr/sbin -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
	find usr/share/man -type f -printf "\"/%h/%f.gz\"\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .

%files -n python3-atomica -f filelist.lst
%dir %{python3_sitelib}/*

%files help -f doclist.lst
%{_docdir}/*

%changelog
* Thu Jun 08 2023 Python_Bot <Python_Bot@openeuler.org> - 1.26.0-1
- Package Spec generated