-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
101 lines (85 loc) · 3.17 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
import re
from pathlib import Path
from setuptools import find_packages, setup
########################################################################################
NAME = "range_streams"
PROJECT_URLS = {
"Documentation": "https://range-streams.readthedocs.io/",
"Bug Tracker": "https://github.com/lmmx/range-streams/issues",
"Source Code": "https://github.com/lmmx/range-streams",
}
CLASSIFIERS = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Natural Language :: English",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Topic :: Internet :: WWW/HTTP",
]
INSTALL_REQUIRES = Path("requirements.txt").read_text().splitlines()
EXTRAS_REQUIRE = {
"docs": [
# "sphinx>=3,<4", # required for myst-parser and myst-nb
"sphinx>=4", # required for property :attr: role
"sphinx_rtd_theme",
"sphinx-autodoc-typehints", # don't pin to 1.11.1
# "jupyter-sphinx>=0.3.2",
# "myst-nb",
# "myst-parser"
],
"tests": ["coverage[toml]>=5.5", "pytest"],
}
EXTRAS_REQUIRE["dev"] = (
EXTRAS_REQUIRE["tests"] + EXTRAS_REQUIRE["docs"] + ["pre-commit"]
)
PYTHON_REQUIRES = ">=3.8"
LONG_DESCRIPTION = Path("README.md").read_text()
PACKAGE_DATA = {"range_streams": ["py.typed"]}
########################################################################################
def local_scheme(version):
return ""
def version_scheme(version):
return version.tag.base_version
########################################################################################
META_PATH = Path(__file__).parent.absolute() / "src" / NAME / "__init__.py"
META_FILE = META_PATH.read_text()
def find_meta(meta):
"Extract __*meta*__ from META_FILE."
meta_match = re.search(rf"^__{meta}__ = ['\"]([^'\"]*)['\"]", META_FILE, re.M)
if meta_match:
return meta_match.group(1)
raise RuntimeError("Unable to find __{meta}__ string.".format(meta=meta))
if __name__ == "__main__":
setup(
name=NAME,
description=find_meta("description"),
license=find_meta("license"),
url=find_meta("url"),
project_urls=PROJECT_URLS,
author=find_meta("author"),
author_email=find_meta("email"),
maintainer=find_meta("author"),
maintainer_email=find_meta("email"),
long_description=LONG_DESCRIPTION,
long_description_content_type="text/markdown",
packages=find_packages("src"),
package_dir={"": "src"},
package_data=PACKAGE_DATA,
include_package_data=True,
zip_safe=False,
classifiers=CLASSIFIERS,
use_scm_version={
"write_to": "version.py",
"version_scheme": version_scheme,
"local_scheme": local_scheme,
},
setup_requires=["setuptools_scm"],
install_requires=INSTALL_REQUIRES,
extras_require=EXTRAS_REQUIRE,
python_requires=PYTHON_REQUIRES,
)