-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
90 lines (79 loc) · 2.31 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
87
88
89
90
import os
from setuptools import setup, find_packages
from setuptools.command.install import install
from setuptools.command.develop import develop
import pathlib
NAME = 'numpipe'
DESCRIPTION = "Easily run Python functions in parallel and cache the results"
URL = ''
EMAIL = '[email protected]'
AUTHOR = 'John Parker'
KEYWORDS = 'cache pipeline hdf5 parallel cluster'
# REQUIRES_PYTHON = '>=3.6.0'
VERSION = '0.3.3'
LICENSE = 'MIT'
REQUIRED = [
'numpy',
'h5py',
'termcolor',
'toml',
'matplotlib',
'tqdm',
'colorama',
'python-telegram-bot',
]
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
def post_install():
config_str = """
[execution]
parallel_default = true # run with -p flag by default
[notifications]
delay_default = 120 # delay (in seconds) before sending notifications
[notifications.telegram]
token = "" # Telegram bot token
chat_id = 0 # Telegram chat ID
[progress]
character = "#" # progress bar character
mininterval = 0.1 # minimum interval (in seconds) between progress bar updates
""".strip()
config_path = pathlib.Path('~/.config/numpipe/numpipe.conf').expanduser()
if not os.path.exists(config_path):
os.makedirs(config_path.parent, exist_ok=True)
with open(config_path, 'w') as f:
f.write(config_str)
class PostInstallCommand(install):
"""Post-installation for installation mode."""
def run(self):
post_install()
install.run(self)
class PostDevelopCommand(develop):
"""Post-installation for installation mode."""
def run(self):
post_install()
develop.run(self)
setup(
name=NAME,
version=VERSION,
author=AUTHOR,
author_email=EMAIL,
description=DESCRIPTION,
license=LICENSE,
keywords=KEYWORDS,
url=URL,
packages=find_packages(),
long_description=read('README.md'),
long_description_content_type='text/markdown',
install_requires=REQUIRED,
cmdclass={
'develop': PostDevelopCommand,
'install': PostInstallCommand,
},
classifiers=[
'License :: OSI Approved :: MIT License',
'Programming Language :: Python',
'Operating System :: POSIX',
'Operating System :: MacOS',
'Development Status :: 3 - Alpha',
],
)