Skip to content

Commit

Permalink
chg: Drop python 3.8 support
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafiot committed Nov 5, 2024
1 parent 938355f commit 94dce77
Show file tree
Hide file tree
Showing 7 changed files with 123 additions and 593 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/mypy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ jobs:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
name: Python ${{ matrix.python-version }} sample

steps:
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repos:
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/asottile/pyupgrade
rev: v3.18.0
rev: v3.19.0
hooks:
- id: pyupgrade
args: [--py38-plus]
args: [--py39-plus]
3 changes: 2 additions & 1 deletion lacuscore/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@

from enum import IntEnum, unique
from logging import LoggerAdapter
from typing import MutableMapping, Any, TypedDict, Mapping, Literal
from typing import Any, TypedDict, Literal
from collections.abc import MutableMapping, Mapping

from defang import refang # type: ignore[import-untyped]
from pydantic import BaseModel, field_validator, model_validator, ValidationError
Expand Down
4 changes: 2 additions & 2 deletions lacuscore/lacuscore.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
from datetime import date, timedelta
from ipaddress import ip_address, IPv4Address, IPv6Address
from tempfile import NamedTemporaryFile
from typing import Literal, Any, overload, cast, Iterator
from typing import Literal, Any, overload, cast
from collections.abc import Iterator
from uuid import uuid4
from urllib.parse import urlsplit

Expand Down Expand Up @@ -475,7 +476,6 @@ async def _capture(self, uuid: str, priority: int) -> None:

# If the class is initialized with max_retries below the one provided in the settings, we use the lowest value
max_retries = min([to_capture.max_retries, self.max_retries]) if to_capture.max_retries is not None else self.max_retries

try:
logger.debug(f'Capturing {url}')
stats_pipeline.sadd(f'stats:{today}:captures', url)
Expand Down
15 changes: 8 additions & 7 deletions lacuscore/task_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

from __future__ import annotations

from typing import Any, Coroutine, Optional, TypeVar, Tuple
from typing import Any, TypeVar
from collections.abc import Coroutine

import asyncio
import functools
Expand All @@ -18,12 +19,12 @@ def create_task(
coroutine: Coroutine[Any, Any, T],
*,
name: str,
logger: 'LacusCoreLogAdapter',
logger: LacusCoreLogAdapter,
message: str,
message_args: Tuple[Any, ...] = (),
loop: Optional[asyncio.AbstractEventLoop] = None,
message_args: tuple[Any, ...] = (),
loop: asyncio.AbstractEventLoop | None = None,

) -> 'asyncio.Task[T]': # This type annotation has to be quoted for Python < 3.9, see https://www.python.org/dev/peps/pep-0585/
) -> asyncio.Task[T]: # This type annotation has to be quoted for Python < 3.9, see https://www.python.org/dev/peps/pep-0585/
'''
This helper function wraps a ``loop.create_task(coroutine())`` call and ensures there is
an exception handler added to the resulting task. If the task raises an exception it is logged
Expand All @@ -42,9 +43,9 @@ def create_task(
def _handle_task_result(
task: asyncio.Task[Any],
*,
logger: 'LacusCoreLogAdapter',
logger: LacusCoreLogAdapter,
message: str,
message_args: Tuple[Any, ...] = (),
message_args: tuple[Any, ...] = (),
) -> None:
try:
task.result()
Expand Down
673 changes: 103 additions & 570 deletions poetry.lock

Large diffs are not rendered by default.

14 changes: 4 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "lacuscore"
version = "1.11.3"
version = "1.12.0"
description = "Core of Lacus, usable as a module"
authors = ["Raphaël Vinot <[email protected]>"]
license = "BSD-3-Clause"
Expand All @@ -18,7 +18,6 @@ classifiers = [
'Intended Audience :: Telecommunications Industry',
'Intended Audience :: Information Technology',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
Expand All @@ -29,21 +28,17 @@ classifiers = [
]

[tool.poetry.dependencies]
python = "^3.8"
python = "^3.9"
requests = "^2.32.3"
Sphinx = [
{version = "<7.2", python = "<3.9", optional = true},
{version = "^7.2", python = ">=3.9,<3.10", optional = true},
{version = "^8", python = ">=3.10", optional = true}
]
playwrightcapture = {extras = ["recaptcha"], version = "^1.26.3"}
playwrightcapture = {extras = ["recaptcha"], version = "^1.27.0"}
defang = "^0.5.3"
ua-parser = "^0.18.0"
redis = {version = "^5.2.0", extras = ["hiredis"]}
dnspython = [
{version = "<2.7", python = "<3.9"},
{version = "^2.7", python = ">=3.9"}
]
dnspython = {version = "^2.7.0", python = ">=3.9"}
async-timeout = {version = "^4.0.3", python = "<3.11"}
pydantic = "^2.9.2"
eval-type-backport = {version = "^0.2.0", python = "<3.10"}
Expand All @@ -57,7 +52,6 @@ types-redis = {version = "^4.6.0.20241004"}
types-requests = "^2.32.0.20241016"
types-beautifulsoup4 = "^4.12.0.20241020"
ipython = [
{version = "<8.13.0", python = "<3.9"},
{version = "^8.18.0", python = ">=3.9"},
{version = "^8.19.0", python = ">=3.10"}
]
Expand Down

0 comments on commit 94dce77

Please sign in to comment.