-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.py
86 lines (73 loc) · 2.2 KB
/
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
import os, pathlib
from setuptools.command.develop import develop
from setuptools.command.install import install
from setuptools.command.sdist import sdist
from setuptools import setup, find_packages
from subprocess import check_call
HERE = pathlib.Path(__file__).parent
PACKAGE_NAME = 'lgndbdt'
VERSION = '1.0.1'
AUTHOR = 'Henry Nachman'
AUTHOR_EMAIL = 'henachman@unc.edu'
URL = 'https://github.com/henry-e-n/lgndbdt.git'
DESCRIPTION ='Python package for extracting PSDs and training a BDT'
LICENSE ='Apache-2.0'
LONG_DESCRIPTION = (HERE/"README.md").read_text()
LONG_DESC_TYPE = 'text/markdown'
INSTALL_REQUIRES =['numpy==1.22',
'matplotlib',
'scipy',
'lightgbm',
'shap',
'tqdm',
'imblearn',
'h5py',
'eli5',
'pillow',
'ipython']
def gitcmd_update_submodules():
''' Check if the package is being deployed as a git repository. If so, recursively
update all dependencies.
@returns True if the package is a git repository and the modules were updated.
False otherwise.
'''
if os.path.exists(os.path.join(HERE, '.git')):
check_call(['git', 'submodule', 'update', '--init', '--recursive'])
return True
return False
class gitcmd_develop(develop):
''' Specialized packaging class that runs git submodule update --init --recursive
as part of the update/install procedure.
'''
def run(self):
gitcmd_update_submodules()
develop.run(self)
class gitcmd_install(install):
''' Specialized packaging class that runs git submodule update --init --recursive
as part of the update/install procedure.
'''
def run(self):
gitcmd_update_submodules()
install.run(self)
class gitcmd_sdist(sdist):
''' Specialized packaging class that runs git submodule update --init --recursive
as part of the update/install procedure;.
'''
def run(self):
gitcmd_update_submodules()
sdist.run(self)
setup(
cmdclass={
'develop': gitcmd_develop,
'install': gitcmd_install,
'sdist': gitcmd_sdist,
},
name=PACKAGE_NAME,
version=VERSION,
description=DESCRIPTION,
long_description_content_type=LONG_DESC_TYPE,
author=AUTHOR, license=LICENSE,
author_email=AUTHOR_EMAIL,
url=URL,
install_requires=INSTALL_REQUIRES,
packages=find_packages())