-
-
Notifications
You must be signed in to change notification settings - Fork 383
/
setup.py
157 lines (141 loc) · 4.82 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
import re
import sys
from io import open
try:
from setuptools import find_packages, setup
except ImportError:
print(
"""
Error: pyinfra needs setuptools in order to install:
using pip: pip install setuptools
using a package manager (apt, yum, etc), normally named: python-setuptools
""".strip(),
)
sys.exit(1)
INSTALL_REQUIRES = (
"gevent>=1.5",
"paramiko>=2.7,<4", # 2.7 (2019) adds OpenSSH key format + Match SSH config
"click>2",
"jinja2>2,<4",
"python-dateutil>2,<3",
"setuptools",
"configparser",
"pywinrm",
"typeguard",
"distro>=1.6,<2",
"packaging>=16.1",
# Backport of graphlib used for DAG operation ordering
'graphlib_backport ; python_version < "3.9"',
# Backport of typing for Unpack (added 3.11)
'typing-extensions ; python_version < "3.11"',
# Backport of importlib.metadata for entry_points(group=...) (added 3.10)
'importlib_metadata>=3.6 ; python_version < "3.10"',
)
TEST_REQUIRES = (
# Unit testing
"pytest==8.2.1",
"coverage==7.5.1",
"pytest-cov==5.0.0",
# Formatting & linting
"black==24.4.2",
"isort==5.13.2",
"flake8==7.0.0",
"flake8-black==0.3.6",
"flake8-isort==6.1.1",
# Typing
"mypy",
"types-cryptography",
"types-paramiko",
"types-python-dateutil",
"types-PyYAML",
"types-setuptools",
)
DOCS_REQUIRES = (
"pyinfra-guzzle_sphinx_theme==0.16",
"myst-parser==2.0.0",
"sphinx==6.2.1",
)
DEV_REQUIRES = (
TEST_REQUIRES
+ DOCS_REQUIRES
+ (
# Releasing
"wheel",
"twine",
# Dev debugging
"ipython",
"ipdb",
"ipdbplugin",
# Lint spellchecking, dev only (don't fail CI)
"flake8-spellcheck==0.12.1",
"redbaron", # for generating type stubs
)
)
def get_version_from_changelog():
# Regex matching pattern followed by 3 numerical values separated by '.'
pattern = re.compile(r"^# v(?P<version>[0-9]+\.[0-9]+(\.[0-9]+)?(\.?[a-z0-9]+)?)$")
with open("CHANGELOG.md", "r", encoding="utf-8") as fn:
for line in fn.readlines():
match = pattern.match(line.strip())
if match:
return "".join(match.group("version"))
raise RuntimeError("No version found in CHANGELOG.md")
def get_readme_contents():
with open("README.md", "r", encoding="utf-8") as f:
return f.read()
if __name__ == "__main__":
setup(
version=get_version_from_changelog(),
name="pyinfra",
description="pyinfra automates/provisions/manages/deploys infrastructure.",
long_description=get_readme_contents(),
long_description_content_type="text/markdown",
author="Nick / Fizzadar",
author_email="[email protected]",
license="MIT",
url="https://pyinfra.com",
project_urls={
"Documentation": "https://docs.pyinfra.com",
"GitHub": "https://github.com/Fizzadar/pyinfra",
},
packages=find_packages(exclude=["tests", "docs"]),
entry_points={
"console_scripts": ("pyinfra=pyinfra_cli.__main__:execute_pyinfra",),
"pyinfra.connectors": [
"chroot = pyinfra.connectors.chroot:ChrootConnector",
"docker = pyinfra.connectors.docker:DockerConnector",
"local = pyinfra.connectors.local:LocalConnector",
"ssh = pyinfra.connectors.ssh:SSHConnector",
"dockerssh = pyinfra.connectors.dockerssh:DockerSSHConnector",
# Inventory only connectors
"terraform = pyinfra.connectors.terraform:TerraformInventoryConnector",
"vagrant = pyinfra.connectors.vagrant:VagrantInventoryConnector",
],
},
python_requires=">=3.8",
install_requires=INSTALL_REQUIRES,
extras_require={
"test": TEST_REQUIRES,
"docs": DOCS_REQUIRES,
"dev": DEV_REQUIRES,
},
include_package_data=True,
classifiers=[
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Intended Audience :: Developers",
"Intended Audience :: System Administrators",
"Intended Audience :: Information Technology",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: System :: Systems Administration",
"Topic :: System :: Installation/Setup",
"Topic :: Utilities",
],
)