-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
55 lines (44 loc) · 1.49 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
from typing import List
from setuptools import find_packages, setup
try:
with open("README.md", "r", encoding="utf-8") as long_desc_file:
long_description = long_desc_file.read()
except FileNotFoundError as e:
print(f"File not found: README.md")
raise e
HYPHEN_E_DOT = "-e ."
SRC_REPO = "project-name"
__version__ = "0.0.0"
AUTHOR_USER_NAME = "author_name"
AUTHOR_EMAIL = "author_email"
REPO_NAME = "repo_name"
def get_requirements(file_path: str) -> List[str]:
"""
This function will return the list of requirements.
"""
try:
with open(file_path) as req_file:
requirements = req_file.readlines()
requirements = [req.replace("\n", "") for req in requirements]
if HYPHEN_E_DOT in requirements:
requirements.remove(HYPHEN_E_DOT)
return requirements
except FileNotFoundError as error:
print(f"File not found: {file_path}")
raise error
setup(
name=SRC_REPO,
version=__version__,
author=AUTHOR_USER_NAME,
author_email=AUTHOR_EMAIL,
description="A brief description of the project",
long_description=long_description,
long_description_content="text/markdown",
url=f"https://github.com/{AUTHOR_USER_NAME}/{REPO_NAME}",
project_urls={
"Bug Tracker": f"https://github.com/{AUTHOR_USER_NAME}/{REPO_NAME}/issues",
},
package_dir={"": "src"},
packages=find_packages(where="src"),
install_requires=get_requirements(file_path="requirements.txt"),
)