-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
105 lines (92 loc) · 3.63 KB
/
setup.py
File metadata and controls
105 lines (92 loc) · 3.63 KB
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
"""
Setup configuration for PyPI Package Updater.
Reads dependencies from requirem entry_points={
"console_scripts": [
"pypi-update=update_packages:cli_main",
],
},files to maintain single source of truth.
"""
from setuptools import setup, find_packages
from pathlib import Path
def read_requirements(filename):
"""Read requirements from a file, filtering out comments and -r includes."""
requirements_file = Path(__file__).parent / "requirements" / filename
if not requirements_file.exists():
return []
requirements = []
with open(requirements_file, 'r') as f:
for line in f:
line = line.strip()
# Skip comments, empty lines, and -r includes
if line and not line.startswith('#') and not line.startswith('-r'):
# Remove inline comments
if '#' in line:
line = line.split('#')[0].strip()
if line:
requirements.append(line)
return requirements
def read_dev_requirements():
"""Read all development requirements from dev.in and related files."""
dev_requirements = []
# Read test requirements
dev_requirements.extend(read_requirements("test.in"))
# Read dev-specific requirements (excluding test.in include)
dev_file = Path(__file__).parent / "requirements" / "dev.in"
if dev_file.exists():
with open(dev_file, 'r') as f:
for line in f:
line = line.strip()
# Skip -r includes, comments, and empty lines
if (line and
not line.startswith('#') and
not line.startswith('-r')):
# Remove inline comments
if '#' in line:
line = line.split('#')[0].strip()
if line:
dev_requirements.append(line)
return dev_requirements
# Read the README file
readme_file = Path(__file__).parent / "README.md"
long_description = readme_file.read_text(encoding="utf-8") if readme_file.exists() else ""
# Read version from pypi_updater/__init__.py
setup(
name="pypi-package-updater", # Available PyPI name suggestion
description="A tool to update Python package dependencies across multiple file formats",
long_description=long_description,
long_description_content_type="text/markdown",
author="Adam Birds",
author_email="adam.birds@adbwebdesigns.co.uk",
url="https://github.com/adambirds/pypi-package-updater",
project_urls={
"Repository": "https://github.com/adambirds/pypi-package-updater",
"Issues": "https://github.com/adambirds/pypi-package-updater/issues",
},
packages=find_packages(),
py_modules=["update_packages"],
include_package_data=True,
python_requires=">=3.11",
setup_requires=["setuptools_scm"],
install_requires=read_requirements("common.in"),
extras_require={
"dev": read_dev_requirements(),
},
entry_points={
"console_scripts": [
"pypi-update=update_packages:cli_main",
],
},
classifiers=[
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: System :: Software Distribution",
],
license="MIT",
)