-
Notifications
You must be signed in to change notification settings - Fork 5
/
setup.py
74 lines (65 loc) · 2.54 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
from setuptools import setup, find_packages
from setuptools.command.install import install
import sys
import os
import site
import tarfile
PACKAGENAME = 'snmachine'
__FALLBACK_VERSION__ = '2.1.0'
class ExtractExampleData(install):
"""Post-installation data extraction."""
def run(self):
install.run(self)
"""Extract example data in the installation directory"""
if '--user' in sys.argv:
paths = (site.getusersitepackages(),)
print("""Package installed outside of conda enviroment.
Dependencies may be missing""")
else:
paths = (site.getsitepackages(),)
install_directory = paths[0][0]
install_directory = os.path.join(install_directory, PACKAGENAME)
# Find example_data
example_data = os.path.join(install_directory, 'example_data')
spcc_data = os.path.join(PACKAGENAME, 'example_data',
'SPCC_SUBSET')
# Untar example data
tar = tarfile.open(spcc_data + '.tar.gz')
tar.extractall(example_data)
setup(
name='snmachine',
author='Michelle Lochner et al.',
author_email='dr.michelle.lochner@gmail.com',
description='Machine learning code for photometric supernova '
'classification',
url='https://github.com/LSSTDESC/snmachine',
license='BSD-3-Clause License',
use_scm_version={
"root": ".",
"relative_to": __file__,
"fallback_version": __FALLBACK_VERSION__},
setup_requires=['setuptools_scm>=3.2.0'],
packages=find_packages(),
include_package_data=True,
package_data={'snmachine': ['example_data/SPCC_SUBSET.tar.gz',
'example_data/output_spcc_no_z/features/*.dat',
'example_data/example_data_for_tests.pckl']},
exclude_package_data={'utils': ['archive/*']},
cmdclass={'install': ExtractExampleData},
install_requires=['astropy>=1.1.2',
'matplotlib>=3.0.0',
'numpy>=1.18.4',
'scikit-learn',
'scipy>=1.4.0',
'george>=0.3.0',
'iminuit',
'pandas>=0.23.0',
'pywavelets>=0.4.0',
'sncosmo>=2.1.0',
'nose>=1.3.7',
'future>=0.16',
'pyyaml>=3.13',
'seaborn',
'lightgbm',
'setuptools_scm']
)