-
Notifications
You must be signed in to change notification settings - Fork 86
/
Copy pathsetup.py
126 lines (116 loc) · 4.95 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
"""Setup script for Switch.
Use "pip install --upgrade ." to install a copy in the site packages directory.
Use "pip install --upgrade --editable ." to install Switch to be run from its
current location.
Optional dependencies can be added during the initial install or later by
running a command like this:
pip install --upgrade --editable .[advanced,database_access]
Use "pip uninstall switch" to uninstall switch from your system.
"""
import os
from setuptools import setup, find_packages
# Get the version number. Strategy #3 from https://packaging.python.org/single_source_version/
version_path = os.path.join(os.path.dirname(__file__), "switch_model", "version.py")
version = {}
with open(version_path) as f:
exec(f.read(), version)
__version__ = version["__version__"]
# for metadata patch
__version__ += ".post0"
def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
setup(
name="switch_model",
version=__version__,
maintainer="Switch Authors",
maintainer_email="[email protected]",
url="http://switch-model.org",
license="Apache License 2.0",
platforms=["any"],
description="Switch Power System Planning Model",
long_description=read("README"),
long_description_content_type="text/markdown",
classifiers=[
# from https://pypi.org/classifiers/
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Intended Audience :: Education",
"Intended Audience :: End Users/Desktop",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: Apache Software License",
"Natural Language :: English",
"Operating System :: Microsoft :: Windows",
"Operating System :: MacOS :: MacOS X",
"Operating System :: POSIX :: Linux",
"Operating System :: Unix",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Topic :: Scientific/Engineering",
"Topic :: Software Development :: Libraries :: Python Modules",
],
packages=find_packages(include=["switch_model", "switch_model.*"]),
keywords=[
"renewable",
"power",
"energy",
"electricity",
"production cost",
"capacity expansion",
"planning",
"optimization",
],
# We pin the upper limit for Pyomo and Python because there have been cases
# where Pyomo introduced non-backward compatible changes or started crashing
# with a new version of Python (e.g., Pyomo <=6.4.2 crashed on Python 3.11).
# There's still some chance users will end up with an incompatible mix with
# these or with other packages (e.g., newer versions of testfixtures don't
# work on older versions of Python without adding mock, and testfixtures
# 6.3.0 fails on Python >= 3.10), but we don't have an easy way to identify
# compatible mixes and we don't want to be overly restrictive.
# Note: testfixtures requires a separate mock installation if running with
# Python 3.7.0 or 3.7.1, so we require a higher version to avoid this. (Newer
# versions of Pyomo need 3.8+ anyway.)
python_requires=">=3.7.2, <3.14.0a0",
install_requires=[
# In principle, we could accept Pyomo 5.6.9, but it tends to install
# a non-compatible version of pyutilib (needs 5.8.0 but accepts 6.0.0
# and then breaks). On the other hand, Pyomo 5.7 requires pyutilib 6.0.0
# and Pyomo 6.0 doesn't require pyutilib at all. So we now use Pyomo 6.0+
# and skip pyutilib.
"Pyomo >=6.0.0, <=6.9.1",
# pint is needed by Pyomo 6.4.1, 6.7.1 and probably others (but not
# 6.0.0) when running our tests. But it isn't listed as a Pyomo
# dependency, so we add it explicitly. (Still true as of Pyomo 6.7.1).
"pint",
# used for standard tests
"testfixtures",
# used for input upgrades and some reporting
"pandas",
# provides pkg_resources used by upgrade scripts
"setuptools",
# Note: if users pick pyomo <6.8.0 and numpy >=2.0 (brought
# in by pandas), pyomo will crash. We could avoid this by requiring
# numpy <2.0, but instead we assume they will use a newer version
# of pyomo if they are using a newer version of numpy.
],
extras_require={
# packages used for advanced demand response, progressive hedging
"advanced": [
"numpy",
"scipy",
"rpy2",
"sympy",
],
"dev": ["ipdb"],
"plotting": [
# We have previously had to work around incompatibilities between
# different versions of plotnine and matplotlib
# (https://stackoverflow.com/a/73797154/) but they seem to be
# resolved now.
"plotnine",
"matplotlib",
],
"database_access": ["psycopg2-binary"],
},
entry_points={"console_scripts": ["switch = switch_model.main:main"]},
)