77 'CC0-1.0' , 'MPL-2.0' , 'EPL-2.0' , 'AGPL-3.0' , 'MIT-0' , 'ISC' , 'Unlicense'
88]
99
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+
1026@click .command ()
1127@click .argument ("project_name" )
1228def generate_setup (project_name ):
13-
1429 """
1530 Generate a complete setup.py file for a new Python project, asking the user for all details dynamically.
1631 """
@@ -49,17 +64,27 @@ def generate_setup(project_name):
4964 documentation_url = click .prompt ("Documentation URL" , type = str )
5065
5166 # 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+ )
5681
5782 # Prepare the content for the setup.py file
5883 setup_content = f"""
5984from setuptools import setup, find_packages
6085
6186VERSION = "{ version } " # Version of your package
62- DESCRIPTION = '{ description } '
87+ DESCRIPTION = '{ description } ' # Short description
6388
6489# Long description of the project (can be pulled from README.md)
6590LONG_DESCRIPTION = '''{ long_description } '''
@@ -75,12 +100,12 @@ def generate_setup(project_name):
75100 url="{ project_url } ", # URL to the project's GitHub page
76101 packages=find_packages(), # Automatically find all packages in the directory
77102 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 } ",
81106 "License :: OSI Approved :: { license_type } ",
82107 "Operating System :: OS Independent",
83- ] + [ { ', ' . join ([ f'" { cls } "' for cls in classifiers ]) } ] ,
108+ ],
84109 python_requires=">={ python_version } ", # Minimum Python version required
85110 install_requires={ dependencies } , # List of dependencies
86111 setup_requires=["pytest-runner"], # For running tests during installation
@@ -104,6 +129,5 @@ def generate_setup(project_name):
104129
105130 print (f"setup.py has been successfully generated for project '{ project_name } '." )
106131
107-
108132if __name__ == "__main__" :
109133 generate_setup ()
0 commit comments