-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsetup.py
More file actions
152 lines (132 loc) · 4.22 KB
/
setup.py
File metadata and controls
152 lines (132 loc) · 4.22 KB
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
import ast
import glob
import os
import platform
from setuptools import find_packages, setup
from setuptools.command.sdist import sdist as _sdist
pyamares_init_file = os.path.join(os.path.dirname(__file__), "pyAMARES", "__init__.py")
def get_version(init_file_path, *variables):
with open(init_file_path, "r") as file:
file_content = file.read()
tree = ast.parse(file_content)
vars_dict = {}
for node in tree.body:
if isinstance(node, ast.Assign):
for target in node.targets:
if isinstance(target, ast.Name) and target.id in variables:
value = eval(
compile(ast.Expression(node.value), init_file_path, "eval")
)
vars_dict[target.id] = value
return vars_dict
vars_dict = get_version(pyamares_init_file, "__version__", "__author__")
__version__ = vars_dict.get("__version__")
__author__ = vars_dict.get("__author__")
# __version__ = "0.2"
# __author__ = "Jia Xu"
# from pyAMARES import __author__, __version__
class CustomSDist(_sdist):
user_options = _sdist.user_options + [
("include-docs", None, "Include documentation in the distribution")
]
def initialize_options(self):
_sdist.initialize_options(self)
self.include_docs = False
def finalize_options(self):
_sdist.finalize_options(self)
def run(self):
if self.include_docs:
self.distribution.data_files.extend(
[
("docs", glob.glob("docs/source/**", recursive=True)),
("docs", glob.glob("docs/*.*")),
("docs", ["docs/Makefile"]),
]
)
_sdist.run(self)
jupyter_requirements = [
"ipykernel",
"notebook",
]
doc_requirements = [
"sphinx",
"nbsphinx",
"sphinx_tabs",
"sphinx_rtd_theme",
"Pygments",
"ipywidgets",
]
ruff_requirements = [
"ruff",
"pre-commit",
"pytest",
]
install_requires = [
"pandas>=1.1.0",
"matplotlib>=3.1.3",
"lmfit",
"numpy>=1.18.1",
"scipy>=1.2.1",
"sympy",
"nmrglue",
"xlrd",
"jinja2",
"tqdm",
"mat73",
"ipython",
"ipykernel",
"requests",
"ipywidgets>=7.6.0,<8.0.0;python_version<'3.11'", # For older Python versions
"ipywidgets>=8.0.0;python_version>='3.11'", # For newer Python versions
]
# Use the better-performing 'hlsvdpro' package if running on supported platforms
# (e.g., x86_64 or amd64 architectures). Otherwise, fall back to the custom
# 'hlsvdpropy' implementation located in pyAMARES/libs/hlsvd.py.
if platform.machine().lower() in ["x86_64", "amd64"]:
install_requires.append("hlsvdpro>=2.0.0")
setup(
name="pyAMARES",
version=__version__,
author=__author__,
author_email="jia-xu-1@uiowa.edu",
description=(
"PyAMARES, an Open-Source Python Library for Fitting Magnetic Resonance "
"Spectroscopy Data"
),
long_description=open("README.rst").read(),
long_description_content_type="text/x-rst",
url="https://github.com/hawkMRS/pyAMARES", # Optional project URL
packages=find_packages(),
classifiers=[
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Topic :: Scientific/Engineering",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
],
python_requires=">=3.8", # Minimum Python version requirement
install_requires=install_requires,
extras_require={
"docs": doc_requirements,
"jupyter": jupyter_requirements,
"ruff": ruff_requirements,
"dev": jupyter_requirements + doc_requirements + ruff_requirements,
},
cmdclass={
"sdist": CustomSDist,
},
data_files=[],
zip_safe=False,
include_package_data=True,
entry_points={
"console_scripts": [
"amaresFit=pyAMARES.script.amaresfit:main",
],
},
)