-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathold_setup.py
103 lines (77 loc) · 4.44 KB
/
old_setup.py
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
__doc__ = """A setup script targeted to my computer. Should work fine on any windows_latest-amd64.
Usage:
`python setup.py build_ext --inplace -j9`
It will build the extension modules directly in the `\MontyCarlo` folder using 9 threads.
"""
__author__ = "Rui Campos"
from setup_version import version
import os
from Cython.Build import cythonize
try:
from setuptools import setup, find_packages
from setuptools import Extension
except ImportError:
from distutils.core import setup, find_packages
from distutils.extension import Extension
from pathlib import Path
from Cython.Distutils import build_ext
import Cython.Compiler.Options # COMPILER OPTIONS
import numpy as np # need to compile it with the extension modules
# MSVC ARGUMENTS
args = [
"-O2", # code optimization
"-fp:fast" # math optimization -> changes order of math operations for max efficiency
]
ext_modules = [
Extension("tools.*", ["MontyCarlo\\tools\\*.pyx"], extra_compile_args = args),
Extension("particles.*", ["MontyCarlo\\particles\\*.pyx"], extra_compile_args = args),
Extension("*", ["MontyCarlo\\*.pyx"], extra_compile_args = args),
Extension("geometry.*", ["MontyCarlo\\geometry\\*.pyx"], extra_compile_args = args),
Extension("materials.electron.*", ["MontyCarlo\\materials\\electron\\*.pyx"], extra_compile_args = args),
Extension("materials.positron.*", ["MontyCarlo\\materials\\positron\\*.pyx"], extra_compile_args = args),
Extension("materials.*", ["MontyCarlo\\materials\\*.pyx"], extra_compile_args = args),
Extension("materials.photon.*", ["MontyCarlo\\materials\\photon\\*.pyx"], extra_compile_args = args),
Extension("external.*", ["MontyCarlo\\external\\*.pyx"], extra_compile_args = args)
]
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
if __name__ == "__main__":
setup(
name = "MontyCarlo",
version = version,
author = "Rui Filipe de Sousa Campos",
description = "A fast general purpose monte carlo particle simulator (photons, electrons and positrons). Written in Cython, Python and C++.",
long_description = long_description,
long_description_content_type="text/markdown",
url="https://github.com/RuiFilipeCampos/MontyCarlo",
setup_requires = ['setuptools_scm'],
install_requires = ['requests', # for downloading databases
'gdown', # for downloading databases
'numpy', # for data processing and C-API
'scipy', # for data processing
'matplotlib', # for data visualization
'pyvista', # for geometry debugging and data visualization
'numba', # for JIT compilation, will be deprecated in the future
'bs4', # for some other dependency
'pandas', # for data processing, data reading and for htmlcreator
'plotly', # for htmlcreator
'scikit-image',
'Jinja2',
'pyunpack',
'patool'],
include_package_data = True,
packages = find_packages(),
cmdclass = {'build_ext': build_ext},
include_dirs = [".", np.get_include(), "_random"],
ext_modules = cythonize(
ext_modules,
annotate = False, # this is getting overriden locally ._.
compiler_directives = {
'profile' : False, # this is also getting overriden locally ._.
'language_level' : "3"
}
)
)
# https://journals.sagepub.com/doi/suppl/10.1177/ANIB_39_2
# https://iopscience.iop.org/article/10.1088/1742-6596/1662/1/012021/pdf
# https://iopscience.iop.org/article/10.1088/0031-9155/51/14/017