forked from NREL/disco
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
145 lines (126 loc) · 3.86 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
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
138
139
140
141
142
143
144
145
"""
setup.py
"""
import os
import logging
from codecs import open
from pathlib import Path
from setuptools import setup, find_packages
from setuptools.command.develop import develop
from setuptools.command.install import install
import sys
logger = logging.getLogger(__name__)
def read_lines(filename):
return Path(filename).read_text().splitlines()
class PostDevelopCommand(develop):
"""Post-installation for development mode."""
def run(self):
develop.run(self)
install_jade_extensions()
class PostInstallCommand(install):
"""Post-installation for installation mode."""
def run(self):
install.run(self)
install_jade_extensions()
def install_jade_extensions():
# These won't be available until after jade gets installed by pip.
from jade.extensions.registry import Registry
from jade.utils.subprocess_manager import run_command
registry_filename = Path.home() / Registry._REGISTRY_FILENAME
if os.path.exists(registry_filename):
os.remove(registry_filename)
ext = os.path.join(here, "disco", "extensions", "jade_extensions.json")
run_command(f"jade extensions register {ext}")
run_command("jade extensions add-logger disco")
here = os.path.abspath(os.path.dirname(__file__))
with open("README.md", encoding="utf-8") as f:
readme = f.read()
with open(os.path.join(here, "disco", "version.py"), encoding="utf-8") as f:
lines = f.read().split("\n")
if len(lines) != 2:
print("Invalid format in version.py", file=sys.stderr)
sys.exit(1)
version = lines[0].split()[2].strip('"').strip("'")
install_requires = [
"NREL-jade~=0.10.0",
"chevron~=0.14.0",
"click~=8.0",
"dsspy~=3.0.0",
"filelock~=3.8",
"matplotlib~=3.6",
"networkx~=2.8",
"opendssdirect.py~=0.8.4",
"openpyxl~=3.0",
"pandas~=1.5.0",
"pydantic~=2.5.2",
"seaborn~=0.12.1",
"scikit-learn~=1.1",
"sqlalchemy~=1.4",
"toml~=0.10.0",
]
dev_requires = [
"flake8",
"ghp-import",
"mock>=3.0.0",
"pycodestyle",
"pylint",
"pytest",
"pytest-cov",
"sphinx>=2.0",
"sphinx-rtd-theme>=0.4.3",
"sphinxcontrib-plantuml",
"tox",
]
test_requires = ["pytest"]
setup(
name="NREL-disco",
version=version,
description="DISCO",
long_description=readme,
long_description_content_type="text/markdown",
maintainer_email="[email protected]",
url="https://github.com/NREL/disco",
packages=find_packages(),
package_dir={"disco": "disco"},
entry_points={
"console_scripts": [
"disco=disco.cli.disco:cli",
"disco-internal=disco.cli.disco_internal:cli",
],
},
include_package_data=True,
package_data={
"disco": [
"analysis/*.toml",
"analysis/*.xlsx",
"pipelines/template/*.toml",
"extensions/pydss_simulation/*.toml",
"extensions/pydss_simulation/trained_lm_time_prediction.sav",
"extensions/upgrade_simulation/upgrades/*.xlsx",
"extensions/upgrade_simulation/upgrades/*.toml",
"extensions/*.json",
"postprocess/config/*.toml",
"postprocess/toolbox/query_tool.ipynb",
"pydss/config/*.toml",
],
},
license="BSD license",
zip_safe=False,
keywords=["disco"],
python_requires=">=3.7",
classifiers=[
"Development Status :: 4 - Beta",
"License :: OSI Approved :: BSD License",
"Natural Language :: English",
"Programming Language :: Python :: 3.9",
],
test_suite="tests",
install_requires=install_requires,
extras_require={
"dev": dev_requires,
"extras": ["ipywidgets"]
},
# Disabled because this method is not compatible with wheels, and so we
# can't build a PyPi package.
#cmdclass={"install": PostInstallCommand, "develop": PostDevelopCommand},
)