Skip to content

Commit f10f8b2

Browse files
committed
Completely migrated setuptools to use pyproject.toml
1 parent 4782745 commit f10f8b2

File tree

4 files changed

+4
-78
lines changed

4 files changed

+4
-78
lines changed

MANIFEST.in

-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
include AUTHORS.md
21
include CODE_OF_CONDUCT.md
32
include CHANGELOG.md
43
include CONTRIBUTING.md
54
include LICENSE
65
include README.md
7-
include requirements/*.txt
8-
include requirements/*.in
9-
include requirements.txt
106

117
graft tests
128
prune __pycache__

pyproject.toml

+3
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ test = [
7777
[tool.setuptools.dynamic]
7878
version = {attr = "bumpversion.__version__"}
7979

80+
[tool.setuptools.packages.find]
81+
exclude = ["example*", "tests*", "docs*", "build"]
82+
8083
[tool.coverage.run]
8184
branch = true
8285
omit = ["**/test_*.py", "**/__main__.py", "**/aliases.py"]

setup.cfg

-12
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,3 @@
1-
[options]
2-
zip_safe = False
3-
include_package_data = True
4-
packages = find:
5-
6-
[options.packages.find]
7-
exclude =
8-
example*
9-
tests*
10-
docs*
11-
build
12-
131
[darglint]
142
ignore = DAR402
153

setup.py

+1-62
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,4 @@
11
"""The setup script."""
2-
from pathlib import Path
3-
from typing import List, Optional
4-
52
from setuptools import setup
63

7-
8-
def parse_reqs_in(filepath: Path, visited: Optional[set] = None) -> List[str]: # noqa: C901
9-
"""
10-
Parse a file path containing a pip-tools requirements.in and return a list of requirements.
11-
12-
Will properly follow ``-r`` and ``-c`` links like ``pip-tools``. This
13-
means layered requirements will be returned as one list.
14-
15-
Other ``pip-tools`` and ``pip``-specific lines are excluded.
16-
17-
Args:
18-
filepath (Path): The path to the requirements file
19-
visited (set, optional): A set of paths that have already been visited.
20-
21-
Returns:
22-
All the requirements as a list.
23-
"""
24-
if visited is None:
25-
visited = set()
26-
reqstr: str = filepath.read_text()
27-
reqs: List[str] = []
28-
for line in reqstr.splitlines(keepends=False):
29-
line = line.strip() # noqa: PLW2901
30-
if not line:
31-
continue
32-
elif not line or line.startswith("#"):
33-
# comments are lines that start with # only
34-
continue
35-
elif line.startswith("-c"):
36-
_, new_filename = line.split()
37-
new_file_path = filepath.parent / new_filename.replace(".txt", ".in")
38-
if new_file_path not in visited:
39-
visited.add(new_file_path)
40-
reqs.extend(parse_reqs_in(new_file_path, visited))
41-
elif line.startswith(("-r", "--requirement")):
42-
_, new_filename = line.split()
43-
new_file_path = filepath.parent / new_filename
44-
if new_file_path not in visited:
45-
visited.add(new_file_path)
46-
reqs.extend(parse_reqs_in(new_file_path, visited))
47-
elif line.startswith("-f") or line.startswith("-i") or line.startswith("--"):
48-
continue
49-
elif line.startswith("-Z") or line.startswith("--always-unzip"):
50-
continue
51-
else:
52-
reqs.append(line)
53-
return reqs
54-
55-
56-
here: Path = Path(__file__).parent.absolute()
57-
requirements = parse_reqs_in(here / "requirements/prod.in")
58-
dev_requirements = parse_reqs_in(here / "requirements/dev.in")
59-
test_requirements = parse_reqs_in(here / "requirements/test.in")
60-
61-
setup(
62-
install_requires=requirements,
63-
tests_require=test_requirements,
64-
extras_require={"dev": dev_requirements, "test": test_requirements},
65-
)
4+
setup()

0 commit comments

Comments
 (0)