-
Notifications
You must be signed in to change notification settings - Fork 13
/
setup.py
64 lines (55 loc) · 2.01 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
import re
from pathlib import Path
from typing import List
from setuptools import setup
def get_version(package: str) -> str:
"""
Extract package version, located in the `src/package/__version__.py`.
"""
version = Path("src", package, "__version__.py").read_text()
pattern = r"__version__ = ['\"]([^'\"]+)['\"]"
return re.match(pattern, version).group(1) # type: ignore
def get_requirements(req_file: str) -> List[str]:
"""
Extract requirements from provided file.
"""
req_path = Path(req_file)
requirements = req_path.read_text().split("\n") if req_path.exists() else []
return requirements
def get_long_description(readme_file: str) -> str:
"""
Extract README from provided file.
"""
readme_path = Path(readme_file)
long_description = (
readme_path.read_text(encoding="utf-8") if readme_path.exists() else ""
)
return long_description
setup(
name="bitcoinrpc",
python_requires=">=3.7",
version=get_version("bitcoinrpc"),
description="Lightweight Bitcoin JSON-RPC Python asynchronous client",
long_description=get_long_description("README.md"),
long_description_content_type="text/markdown",
keywords="bitcoin async json-rpc",
license="MIT",
classifiers=[
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Programming Language :: Python",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3 :: Only",
"Topic :: Software Development :: Libraries :: Python Modules",
],
url="https://github.com/bibajz/bitcoin-python-async-rpc",
author="Libor Martinek",
author_email="[email protected]",
package_dir={"": "src"},
packages=["bitcoinrpc"],
install_requires=get_requirements("requirements.txt"),
)