Skip to content

Commit ba65dcf

Browse files
committed
Update new build and setup scripts
1 parent a5de9dc commit ba65dcf

File tree

3 files changed

+11
-58
lines changed

3 files changed

+11
-58
lines changed

MANIFEST.in

Lines changed: 0 additions & 10 deletions
This file was deleted.

requirements.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

setup.py

Lines changed: 11 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
#!/usr/bin/env python
22

33
import os
4+
import re
45
from glob import glob
56
from os.path import basename, splitext
67

78
from setuptools import find_packages, setup # type: ignore
89

9-
# Package meta-data
10+
# Package Metadata
1011
NAME = "lazydocs"
1112
MAIN_PACKAGE = "lazydocs" # Change if main package != NAME
1213
DESCRIPTION = "Generate markdown API documentation for Google-style Python docstring."
@@ -17,52 +18,16 @@
1718
REQUIRES_PYTHON = ">=3.6"
1819
VERSION = None # Only set version if you like to overwrite the version in _about.py
1920

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-
2621
PWD = os.path.abspath(os.path.dirname(__file__))
2722

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-
5523
# Import the README and use it as the long-description.
5624
with open(os.path.join(PWD, "README.md"), encoding="utf-8") as f:
5725
long_description = f.read()
5826

59-
# Load the package's _about.py module as a dictionary.
60-
about = {} # type: dict
27+
# Extract the version from the _about.py module.
6128
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]
6631

6732
# Where the magic happens:
6833
setup(
@@ -80,7 +45,8 @@ def load_requirements(path_dir=PWD, file_name="requirements.txt", comment_char="
8045
package_dir={"": "src"},
8146
py_modules=[splitext(basename(path))[0] for path in glob("src/*.py")],
8247
zip_safe=False,
83-
install_requires=requirements,
48+
install_requires=["typer"],
49+
# deprecated: dependency_links=dependency_links,
8450
extras_require={
8551
# extras can be installed via: pip install package[dev]
8652
"dev": [
@@ -105,21 +71,21 @@ def load_requirements(path_dir=PWD, file_name="requirements.txt", comment_char="
10571
# If there are data files included in your packages that need to be
10672
# 'sample': ['package_data.dat'],
10773
},
108-
# deprecated: dependency_links=dependency_links,
10974
classifiers=[
110-
# TODO: Update via https://pypi.python.org/pypi?%3Aaction=list_classifiers
11175
"Development Status :: 4 - Beta",
11276
"Intended Audience :: Developers",
11377
"Intended Audience :: Science/Research",
11478
"License :: OSI Approved :: MIT License",
11579
"Natural Language :: English",
11680
"Operating System :: OS Independent",
81+
"Programming Language :: Python :: 3 :: Only",
11782
"Programming Language :: Python :: 3",
11883
"Programming Language :: Python :: 3.6",
11984
"Programming Language :: Python :: 3.7",
12085
"Programming Language :: Python :: 3.8",
12186
"Programming Language :: Python :: 3.9",
122-
"Programming Language :: Python :: 3 :: Only",
87+
"Programming Language :: Python :: Implementation :: PyPy",
88+
"Programming Language :: Python :: Implementation :: CPython",
12389
"Topic :: Software Development :: Libraries",
12490
"Topic :: Software Development :: Libraries :: Python Modules",
12591
],
@@ -129,9 +95,7 @@ def load_requirements(path_dir=PWD, file_name="requirements.txt", comment_char="
12995
"Documentation": URL + "#documentation",
13096
"Source": URL,
13197
},
132-
entry_points={
133-
"console_scripts": [f"{NAME}={MAIN_PACKAGE}._cli:app"],
134-
},
98+
entry_points={"console_scripts": [f"{NAME}={MAIN_PACKAGE}._cli:app"]},
13599
keywords=[
136100
# eg: 'keyword1', 'keyword2', 'keyword3',
137101
],

0 commit comments

Comments
 (0)