Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setup fix: make backports-datetime-fromisoformat optional #95

Merged
merged 4 commits into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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

Check warning on line 19 in htmldate/__init__.py

View check run for this annotation

Codecov / codecov/patch

htmldate/__init__.py#L19

Added line #L19 was not covered by tests
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
Loading