-
Notifications
You must be signed in to change notification settings - Fork 5
/
setup.py
107 lines (86 loc) · 3.1 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
import re
import sys
import os
from collections import defaultdict
from setuptools import find_packages, setup
import versioneer
if sys.version_info < (3, 6):
error = """
andes does not support Python <= {0}.{1}.
Python 3.6 and above is required. Check your Python version like so:
python3 --version
This may be due to an out-of-date pip. Make sure you have pip >= 9.0.1.
Upgrade pip like so:
pip install --upgrade pip
""".format(3, 6)
sys.exit(error)
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'README.md'), encoding='utf-8') as readme_file:
readme = readme_file.read()
def parse_requires(filename):
with open(os.path.join(here, filename)) as requirements_file:
reqs = [
line for line in requirements_file.read().splitlines()
if not line.startswith('#')
]
return reqs
def get_extra_requires(filename, add_all=True):
"""
Build ``extras_require`` from an invert requirements file.
See:
https://hanxiao.io/2019/11/07/A-Better-Practice-for-Managing-extras-require-Dependencies-in-Python/
"""
with open(os.path.join(here, filename)) as fp:
extra_deps = defaultdict(set)
for k in fp:
if k.strip() and not k.startswith('#'):
tags = set()
if '#' in k:
if k.count("#") > 1:
raise ValueError("Invalid line: {}".format(k))
k, v = k.split('#')
tags.update(vv.strip() for vv in v.split(','))
tags.add(re.split('[<=>]', k)[0])
for t in tags:
extra_deps[t].add(k)
# add tag `all` at the end
if add_all:
extra_deps['all'] = set(vv for v in extra_deps.values() for vv in v)
return extra_deps
extras_require = get_extra_requires("requirements-extra.txt")
setup(
name='agvis',
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
description="Web application of geographical visualizer for energy systems",
long_description=readme,
long_description_content_type='text/markdown',
author="Zack Malkmus, Nicholas West, Nicholas Parsly, Jinning Wang",
author_email='[email protected]',
url='https://github.com/CURENT/agvis',
packages=find_packages(exclude=[]),
entry_points={
'console_scripts': [
'agvis = agvis.cli:main',
],
},
include_package_data=True,
package_data={
'agvis': [
# When adding files here, remember to update MANIFEST.in as well,
# or else they will not be included in the distribution on PyPI!
# 'path/to/data_file',
]
},
use_scm_version=True,
install_requires=parse_requires('requirements.txt'),
extras_require=extras_require,
license="GNU Public License v3",
classifiers=[
'Development Status :: 4 - Beta',
'Natural Language :: English',
'Programming Language :: Python :: 3',
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
'Environment :: Console',
],
)