-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathsetup.py
More file actions
138 lines (115 loc) · 3.94 KB
/
setup.py
File metadata and controls
138 lines (115 loc) · 3.94 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
"""
Setup file for the PyMarkdown project.
"""
import os
import runpy
from setuptools import setup
INSTALL_REQUIREMENT_FILE = "install-requirements.txt"
PROJECT_README_FILE = "README.md"
ALTERNATE_PYPI_README_FILE = "pypi.md"
def parse_requirements():
with open(f"{INSTALL_REQUIREMENT_FILE}", "r", encoding="utf-8") as requirement_file:
lineiter = [line.strip() for line in requirement_file]
return [line for line in lineiter if line and not line.startswith("#")]
def get_semantic_version():
version_meta = runpy.run_path(f"./{MODULE_NAME}/version.py")
return version_meta["__version__"]
def get_project_name():
version_meta = runpy.run_path(f"./{MODULE_NAME}/version.py")
return version_meta["__project_name__"]
def get_description():
version_meta = runpy.run_path(f"./{MODULE_NAME}/version.py")
return version_meta["__description__"]
def load_readme_file():
source_file = (
ALTERNATE_PYPI_README_FILE
if os.path.exists(ALTERNATE_PYPI_README_FILE)
else PROJECT_README_FILE
)
with open(source_file, "r", encoding="utf-8") as readme_file:
return readme_file.read()
# Note, the below function does not always work, so we use this until we can find out why it is not working.
PACKAGE_MODULES = [
"pymarkdown",
"pymarkdown.block_quotes",
"pymarkdown.coalesce",
"pymarkdown.container_blocks",
"pymarkdown.extension_manager",
"pymarkdown.extensions",
"pymarkdown.general",
"pymarkdown.html",
"pymarkdown.inline",
"pymarkdown.leaf_blocks",
"pymarkdown.links",
"pymarkdown.list_blocks",
"pymarkdown.plugin_manager",
"pymarkdown.plugins",
"pymarkdown.plugins.utils",
"pymarkdown.resources",
"pymarkdown.tokens",
"pymarkdown.transform_gfm",
"pymarkdown.transform_markdown",
]
def get_package_modules():
# return [
# next_item[0][2:]
# for next_item in os.walk(".")
# if os.path.exists(os.path.join(next_item[0], ".external-package"))
# ]
return PACKAGE_MODULES
AUTHOR = "Jack De Winter"
PROJECT_URL = "https://github.com/jackdewinter/pymarkdown"
PROJECT_URLS = {
"Documentation": "https://pymarkdown.readthedocs.io/",
"Change Log": "https://pymarkdown.readthedocs.io/en/latest/changelog/",
}
MODULE_NAME = "pymarkdown"
PACKAGE_NAME = "pymarkdownlnt"
SEMANTIC_VERSION = get_semantic_version()
MINIMUM_PYTHON_VERSION = "3.10.0"
ONE_LINE_DESCRIPTION = get_description()
LONG_DESCRIPTION = load_readme_file()
LONG_DESCRIPTION_CONTENT_TYPE = "text/markdown"
KEYWORDS = ["markdown", "linter", "markdown linter"]
PROJECT_CLASSIFIERS = [
"Development Status :: 4 - Beta",
"Environment :: Console",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Natural Language :: English",
"Topic :: Software Development :: Libraries :: Application Frameworks",
]
setup(
name=PACKAGE_NAME,
version=SEMANTIC_VERSION,
python_requires=f">={MINIMUM_PYTHON_VERSION}",
install_requires=parse_requirements(),
author=AUTHOR,
author_email=AUTHOR_EMAIL,
maintainer=AUTHOR,
maintainer_email=AUTHOR_EMAIL,
url=PROJECT_URL,
license="MIT",
license_files=("LICENSE.txt",),
description=ONE_LINE_DESCRIPTION,
long_description=LONG_DESCRIPTION,
long_description_content_type=LONG_DESCRIPTION_CONTENT_TYPE,
keywords=KEYWORDS,
classifiers=PROJECT_CLASSIFIERS,
project_urls=PROJECT_URLS,
entry_points={
"console_scripts": [
"pymarkdown=pymarkdown.__main__:main",
"pymarkdownlnt=pymarkdown.__main__:main",
],
},
packages=get_package_modules(),
include_package_data=True,
package_data={"": ["*.typed"]},
)