1
1
from setuptools import setup , find_packages
2
+ from fetch_and_bump_version import get_incremented_version
3
+ import os
2
4
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 ---------------------- #
12
6
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 ---------------------- #
19
31
20
32
setup (
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" ),
29
39
long_description_content_type = "text/markdown" ,
30
- url = "https://github.com/codeperfectplus/extliner" ,
40
+ url = GITHUB_URL ,
31
41
packages = find_packages (),
32
42
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 ,
35
45
classifiers = [
36
46
"Development Status :: 5 - Production/Stable" ,
37
47
"Programming Language :: Python :: 3" ,
38
48
"Operating System :: OS Independent" ,
39
- "Intended Audience :: Developers"
49
+ "Intended Audience :: Developers" ,
50
+ "License :: OSI Approved :: MIT License"
40
51
],
41
52
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",
45
56
},
46
57
entry_points = {
47
58
"console_scripts" : [
48
- "extliner=extliner .cli:main" , # Update path if needed
59
+ f" { PACKAGE_NAME } = { PACKAGE_NAME } .cli:main" ,
49
60
],
50
61
},
51
62
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" ,
60
65
],
61
66
license = "MIT" ,
62
- )
67
+ )
0 commit comments