Skip to content

Commit

Permalink
build: drop support for Python 3.7, add support for Python 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
dgilland committed Jan 27, 2024
1 parent ecb354d commit 8a1c290
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 64 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.7", "3.8", "3.9", "3.10", "3.11" ]
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]

steps:
- name: Checkout
Expand Down
17 changes: 2 additions & 15 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,12 @@
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys


sys.path.insert(0, os.path.abspath(".."))


# -- Project information -----------------------------------------------------

from email import message_from_string
from pkg_resources import get_distribution

dist = get_distribution("pydash")
import importlib.metadata

if hasattr(dist, "_parsed_pkg_info"):
pkg_info = dict(dist._parsed_pkg_info)
else:
pkg_info = dict(message_from_string("\n".join(dist._get_metadata("PKG-INFO"))))
pkg_info = importlib.metadata.metadata("pydash")

project = pkg_info["Name"]
author = pkg_info["Author"]
Expand Down
5 changes: 2 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ classifiers =
Operating System :: OS Independent
Programming Language :: Python
Programming Language :: Python :: 3
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 :: Software Development :: Libraries
Topic :: Software Development :: Libraries :: Python Modules
Topic :: Utilities
Expand All @@ -28,7 +28,7 @@ classifiers =
package_dir =
= src
packages = find:
python_requires = >=3.7
python_requires = >=3.8
include_package_data = True
install_requires =
typing-extensions>=3.10,!=4.6.0
Expand All @@ -47,7 +47,6 @@ dev =
flake8-bugbear
flake8-isort
furo
importlib_metadata<5; python_version=="3.7"
invoke
isort
mypy
Expand Down
8 changes: 2 additions & 6 deletions src/pydash/types.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
from decimal import Decimal
import typing as t

from typing_extensions import Protocol


if t.TYPE_CHECKING:
# F401: imported but unused
# py3.7 flake8 doesn't get it for type aliases
from decimal import Decimal # noqa: F401

IterateeObjT = t.Union[int, str, t.List, t.Tuple, t.Dict]
NumberT = t.Union[float, int, "Decimal"]
NumberT = t.Union[float, int, Decimal]
NumberNoDecimalT = t.Union[float, int]
PathT = t.Union[t.Hashable, t.List[t.Hashable]]

Expand Down
15 changes: 4 additions & 11 deletions src/pydash/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""

from collections import namedtuple
from datetime import datetime
from datetime import datetime, timezone
from functools import partial, wraps
import math
from random import randint, uniform
Expand Down Expand Up @@ -739,16 +739,9 @@ def now() -> int:
.. versionchanged:: 3.0.0
Use ``datetime`` module for calculating elapsed time.
"""
epoch = datetime.utcfromtimestamp(0)
delta = datetime.utcnow() - epoch

if hasattr(delta, "total_seconds"):
seconds = delta.total_seconds()
else: # pragma: no cover
# PY26
seconds = (delta.microseconds + (delta.seconds + delta.days * 24 * 3600) * 10**6) / 10**6

return int(seconds * 1000)
epoch = datetime.fromtimestamp(0, timezone.utc)
delta = datetime.now(timezone.utc) - epoch
return int(delta.total_seconds() * 1000)


def over(funcs: t.Iterable[t.Callable[P, T]]) -> t.Callable[P, t.List[T]]:
Expand Down
27 changes: 1 addition & 26 deletions tests/test_strings.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import re
import sys
from urllib.parse import parse_qsl, urlsplit

import pytest
Expand Down Expand Up @@ -228,37 +227,13 @@ def test_escape(case, expected):
("abc", "abc"),
("", ""),
(None, ""),
],
)
def test_escape_reg_exp(case, expected):
assert _.escape_reg_exp(case) == expected


@pytest.mark.skipif(sys.version_info < (3, 7), reason="requires python3.7 or higher")
@parametrize(
"case,expected",
[ # noqa
(
"[pydash](http://pydash.readthedocs.org/)",
"\\[pydash\\]\\(http://pydash\\.readthedocs\\.org/\\)",
),
],
)
def test_escape_reg_exp_gte_py37(case, expected):
assert _.escape_reg_exp(case) == expected


@pytest.mark.skipif(sys.version_info >= (3, 7), reason="requires python3.6 or lower")
@parametrize(
"case,expected",
[ # noqa
(
"[pydash](http://pydash.readthedocs.org/)", # noqa
r"\[pydash\]\(http\:\/\/pydash\.readthedocs\.org\/\)",
),
],
)
def test_escape_reg_exp_lte_py36(case, expected):
def test_escape_reg_exp(case, expected):
assert _.escape_reg_exp(case) == expected


Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[tox]
envlist = py37, py38, py39, py310, py311
envlist = py38, py39, py310, py311, py312
isolated_build = true

[gh-actions]
python =
3.7: py37
3.8: py38
3.9: py39
3.10: py310
3.11: py311
3.12: py312

[testenv]
passenv = *
Expand Down

0 comments on commit 8a1c290

Please sign in to comment.