11from setuptools import setup , find_packages
2+ from fetch_and_bump_version import get_incremented_version
3+ import os
24
3- # Read the long description from README.md
4- try :
5- with open ("README.md" , "r" , encoding = "utf-8" ) as fh :
6- long_description = fh .read ()
7- except FileNotFoundError :
8- long_description = (
9- "A simple command-line tool to count lines in files by extension. "
10- "See the documentation for more details."
11- )
5+ # ---------------------- Package Metadata ---------------------- #
126
13- # Read the list of requirements from requirements.txt
14- try :
15- with open ("requirements.txt" , "r" , encoding = "utf-8" ) as fh :
16- requirements = fh .read ().splitlines ()
17- except FileNotFoundError :
18- requirements = ["tabulate==0.9.0" ]
7+ PACKAGE_NAME = "extliner"
8+ AUTHOR = "Deepak Raj"
9+ AUTHOR_EMAIL = "[email protected] " 10+ DESCRIPTION = "A simple command-line tool to count lines in files by extension."
11+ PYTHON_REQUIRES = ">=3.6"
12+ GITHUB_USER = "codeperfectplus"
13+ GITHUB_URL = f"https://github.com/{ GITHUB_USER } /{ PACKAGE_NAME } "
14+ DOCS_URL = f"https://{ PACKAGE_NAME } .readthedocs.io/en/latest/"
15+
16+ # ---------------------- Utility Functions ---------------------- #
17+
18+ def load_file_content (file_path ):
19+ """Read and return the contents of a file if it exists."""
20+ if os .path .exists (file_path ):
21+ with open (file_path , encoding = "utf-8" ) as f :
22+ return f .read ().strip ()
23+ return ""
24+
25+ def load_requirements (file_path ):
26+ """Parse requirements from a file."""
27+ content = load_file_content (file_path )
28+ return content .splitlines () if content else []
29+
30+ # ---------------------- Setup Execution ---------------------- #
1931
2032setup (
21- name = "extliner" ,
22- version = "0.0.1" ,
23- author = "Deepak Raj" ,
24- 25- description = (
26- "A simple command-line tool to count lines in files by extension, "
27- ),
28- long_description = long_description ,
33+ name = PACKAGE_NAME ,
34+ version = get_incremented_version (PACKAGE_NAME ),
35+ author = AUTHOR ,
36+ author_email = AUTHOR_EMAIL ,
37+ description = DESCRIPTION ,
38+ long_description = load_file_content ("README.md" ),
2939 long_description_content_type = "text/markdown" ,
30- url = "https://github.com/codeperfectplus/extliner" ,
40+ url = GITHUB_URL ,
3141 packages = find_packages (),
3242 include_package_data = True ,
33- install_requires = requirements ,
34- python_requires = ">=3.6" ,
43+ install_requires = load_requirements ( " requirements.txt" ) ,
44+ python_requires = PYTHON_REQUIRES ,
3545 classifiers = [
3646 "Development Status :: 5 - Production/Stable" ,
3747 "Programming Language :: Python :: 3" ,
3848 "Operating System :: OS Independent" ,
39- "Intended Audience :: Developers"
49+ "Intended Audience :: Developers" ,
50+ "License :: OSI Approved :: MIT License"
4051 ],
4152 project_urls = {
42- "Documentation" : "https://extliner.readthedocs.io/en/latest/" ,
43- "Source" : "https://github.com/codeperfectplus/extliner" ,
44- "Tracker" : "https://github.com/codeperfectplus/extliner/ issues"
53+ "Documentation" : DOCS_URL ,
54+ "Source" : GITHUB_URL ,
55+ "Tracker" : f" { GITHUB_URL } / issues",
4556 },
4657 entry_points = {
4758 "console_scripts" : [
48- "extliner=extliner .cli:main" , # Update path if needed
59+ f" { PACKAGE_NAME } = { PACKAGE_NAME } .cli:main" ,
4960 ],
5061 },
5162 keywords = [
52- "line count" ,
53- "file analysis" ,
54- "command line tool" ,
55- "file extension" ,
56- "python" ,
57- "CLI" ,
58- "file processing" ,
59-
63+ "line count" , "file analysis" , "command line tool" ,
64+ "file extension" , "python" , "CLI" , "file processing" ,
6065 ],
6166 license = "MIT" ,
62- )
67+ )
0 commit comments