-
Notifications
You must be signed in to change notification settings - Fork 82
Expand file tree
/
Copy pathsetup.py
More file actions
137 lines (127 loc) · 6.5 KB
/
Copy pathsetup.py
File metadata and controls
137 lines (127 loc) · 6.5 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
#########################################
# setup.py #
# Setup for PyBKT #
# #
# @author Anirudhan Badrinath #
# Last edited: 01 April 2021 #
#########################################
import os
from os.path import normpath as npath
import sys
from sysconfig import get_paths
from setuptools import setup, Extension
import platform
from distutils.command.build_ext import build_ext
sys.tracebacklimit = 0
class CustomBuildExtCommand(build_ext):
"""build_ext command for use when numpy headers are needed."""
""" https://stackoverflow.com/questions/2379898/make-distutils-look-for-numpy-header-files-in-the-correct-place """
def run(self):
import numpy
self.include_dirs.append(numpy.get_include())
build_ext.run(self)
FILES = {'synthetic_data_helper.cpp': 'source-cpp/pyBKT/generate/',
'predict_onestep_states.cpp': 'source-cpp/pyBKT/fit/',
'E_step.cpp': 'source-cpp/pyBKT/fit/'}
if platform.system() == 'Darwin':
ALL_COMPILE_ARGS = ['-c', '-fPIC', '-w', '-O3', '-stdlib=libc++', '-Xpreprocessor', '-fopenmp']
ALL_LINK_ARGS = ['-stdlib=libc++']
ALL_LIBRARIES = ['pthread', 'dl', 'util', 'm', 'omp']
else:
ALL_COMPILE_ARGS = ['-c', '-fPIC', '-w', '-fopenmp', '-O2']
ALL_LINK_ARGS = ['-fopenmp']
ALL_LIBRARIES = ['pthread', 'dl', 'util', 'm']
INCLUDE_DIRS = sys.path + ['source-cpp/pyBKT/Eigen/', get_paths()['include']]
LIBRARY_DIRS = [os.environ['LD_LIBRARY_PATH']] if 'LD_LIBRARY_PATH' in os.environ \
else []
def clean():
global LIBRARY_DIRS, ALL_LIBRARIES
LIBRARY_DIRS = [i for i in LIBRARY_DIRS if i != ""]
ALL_LIBRARIES = [i for i in ALL_LIBRARIES if i != ""]
with open('README.md', encoding='utf-8') as f:
long_description = f.read()
LIBRARY_DIRS += [sys.exec_prefix + '/lib']
clean()
try:
module1 = Extension('pyBKT/generate/synthetic_data_helper',
sources = [npath('source-cpp/pyBKT/generate/synthetic_data_helper.cpp')],
include_dirs = INCLUDE_DIRS,
extra_compile_args = ALL_COMPILE_ARGS,
library_dirs = LIBRARY_DIRS,
libraries = ALL_LIBRARIES,
extra_link_args = ALL_LINK_ARGS)
module2 = Extension('pyBKT/fit/E_step',
sources = [npath('source-cpp/pyBKT/fit/E_step.cpp')],
include_dirs = INCLUDE_DIRS,
extra_compile_args = ALL_COMPILE_ARGS,
library_dirs = LIBRARY_DIRS,
libraries = ALL_LIBRARIES,
extra_link_args = ALL_LINK_ARGS)
module3 = Extension('pyBKT/fit/predict_onestep_states',
sources = [npath('source-cpp/pyBKT/fit/predict_onestep_states.cpp')],
include_dirs = INCLUDE_DIRS,
extra_compile_args = ALL_COMPILE_ARGS,
library_dirs = LIBRARY_DIRS,
libraries = ALL_LIBRARIES,
extra_link_args = ALL_LINK_ARGS)
setup(
name="pyBKT",
version="1.4.2",
author="Zachary Pardos, Anirudhan Badrinath, Matthew Jade Johnson, Christian Garay",
author_email="zp@berkeley.edu, abadrinath@berkeley.edu, mattjj@csail.mit.edu, c.garay@berkeley.edu",
license = 'MIT',
description="PyBKT - Python Implentation of Bayesian Knowledge Tracing",
url="https://github.com/CAHLR/pyBKT",
download_url = 'https://github.com/CAHLR/pyBKT/archive/refs/tags/1.4.2.tar.gz',
keywords = ['BKT', 'Bayesian Knowledge Tracing', 'Bayesian Network', 'Hidden Markov Model', 'Intelligent Tutoring Systems', 'Adaptive Learning'],
classifiers=[
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
long_description = long_description,
long_description_content_type='text/markdown',
packages=['pyBKT', 'pyBKT.generate', 'pyBKT.fit', 'pyBKT.util', 'pyBKT.models'],
package_dir = { 'pyBKT': npath('source-cpp/pyBKT'),
'pyBKT.generate': npath('source-cpp/pyBKT/generate'),
'pyBKT.fit': npath('source-cpp/pyBKT/fit'),
'pyBKT.util': npath('source-cpp/pyBKT/util'),
'pyBKT.models': npath('source-cpp/pyBKT/models')},
install_requires = ["numpy", "scikit-learn", "pandas", "requests"],
setup_requires = ["numpy"],
cmdclass = {'build_ext': CustomBuildExtCommand},
ext_modules = [module1, module2, module3]
)
except:
# LEGACY PURE PYTHON VERSION:
setup(
name="pyBKT",
version="1.4.2",
author="Zachary Pardos, Anirudhan Badrinath, Matthew Jade Johnson, Christian Garay",
author_email="zp@berkeley.edu, abadrinath@berkeley.edu, mattjj@csail.mit.edu, c.garay@berkeley.edu",
license = 'MIT',
description="PyBKT - Python Implentation of Bayesian Knowledge Tracing",
url="https://github.com/CAHLR/pyBKT",
download_url = 'https://github.com/CAHLR/pyBKT/archive/refs/tags/1.4.2.tar.gz',
keywords = ['BKT', 'Bayesian Knowledge Tracing', 'Bayesian Network', 'Hidden Markov Model', 'Intelligent Tutoring Systems', 'Adaptive Learning'],
classifiers=[
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
long_description = long_description,
long_description_content_type='text/markdown',
packages=['pyBKT', 'pyBKT.generate', 'pyBKT.fit', 'pyBKT.util', 'pyBKT.models'],
package_dir = { 'pyBKT': npath('source-py/pyBKT'),
'pyBKT.generate': npath('source-py/pyBKT/generate'),
'pyBKT.fit': npath('source-py/pyBKT/fit'),
'pyBKT.util': npath('source-py/pyBKT/util'),
'pyBKT.models': npath('source-py/pyBKT/models')},
install_requires = ["numpy", "scikit-learn", "pandas", "requests"],
)