Skip to content

Commit

Permalink
setup fix: make backports-datetime-fromisoformat optional (#95)
Browse files Browse the repository at this point in the history
* setup fix: make backports-datetime-fromisoformat optional

* fix for 3.6

* use older solution

* restore line
  • Loading branch information
adbar authored Sep 5, 2023
1 parent 86341ca commit bf8ed97
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
11 changes: 6 additions & 5 deletions htmldate/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@

import logging

from sys import version_info
from datetime import datetime

from .core import find_date


if version_info.minor < 11:
try:
datetime.fromisoformat # type: ignore[attr-defined]
except AttributeError: # Python 3.6
from backports.datetime_fromisoformat import MonkeyPatch # type: ignore

MonkeyPatch.patch_fromisoformat()

from .core import find_date

logging.getLogger(__name__).addHandler(logging.NullHandler())
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# some problems with installation solved this way
extras = {
"speed": [
"backports-datetime-fromisoformat; python_version < '3.11'",
"cchardet >= 2.1.7; python_version < '3.11'", # build issue
"faust-cchardet >= 2.1.19; python_version >= '3.11'", # fix for build
"urllib3[brotli]",
Expand Down Expand Up @@ -114,7 +115,7 @@ def get_version(package):
include_package_data=True,
python_requires=">=3.6",
install_requires=[
"backports-datetime-fromisoformat; python_version < '3.11'",
"backports-datetime-fromisoformat; python_version < '3.7'",
"charset_normalizer >= 3.0.1; python_version < '3.7'",
"charset_normalizer >= 3.2.0; python_version >= '3.7'",
"dateparser >= 1.1.2", # 1.1.3+ slower
Expand Down

0 comments on commit bf8ed97

Please sign in to comment.