Skip to content

Commit c935190

Browse files
committed
Drop support for Python 3.8
Python 3.8 has reached its end-of-life: https://peps.python.org/pep-0569/
1 parent e0349cc commit c935190

File tree

12 files changed

+28
-48
lines changed

12 files changed

+28
-48
lines changed

.github/workflows/tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
strategy:
99
matrix:
1010
include:
11-
- python: "3.8"
11+
- python: "3.9"
1212
psycopg: "psycopg2"
1313
- python: "3.12"
1414
psycopg: "psycopg3"

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020

2121
* Exit with status 0 upon keyboard interrupt.
2222

23+
### Removed
24+
25+
* Python 3.8 is no longer supported.
26+
2327
## pg\_activity 3.5.1 - 2024-04-03
2428

2529
### Fixed

pgactivity/activities.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
import builtins
44
import os
55
import time
6+
from collections.abc import Sequence
67
from typing import TypeVar
78
from warnings import catch_warnings, simplefilter
89

910
import attr
1011
import psutil
1112

12-
from .compat import Sequence
1313
from .types import (
1414
BlockingProcess,
1515
IOCounter,

pgactivity/cli.py

+7-8
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,13 @@ def configure_logger(debug_file: str | None = None) -> StringIO:
4747

4848
def flag(p: Any, spec: str, *, dest: str, feature: str) -> None:
4949
assert not spec.startswith("--no-") and spec.startswith("--"), spec
50-
if sys.version_info < (3, 9):
51-
spec = f"--no-{spec[2:]}"
52-
action = "store_false"
53-
help = f"Disable {feature}."
54-
else:
55-
action = argparse.BooleanOptionalAction
56-
help = f"Enable/disable {feature}."
57-
p.add_argument(spec, dest=dest, help=help, action=action, default=None)
50+
p.add_argument(
51+
spec,
52+
dest=dest,
53+
help=f"Enable/disable {feature}.",
54+
action=argparse.BooleanOptionalAction,
55+
default=None,
56+
)
5857

5958

6059
def get_parser() -> argparse.ArgumentParser:

pgactivity/compat.py

-24
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,6 @@
1010
import attr.validators
1111
import blessed
1212

13-
__all__ = [
14-
"Callable",
15-
"Dict",
16-
"Iterable",
17-
"Iterator",
18-
"Mapping",
19-
"MutableSet",
20-
"Sequence",
21-
]
22-
23-
if sys.version_info >= (3, 9):
24-
from collections.abc import (
25-
Callable,
26-
Iterable,
27-
Iterator,
28-
Mapping,
29-
MutableSet,
30-
Sequence,
31-
)
32-
33-
Dict = dict
34-
else:
35-
from typing import Callable, Dict, Iterable, Iterator, Mapping, MutableSet, Sequence
36-
3713
if sys.version_info >= (3, 11):
3814

3915
def read_resource(pkgname: str, dirname: str, *args: str) -> str | None:

pgactivity/pg.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22

33
import logging
44
import os
5+
from collections.abc import Callable, Sequence
56
from typing import Any, TypeVar, overload
67

7-
from .compat import Callable, Dict, Sequence
8-
98
Row = TypeVar("Row")
109

1110
try:
@@ -29,7 +28,7 @@
2928

3029
__version__ = psycopg.__version__
3130

32-
Connection = psycopg.Connection[Dict[str, Any]]
31+
Connection = psycopg.Connection[dict[str, Any]]
3332

3433
class BytesLoader(Loader):
3534
def load(self, data: Buffer) -> bytes:

pgactivity/queries/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
here = pathlib.Path(__file__).parent
55

66

7-
@functools.lru_cache(maxsize=None)
7+
@functools.cache
88
def get(name: str) -> str:
99
path = here / f"{name}.sql"
1010
with path.open() as f:

pgactivity/types.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22

33
import enum
44
import functools
5+
from collections.abc import Callable, Iterable, Iterator, Mapping, MutableSet, Sequence
56
from datetime import timedelta
67
from ipaddress import IPv4Address, IPv6Address
7-
from typing import Any, Tuple, TypeVar, Union, overload
8+
from typing import Any, TypeVar, Union, overload
89

910
import attr
1011
import psutil
1112
from attr import validators
1213

1314
from . import colors, compat, pg, utils
14-
from .compat import Callable, Iterable, Iterator, Mapping, MutableSet, Sequence
1515
from .config import Configuration, Flag, HeaderSection, UISection
1616

1717

@@ -1186,7 +1186,7 @@ def copy_focused_query_to_clipboard(self) -> str:
11861186
ActivityStats = Union[
11871187
Iterable[WaitingProcess],
11881188
Iterable[RunningProcess],
1189-
Tuple[Iterable[WaitingProcess], SystemInfo],
1190-
Tuple[Iterable[BlockingProcess], SystemInfo],
1191-
Tuple[Iterable[LocalRunningProcess], SystemInfo],
1189+
tuple[Iterable[WaitingProcess], SystemInfo],
1190+
tuple[Iterable[BlockingProcess], SystemInfo],
1191+
tuple[Iterable[LocalRunningProcess], SystemInfo],
11921192
]

pgactivity/ui.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import time
44
from argparse import Namespace
55
from functools import partial
6-
from typing import List, cast
6+
from typing import cast
77

88
import attr
99
from blessed import Terminal
@@ -216,7 +216,7 @@ def main(
216216
if is_local:
217217
# TODO: Use this logic in waiting and blocking cases.
218218
local_pg_procs, io_read, io_write = activities.ps_complete(
219-
cast(List[types.RunningProcess], pg_procs.items),
219+
cast(list[types.RunningProcess], pg_procs.items),
220220
sys_procs,
221221
fs_blocksize,
222222
)

pgactivity/utils.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
import functools
55
import re
66
import sys
7+
from collections.abc import Iterable, Mapping
78
from datetime import datetime, timedelta, timezone
8-
from typing import IO, Any, Iterable, Mapping
9+
from typing import IO, Any
910

1011
import attr
1112
import humanize

pgactivity/views.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
import functools
44
import inspect
55
import itertools
6+
from collections.abc import Callable, Iterable, Iterator, Sequence
67
from textwrap import TextWrapper, dedent
78
from typing import Any, Literal
89

910
from blessed import Terminal
1011

1112
from . import colors, utils
1213
from .activities import sorted as sorted_processes
13-
from .compat import Callable, Iterable, Iterator, Sequence, link
14+
from .compat import link
1415
from .keys import BINDINGS, EXIT_KEY
1516
from .keys import HELP as HELP_KEY
1617
from .keys import (

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ dynamic = ["version"]
88
description = "Command line tool for PostgreSQL server activity monitoring."
99
readme = "README.md"
1010
license = { text = "PostgreSQL" }
11-
requires-python = ">=3.8"
11+
requires-python = ">=3.9"
1212
authors = [
1313
{ name = "Julien Tachoires", email = "[email protected]" },
1414
{ name = "Benoit Lobréau", email = "[email protected]" },

0 commit comments

Comments
 (0)