1
1
#!/usr/bin/env python
2
2
3
3
import os
4
+ import re
4
5
from glob import glob
5
6
from os .path import basename , splitext
6
7
7
8
from setuptools import find_packages , setup # type: ignore
8
9
9
- # Package meta-data
10
+ # Package Metadata
10
11
NAME = "lazydocs"
11
12
MAIN_PACKAGE = "lazydocs" # Change if main package != NAME
12
13
DESCRIPTION = "Generate markdown API documentation for Google-style Python docstring."
17
18
REQUIRES_PYTHON = ">=3.6"
18
19
VERSION = None # Only set version if you like to overwrite the version in _about.py
19
20
20
- # Please define the requirements within the requirements.txt
21
-
22
- # The rest you shouldn't have to touch too much :)
23
- # ------------------------------------------------
24
- # Except maybe the trove classifiers!
25
-
26
21
PWD = os .path .abspath (os .path .dirname (__file__ ))
27
22
28
-
29
- def load_requirements (path_dir = PWD , file_name = "requirements.txt" , comment_char = "#" ):
30
- """Read requirements file and return packages and git repos separately."""
31
- requirements = []
32
- dependency_links = []
33
- with open (os .path .join (path_dir , file_name ), "r" , encoding = "utf-8" ) as file :
34
- lines = [ln .strip () for ln in file .readlines ()]
35
- for ln in lines :
36
- if not ln :
37
- continue
38
- if comment_char in ln :
39
- ln = ln [: ln .index (comment_char )].strip ()
40
- if ln .startswith ("git+" ):
41
- dependency_links .append (ln .replace ("git+" , "" ))
42
- else :
43
- requirements .append (ln )
44
- return requirements , dependency_links
45
-
46
-
47
- # Read the requirements.txt and use it for the setup.py requirements
48
- requirements , dependency_links = load_requirements ()
49
- if dependency_links :
50
- print (
51
- "Cannot install some dependencies. "
52
- "Dependency links are currently not supported: " + str (dependency_links )
53
- )
54
-
55
23
# Import the README and use it as the long-description.
56
24
with open (os .path .join (PWD , "README.md" ), encoding = "utf-8" ) as f :
57
25
long_description = f .read ()
58
26
59
- # Load the package's _about.py module as a dictionary.
60
- about = {} # type: dict
27
+ # Extract the version from the _about.py module.
61
28
if not VERSION :
62
- with open (os .path .join (PWD , os .path .join ("src" , MAIN_PACKAGE ), "_about.py" )) as f : # type: ignore
63
- # todo: extract version via regex? re.findall("__version__ = '([\d.\w]+)'", f.read())[0]
64
- exec (f .read (), about )
65
- VERSION = about ["__version__" ]
29
+ with open (os .path .join (PWD , "src" , MAIN_PACKAGE , "_about.py" )) as f : # type: ignore
30
+ VERSION = re .findall (r"__version__\s*=\s*\"(.+)\"" , f .read ())[0 ]
66
31
67
32
# Where the magic happens:
68
33
setup (
@@ -80,7 +45,8 @@ def load_requirements(path_dir=PWD, file_name="requirements.txt", comment_char="
80
45
package_dir = {"" : "src" },
81
46
py_modules = [splitext (basename (path ))[0 ] for path in glob ("src/*.py" )],
82
47
zip_safe = False ,
83
- install_requires = requirements ,
48
+ install_requires = ["typer" ],
49
+ # deprecated: dependency_links=dependency_links,
84
50
extras_require = {
85
51
# extras can be installed via: pip install package[dev]
86
52
"dev" : [
@@ -105,21 +71,21 @@ def load_requirements(path_dir=PWD, file_name="requirements.txt", comment_char="
105
71
# If there are data files included in your packages that need to be
106
72
# 'sample': ['package_data.dat'],
107
73
},
108
- # deprecated: dependency_links=dependency_links,
109
74
classifiers = [
110
- # TODO: Update via https://pypi.python.org/pypi?%3Aaction=list_classifiers
111
75
"Development Status :: 4 - Beta" ,
112
76
"Intended Audience :: Developers" ,
113
77
"Intended Audience :: Science/Research" ,
114
78
"License :: OSI Approved :: MIT License" ,
115
79
"Natural Language :: English" ,
116
80
"Operating System :: OS Independent" ,
81
+ "Programming Language :: Python :: 3 :: Only" ,
117
82
"Programming Language :: Python :: 3" ,
118
83
"Programming Language :: Python :: 3.6" ,
119
84
"Programming Language :: Python :: 3.7" ,
120
85
"Programming Language :: Python :: 3.8" ,
121
86
"Programming Language :: Python :: 3.9" ,
122
- "Programming Language :: Python :: 3 :: Only" ,
87
+ "Programming Language :: Python :: Implementation :: PyPy" ,
88
+ "Programming Language :: Python :: Implementation :: CPython" ,
123
89
"Topic :: Software Development :: Libraries" ,
124
90
"Topic :: Software Development :: Libraries :: Python Modules" ,
125
91
],
@@ -129,9 +95,7 @@ def load_requirements(path_dir=PWD, file_name="requirements.txt", comment_char="
129
95
"Documentation" : URL + "#documentation" ,
130
96
"Source" : URL ,
131
97
},
132
- entry_points = {
133
- "console_scripts" : [f"{ NAME } ={ MAIN_PACKAGE } ._cli:app" ],
134
- },
98
+ entry_points = {"console_scripts" : [f"{ NAME } ={ MAIN_PACKAGE } ._cli:app" ]},
135
99
keywords = [
136
100
# eg: 'keyword1', 'keyword2', 'keyword3',
137
101
],
0 commit comments