forked from adbar/htmldate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
136 lines (123 loc) · 4.35 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
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
"""
Seamlessly extract the date of web pages based on URL, header or body.
http://github.com/adbar/htmldate
"""
import re
import sys
from pathlib import Path
from setuptools import setup
# some problems with installation solved this way
extras = {
"speed": [
"backports-datetime-fromisoformat; python_version < '3.11'",
"faust-cchardet >= 2.1.19",
"urllib3[brotli]",
],
}
extras["all"] = extras["speed"]
def get_long_description():
"Return the README"
with open("README.rst", "r", encoding="utf-8") as filehandle:
long_description = filehandle.read()
# long_description += "\n\n"
# with open("CHANGELOG.md", encoding="utf8") as f:
# long_description += f.read()
return long_description
def get_version(package):
"Return package version as listed in `__version__` in `init.py`"
initfile = Path(package, "__init__.py").read_text()
return re.search("__version__ = ['\"]([^'\"]+)['\"]", initfile)[1]
# add argument to compile with mypyc
if len(sys.argv) > 1 and sys.argv[1] == "--use-mypyc":
sys.argv.pop(1)
USE_MYPYC = True
from mypyc.build import mypycify
ext_modules = mypycify(
[
"htmldate/__init__.py",
"htmldate/core.py",
"htmldate/extractors.py",
"htmldate/settings.py",
"htmldate/utils.py",
"htmldate/validators.py",
],
opt_level="3",
multi_file=True,
)
else:
ext_modules = []
setup(
name="htmldate",
version=get_version("htmldate"),
description="Fast and robust extraction of original and updated publication dates from URLs and web pages.",
long_description=get_long_description(),
classifiers=[
# As from http://pypi.python.org/pypi?%3Aaction=list_classifiers
"Development Status :: 5 - Production/Stable",
# 'Development Status :: 6 - Mature',
"Environment :: Console",
"Intended Audience :: Developers",
"Intended Audience :: Education",
"Intended Audience :: Information Technology",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Scientific/Engineering :: Information Analysis",
"Topic :: Text Processing :: Linguistic",
"Topic :: Text Processing :: Markup :: HTML",
],
keywords=[
"datetime",
"date-parser",
"entity-extraction",
"html-extraction",
"html-parsing",
"metadata-extraction",
"webarchives",
"web-scraping",
],
url="https://htmldate.readthedocs.io",
project_urls={
"Source": "https://github.com/adbar/htmldate",
"Tracker": "https://github.com/adbar/htmldate/issues",
"Blog": "https://adrien.barbaresi.eu/blog/tag/htmldate.html",
},
author="Adrien Barbaresi",
author_email="[email protected]",
license="GPLv3+",
packages=["htmldate"],
include_package_data=True,
python_requires=">=3.6",
install_requires=[
"backports-datetime-fromisoformat; python_version < '3.7'",
"charset_normalizer >= 3.0.1; python_version < '3.7'",
"charset_normalizer >= 3.3.2; python_version >= '3.7'",
"dateparser >= 1.1.2", # 1.1.3+ slower
"lxml >= 4.9.3 ; platform_system != 'Darwin'",
"lxml == 4.9.2 ; platform_system == 'Darwin'",
"python-dateutil >= 2.8.2",
"urllib3 >= 1.26, < 2; python_version < '3.7'",
"urllib3 >= 1.26, < 3; python_version >= '3.7'",
],
extras_require=extras,
entry_points={
"console_scripts": ["htmldate=htmldate.cli:main"],
},
# platforms='any',
tests_require=["pytest"],
zip_safe=False,
# optional use of mypyc
ext_modules=ext_modules,
)