-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
109 lines (87 loc) · 3.05 KB
/
setup.py
File metadata and controls
109 lines (87 loc) · 3.05 KB
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
# -*- coding: utf-8 -*-
"""Package func-analysis."""
import re
import sys
from pathlib import Path
from setuptools import setup
from setuptools.command.test import test
PROJECT_ROOT = Path(__file__).parent
class PyTest(test):
"""Class to execute pytest as test suite without.
To run tests, just type ``python3 setup.py test``.
"""
def finalize_options(self):
"""Finalize pytest options."""
test.finalize_options(self)
self.test_args: list = []
# defining attributes outside init is okay in
# test.finalize_options().
# pylint: disable = attribute-defined-outside-init
self.test_suite = True
# pylint: enable = attribute-defined-outside-init
def run_tests(self):
"""Run pytest and exit with its exit code."""
import pytest
errno = pytest.main(self.test_args)
sys.exit(errno)
def get_long_description() -> str:
"""Read README.rst.
Returns
-------
long_description : str
The text of README.rst.
"""
with PROJECT_ROOT.joinpath("README.rst").open() as file_contents:
return file_contents.read()
def get_version() -> str:
"""Determine correct version.
Returns
-------
version : str
The version found in ``func_analysis/__init__.py``.
Raises
------
RuntimeError
If the string "__version__" cannot be found in the file
``func_analysis/__init__.py``.
"""
version_path = PROJECT_ROOT.joinpath("func_analysis", "__init__.py")
with version_path.open() as file_contents:
version_file = file_contents.read()
version_match = re.search(
r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M
)
if version_match:
return version_match.group(1)
raise RuntimeError("Unable to find version string.")
setup(
name="func-analysis",
version=get_version(),
author="Rohan Kumar",
author_email="seirdy@pm.ch",
description="Analyze function behavior using introductory calculus.",
long_description=get_long_description(),
long_description_content_type="text/x-rst",
url="https://gitlab.com/Seirdy/func-analysis",
packages=["func_analysis", "func_analysis.analyzed_func"],
classifiers=[
"License :: OSI Approved :: GNU Affero General Public License "
+ "v3 or later (AGPLv3+)",
"Operating System :: OS Independent",
"Development Status :: 2 - Pre-Alpha",
"Programming Language :: Python",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Scientific/Engineering :: Mathematics",
"Natural Language :: English",
"Intended Audience :: Developers",
"Intended Audience :: Education",
],
license="AGPLv3+",
keywords=["func-analysis", "calculus", "math"],
zip_safe=False,
install_requires=["mpmath", "numpy", "scipy"],
tests_require=["pytest>=4.0.1", "pytest-cov"],
cmdclass={"pytest": PyTest},
)