7
7
'CC0-1.0' , 'MPL-2.0' , 'EPL-2.0' , 'AGPL-3.0' , 'MIT-0' , 'ISC' , 'Unlicense'
8
8
]
9
9
10
+ # Define available classifiers for easier reference
11
+ CLASSIFIERS = {
12
+ "Development Status" : [
13
+ "1 - Planning" , "2 - Pre-Alpha" , "3 - Alpha" , "4 - Beta" , "5 - Production/Stable"
14
+ ],
15
+ "Intended Audience" : [
16
+ "Developers" , "End Users/Desktop" , "Education" , "Science/Research" , "System Administrators"
17
+ ],
18
+ "Programming Language" : [
19
+ "Python :: 3" , "Python :: 3.8" , "Python :: 3.9" , "Python :: 3.10" , "Python :: 3.11"
20
+ ],
21
+ "License" : [
22
+ "OSI Approved :: MIT License" , "OSI Approved :: Apache Software License" , "OSI Approved :: GPL License"
23
+ ],
24
+ }
25
+
10
26
@click .command ()
11
27
@click .argument ("project_name" )
12
28
def generate_setup (project_name ):
13
-
14
29
"""
15
30
Generate a complete setup.py file for a new Python project, asking the user for all details dynamically.
16
31
"""
@@ -49,17 +64,27 @@ def generate_setup(project_name):
49
64
documentation_url = click .prompt ("Documentation URL" , type = str )
50
65
51
66
# Asking for classifiers (optional but recommended)
52
- classifiers = click .prompt (
53
- "Comma-separated list of classifiers (e.g., 'Development Status :: 5 - Production/Stable')" ,
54
- default = "" , type = str )
55
- classifiers = [cls .strip () for cls in classifiers .split ("," ) if cls .strip ()]
67
+ click .echo ("Select 'Development Status' (e.g., 1 - Planning, 5 - Production/Stable):" )
68
+ development_status = click .prompt (
69
+ "Development Status" , type = click .Choice (CLASSIFIERS ["Development Status" ]), default = "1 - Planning"
70
+ )
71
+
72
+ click .echo ("Select 'Intended Audience' (e.g., Developers, End Users/Desktop):" )
73
+ audience = click .prompt (
74
+ "Intended Audience" , type = click .Choice (CLASSIFIERS ["Intended Audience" ]), default = "Developers"
75
+ )
76
+
77
+ click .echo ("Select 'Programming Language' (e.g., Python 3.8, Python 3.9):" )
78
+ language = click .prompt (
79
+ "Programming Language" , type = click .Choice (CLASSIFIERS ["Programming Language" ]), default = "Python :: 3.8"
80
+ )
56
81
57
82
# Prepare the content for the setup.py file
58
83
setup_content = f"""
59
84
from setuptools import setup, find_packages
60
85
61
86
VERSION = "{ version } " # Version of your package
62
- DESCRIPTION = '{ description } '
87
+ DESCRIPTION = '{ description } ' # Short description
63
88
64
89
# Long description of the project (can be pulled from README.md)
65
90
LONG_DESCRIPTION = '''{ long_description } '''
@@ -75,12 +100,12 @@ def generate_setup(project_name):
75
100
url="{ project_url } ", # URL to the project's GitHub page
76
101
packages=find_packages(), # Automatically find all packages in the directory
77
102
classifiers=[ # List of classifiers to categorize your package
78
- "Development Status :: 1 - Planning ",
79
- "Intended Audience :: Developers ",
80
- "Programming Language :: Python :: { python_version } ",
103
+ "Development Status :: { development_status } ",
104
+ "Intended Audience :: { audience } ",
105
+ "Programming Language :: { language } ",
81
106
"License :: OSI Approved :: { license_type } ",
82
107
"Operating System :: OS Independent",
83
- ] + [ { ', ' . join ([ f'" { cls } "' for cls in classifiers ]) } ] ,
108
+ ],
84
109
python_requires=">={ python_version } ", # Minimum Python version required
85
110
install_requires={ dependencies } , # List of dependencies
86
111
setup_requires=["pytest-runner"], # For running tests during installation
@@ -104,6 +129,5 @@ def generate_setup(project_name):
104
129
105
130
print (f"setup.py has been successfully generated for project '{ project_name } '." )
106
131
107
-
108
132
if __name__ == "__main__" :
109
133
generate_setup ()
0 commit comments