-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
45 lines (30 loc) · 1.01 KB
/
setup.py
File metadata and controls
45 lines (30 loc) · 1.01 KB
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
"""The setup code for the library."""
import pathlib
from setuptools import setup
CWD = pathlib.Path(__file__).absolute().parent
def get_version() -> str:
"""Pulls the version from the __init__ file in the library.
Raises:
RuntimeError: Raises when no __version__ was found.
Returns:
str: The current version of the library.
"""
path = CWD / "experiment_lab" / "__init__.py"
content = path.read_text()
for line in content.splitlines():
if line.startswith("__version__"):
return line.strip().split()[-1].strip().strip('"')
raise RuntimeError("bad version data in __init__.py")
def get_long_description() -> str:
"""Reads the long description from the README.md file.
Returns:
str: The long description.
"""
with open("README.md") as fh:
long_description = "".join(fh.readlines())
return long_description
setup(
name="experiment_lab",
version=get_version(),
long_description=get_long_description(),
)