forked from openscm/openscm-units
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
115 lines (98 loc) · 3.42 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
from setuptools import find_packages, setup
from setuptools.command.test import test as TestCommand
import versioneer
PACKAGE_NAME = "openscm-units"
AUTHORS = [
("Zeb Nicholls", "[email protected]"),
("Sven Willner", "[email protected]"),
("Jared Lewis", "[email protected]"),
("Robert Gieseke", "[email protected]"),
]
URL = "https://github.com/openscm/openscm-units"
DESCRIPTION = "OpenSCM-Units is a repository for handling of units related to simple climate modelling."
README = "README.rst"
SOURCE_DIR = "src"
PACKAGES = find_packages(SOURCE_DIR) # no exclude as only searching in `src`
PACKAGE_DIR = {"": SOURCE_DIR}
REQUIREMENTS = ["pandas", "pint", "globalwarmingpotentials"]
REQUIREMENTS_NOTEBOOKS = ["notebook", "seaborn"]
REQUIREMENTS_TESTS = ["codecov", "coverage", "nbval", "pytest-cov", "pytest>=4.0"]
REQUIREMENTS_DOCS = ["sphinx>=1.4", "sphinx_rtd_theme", "nbsphinx", "ipykernel"]
REQUIREMENTS_DEPLOY = ["twine>=1.11.0", "setuptools>=38.6.0", "wheel>=0.31.0"]
REQUIREMENTS_DEV = [
*[
"bandit",
"black",
"black-nb",
"flake8",
"isort",
"mypy",
"nbdime",
"numpy",
"pydocstyle",
"pylint>=2.4.4",
"dephell_changelogs",
"nbsphinx",
],
*REQUIREMENTS_DEPLOY,
*REQUIREMENTS_DOCS,
*REQUIREMENTS_NOTEBOOKS,
*REQUIREMENTS_TESTS,
]
REQUIREMENTS_EXTRAS = {
"deploy": REQUIREMENTS_DEPLOY,
"dev": REQUIREMENTS_DEV,
"docs": REQUIREMENTS_DOCS,
"notebooks": REQUIREMENTS_NOTEBOOKS,
"tests": REQUIREMENTS_TESTS,
}
# Get the long description from the README file
with open(README, "r") as f:
README_LINES = ["OpenSCM-Units", "==============", ""]
add_line = False
for line in f:
if line.strip() == ".. sec-begin-long-description":
add_line = True
elif line.strip() == ".. sec-end-long-description":
break
elif add_line:
README_LINES.append(line.strip())
if len(README_LINES) < 3:
raise RuntimeError("Insufficient description given")
class OpenscmUnits(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
import pytest
pytest.main(self.test_args)
cmdclass = versioneer.get_cmdclass()
cmdclass.update({"test": OpenscmUnits})
setup(
name=PACKAGE_NAME,
version=versioneer.get_version(),
description=DESCRIPTION,
long_description="\n".join(README_LINES),
long_description_content_type="text/x-rst",
author=", ".join([author[0] for author in AUTHORS]),
author_email=", ".join([author[1] for author in AUTHORS]),
url=URL,
license="3-Clause BSD License",
classifiers=[ # full list at https://pypi.org/pypi?%3Aaction=list_classifiers
"Development Status :: 4 - Beta",
"License :: OSI Approved :: BSD License",
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
],
keywords=["openscm", "units", "python", "repo", "simple", "climate", "model"],
packages=PACKAGES,
package_dir=PACKAGE_DIR,
include_package_data=True,
install_requires=REQUIREMENTS,
extras_require=REQUIREMENTS_EXTRAS,
cmdclass=cmdclass,
)