Skip to content

Commit 217e9ce

Browse files
committed
Maintenance: Move main build rules to the pyproject.toml
1 parent bc78cbe commit 217e9ce

File tree

7 files changed

+83
-197
lines changed

7 files changed

+83
-197
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright 2016-2020 Alexey Stepanov aka penguinolog
189+
Copyright 2016-2022 Alexey Stepanov aka penguinolog
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

MANIFEST.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include *.rst LICENSE requirements.txt
1+
include *.rst LICENSE requirements.txt classifiers.txt
22
global-include *.pyx *.pxd
33
global-exclude *.c
44
exclude Makefile
@@ -9,5 +9,5 @@ exclude .gitignore .dockerignore
99
prune test
1010
prune .github
1111
prune .azure_pipelines
12-
prune docs
12+
prune doc
1313
exclude CODEOWNERS CODE_OF_CONDUCT.md _config.yml

classifiers.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Development Status :: 5 - Production/Stable
2+
Intended Audience :: Developers
3+
Topic :: Software Development :: Libraries :: Python Modules
4+
License :: OSI Approved :: Apache Software License
5+
Programming Language :: Python :: 3
6+
rogramming Language :: Python :: 3 :: Only
7+
Programming Language :: Python :: 3.7
8+
Programming Language :: Python :: 3.8
9+
Programming Language :: Python :: 3.9
10+
Programming Language :: Python :: 3.10
11+
Programming Language :: Python :: 3.11
12+
Programming Language :: Python :: Implementation :: CPython
13+
Programming Language :: Python :: Implementation :: PyPy

pyproject.toml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,40 @@ requires = [
88
]
99
build-backend="setuptools.build_meta"
1010

11+
[project]
12+
name = "exec-helpers"
13+
description = "Execution helpers for simplified usage of subprocess and ssh."
14+
readme = "README.rst"
15+
urls={"Bug Tracker" = "https://github.com/python-useful-helpers/exec-helpers/issues", "Documentation" = "https://exec-helpers.readthedocs.io/" }
16+
requires-python = ">=3.7.0"
17+
keywords = ["subprocess", "ssh"]
18+
license = {text = "Apache License, Version 2.0"}
19+
authors=[{name="Alexey Stepanov", email="penguinolog@gmail.com"}]
20+
maintainers=[
21+
{name="Alexey Stepanov", email="penguinolog@gmail.com"},
22+
{name="Antonio Esposito", email="esposito.cloud@gmail.com"},
23+
{name="Dennis Dmitriev", email="dis-xcom@gmail.com"}
24+
]
25+
dynamic = ["version", "classifiers", "dependencies"]
26+
27+
[tool.setuptools]
28+
packages= ["exec_helpers"]
29+
package-data={"exec_helpers"=["py.typed"], "*"=["*.pyi"]}
30+
31+
[tool.setuptools.dynamic]
32+
dependencies = {file = ["requirements.txt"]}
33+
classifiers = {file = ["classifiers.txt"]}
34+
35+
[project.optional-dependencies]
36+
xml = ["defusedxml"]
37+
lxml = ["lxml>=4.6.2"]
38+
yaml = ["PyYAML>=3.12"]
39+
all_formats = ["defusedxml", "lxml>=4.6.2", "PyYAML>=3.12"]
40+
all-formats = ["defusedxml", "lxml>=4.6.2", "PyYAML>=3.12"]
41+
42+
[tool.bdist_wheel]
43+
universal = false
44+
1145
[tool.black]
1246
line-length = 120
1347
safe = true
@@ -107,3 +141,4 @@ exclude_lines = [
107141
pretty_print = true
108142

109143
[tool.setuptools_scm]
144+
write_to="exec_helpers/_version.py"

setup.cfg

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,7 @@
1-
[metadata]
2-
project_urls =
3-
Bug Tracker = https://github.com/python-useful-helpers/exec-helpers/issues
4-
Documentation = https://exec-helpers.readthedocs.io/
5-
6-
long_description = file: README.rst
7-
8-
[options]
9-
zip_safe = True
10-
packages = find:
11-
12-
[bdist_wheel]
13-
# This flag says that the code is written to work on both Python 2 and Python
14-
# 3. If at all possible, it is good practice to do this. If you cannot, you
15-
# will need to generate wheels for each Python version that you support.
16-
universal = 0
17-
18-
[easy_install]
19-
zip_ok = True
20-
211
[build_sphinx]
222
all_files = 1
233
build-dir = doc/build
244
source-dir = doc/source
255

26-
[flake8]
27-
exclude =
28-
.venv,
29-
.git,
30-
.tox,
31-
dist,
32-
doc,
33-
*lib/python*,
34-
*egg,
35-
build,
36-
__init__.py,
37-
_version.py,
38-
docs
39-
ignore =
40-
E203,
41-
# whitespace before ':'
42-
W503,
43-
# line break before binary operator
44-
D401,
45-
# First line should be in imperative mood; try rephrasing
46-
D202,
47-
# No blank lines allowed after function docstring
48-
D203,
49-
# 1 blank line required before class docstring
50-
D213
51-
# Multi-line docstring summary should start at the second line
52-
show-pep8 = True
53-
show-source = True
54-
count = True
55-
max-line-length = 120
56-
576
[aliases]
587
test = pytest

setup.py

Lines changed: 1 addition & 143 deletions
Original file line numberDiff line numberDiff line change
@@ -18,149 +18,7 @@
1818

1919
from __future__ import annotations
2020

21-
# Standard Library
22-
import ast
23-
import os.path
24-
import sys
25-
2621
# External Dependencies
2722
import setuptools
2823

29-
PACKAGE_NAME = "exec_helpers"
30-
31-
with open(os.path.join(os.path.dirname(__file__), PACKAGE_NAME, "__init__.py")) as f:
32-
SOURCE = f.read()
33-
34-
with open("requirements.txt") as f:
35-
REQUIRED = f.read().splitlines()
36-
37-
with open("README.rst") as f:
38-
LONG_DESCRIPTION = f.read()
39-
40-
41-
# noinspection PyUnresolvedReferences
42-
def get_simple_vars_from_src(
43-
src: str,
44-
) -> dict[str, str | bytes | int | float | complex | list | set | dict | tuple | None | bool | Ellipsis]:
45-
"""Get simple (string/number/boolean and None) assigned values from source.
46-
47-
:param src: Source code
48-
:type src: str
49-
:return: OrderedDict with keys, values = variable names, values
50-
:rtype: dict[str, str | bytes | int | float | complex | list | set | dict | tuple | None | bool | Ellipsis]
51-
52-
Limitations: Only defined from scratch variables.
53-
Not supported by design:
54-
* Imports
55-
* Executable code, including string formatting and comprehensions.
56-
57-
Examples:
58-
>>> string_sample = "a = '1'"
59-
>>> get_simple_vars_from_src(string_sample)
60-
{'a': '1'}
61-
62-
>>> int_sample = "b = 1"
63-
>>> get_simple_vars_from_src(int_sample)
64-
{'b': 1}
65-
66-
>>> list_sample = "c = [u'1', b'1', 1, 1.0, 1j, None]"
67-
>>> result = get_simple_vars_from_src(list_sample)
68-
>>> result == {'c': [u'1', b'1', 1, 1.0, 1j, None]}
69-
True
70-
71-
>>> iterable_sample = "d = ([1], {1: 1}, {1})"
72-
>>> get_simple_vars_from_src(iterable_sample)
73-
{'d': ([1], {1: 1}, {1})}
74-
75-
>>> multiple_assign = "e = f = g = 1"
76-
>>> get_simple_vars_from_src(multiple_assign)
77-
{'e': 1, 'f': 1, 'g': 1}
78-
"""
79-
if sys.version_info[:2] < (3, 8):
80-
ast_data = (ast.Str, ast.Num, ast.List, ast.Set, ast.Dict, ast.Tuple, ast.Bytes, ast.NameConstant, ast.Ellipsis)
81-
else:
82-
ast_data = (ast.Constant, ast.List, ast.Set, ast.Dict, ast.Tuple)
83-
84-
tree = ast.parse(src)
85-
86-
result = {}
87-
88-
for node in ast.iter_child_nodes(tree):
89-
# We parse assigns only
90-
if not isinstance(node, (ast.Assign, ast.AnnAssign)) or not isinstance(node.value, ast_data):
91-
continue
92-
try:
93-
value = ast.literal_eval(node.value)
94-
except ValueError:
95-
continue
96-
if isinstance(node, ast.Assign):
97-
for tgt in node.targets:
98-
if isinstance(tgt, ast.Name) and isinstance(tgt.ctx, ast.Store):
99-
result[tgt.id] = value
100-
else:
101-
result[node.target.id] = value
102-
return result
103-
104-
105-
VARIABLES = get_simple_vars_from_src(SOURCE)
106-
107-
CLASSIFIERS = [
108-
"Development Status :: 5 - Production/Stable",
109-
"Intended Audience :: Developers",
110-
"Topic :: Software Development :: Libraries :: Python Modules",
111-
"License :: OSI Approved :: Apache Software License",
112-
"Programming Language :: Python :: 3",
113-
"Programming Language :: Python :: 3 :: Only",
114-
"Programming Language :: Python :: 3.7",
115-
"Programming Language :: Python :: 3.8",
116-
"Programming Language :: Python :: 3.9",
117-
"Programming Language :: Python :: 3.10",
118-
"Programming Language :: Python :: 3.11",
119-
"Programming Language :: Python :: Implementation :: CPython",
120-
"Programming Language :: Python :: Implementation :: PyPy",
121-
]
122-
123-
KEYWORDS = ["logging", "debugging", "development"]
124-
125-
XML_DEPS = ["defusedxml"]
126-
LXML_DEPS = ["lxml>=4.6.2"]
127-
YAML_DEPS = ["PyYAML>=3.12"]
128-
129-
130-
setuptools.setup(
131-
name="exec-helpers",
132-
author=VARIABLES["__author__"],
133-
author_email=VARIABLES["__author_email__"],
134-
maintainer=", ".join(f"{name} <{email}>" for name, email in VARIABLES["__maintainers__"].items()),
135-
url=VARIABLES["__url__"],
136-
license=VARIABLES["__license__"],
137-
description=VARIABLES["__description__"],
138-
long_description=LONG_DESCRIPTION,
139-
long_description_content_type="text/x-rst",
140-
classifiers=CLASSIFIERS,
141-
keywords=KEYWORDS,
142-
python_requires=">=3.7.0",
143-
# While setuptools cannot deal with pre-installed incompatible versions,
144-
# setting a lower bound is not harmful - it makes error messages cleaner. DO
145-
# NOT set an upper bound on setuptools, as that will lead to uninstallable
146-
# situations as progressive releases of projects are done.
147-
# Blacklist setuptools 34.0.0-34.3.2 due to https://github.com/pypa/setuptools/issues/951
148-
# Blacklist setuptools 36.2.0 due to https://github.com/pypa/setuptools/issues/1086
149-
setup_requires=[
150-
"setuptools >= 21.0.0,!=24.0.0,"
151-
"!=34.0.0,!=34.0.1,!=34.0.2,!=34.0.3,!=34.1.0,!=34.1.1,!=34.2.0,!=34.3.0,!=34.3.1,!=34.3.2,"
152-
"!=36.2.0",
153-
"wheel",
154-
"setuptools_scm[toml]>=3.4",
155-
],
156-
use_scm_version={"write_to": f"{PACKAGE_NAME}/_version.py"},
157-
install_requires=REQUIRED,
158-
extras_require={
159-
"xml": XML_DEPS,
160-
"lxml": LXML_DEPS,
161-
"yaml": YAML_DEPS,
162-
"all_formats": XML_DEPS + LXML_DEPS + YAML_DEPS,
163-
"all-formats": XML_DEPS + LXML_DEPS + YAML_DEPS,
164-
},
165-
package_data={PACKAGE_NAME: ["py.typed"], "": ["*.pyi"]},
166-
)
24+
setuptools.setup()

tox.ini

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,34 @@ deps =
107107
isort
108108
commands =
109109
isort exec_helpers
110+
111+
[flake8]
112+
exclude =
113+
.venv,
114+
.git,
115+
.tox,
116+
dist,
117+
doc,
118+
*lib/python*,
119+
*egg,
120+
build,
121+
__init__.py,
122+
_version.py,
123+
docs
124+
ignore =
125+
E203,
126+
# whitespace before ':'
127+
W503,
128+
# line break before binary operator
129+
D401,
130+
# First line should be in imperative mood; try rephrasing
131+
D202,
132+
# No blank lines allowed after function docstring
133+
D203,
134+
# 1 blank line required before class docstring
135+
D213
136+
# Multi-line docstring summary should start at the second line
137+
show-pep8 = True
138+
show-source = True
139+
count = True
140+
max-line-length = 120

0 commit comments

Comments
 (0)