Skip to content

Commit d78c134

Browse files
committed
Drop support for python 3.8 and add 3.13 support
1 parent 6ca8b47 commit d78c134

13 files changed

+30
-39
lines changed

.pre-commit-config.yaml

+1-5
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,7 @@ repos:
2929
- id: ruff
3030
args: [ --exit-non-zero-on-fix, --fix ]
3131
files: ^(prawcore/.*.py)$
32-
33-
- repo: https://github.com/psf/black
34-
hooks:
35-
- id: black
36-
rev: 24.10.0
32+
- id: ruff-format
3733

3834
- repo: https://github.com/LilSpazJoekp/docstrfmt
3935
hooks:

CHANGES.rst

+7-3
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,18 @@ prawcore follows `semantic versioning <https://semver.org/>`_.
66
Unreleased
77
----------
88

9+
**Changed**
10+
11+
- Drop support for Python 3.8, which was end-of-life on 2024-10-07.
12+
913
2.4.0 (2023/10/01)
1014
------------------
1115

1216
**Changed**
1317

14-
- Drop support for Python 3.6, which is end-of-life on 2021-12-23.
18+
- Drop support for Python 3.6, which was end-of-life on 2021-12-23.
1519
- Updated rate limit algorithm to better handle Reddit's new rate limits.
16-
- Drop support for Python 3.7, which is end-of-life on 2023-06-27.
20+
- Drop support for Python 3.7, which was end-of-life on 2023-06-27.
1721

1822
2.3.0 (2021-07-26)
1923
------------------
@@ -75,7 +79,7 @@ Unreleased
7579

7680
**Changed**
7781

78-
- Drop support for Python 3.5, which is end-of-life on 2020-09-13.
82+
- Drop support for Python 3.5, which was end-of-life on 2020-09-13.
7983

8084
1.4.0 (2020-05-28)
8185
------------------

README.rst

-4
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@ prawcore
3535
:alt: pre-commit
3636
:target: https://github.com/pre-commit/pre-commit
3737

38-
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
39-
:alt: Black code style
40-
:target: https://github.com/psf/black
41-
4238
prawcore is a low-level communication layer used by PRAW 4+.
4339

4440
Installation

examples/obtain_refresh_token.py

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
application OAuth2 credentials.
1010
1111
"""
12+
1213
import os
1314
import random
1415
import socket

examples/read_only_auth_trophies.py

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
require an access token to make authenticated requests to Reddit.
77
88
"""
9+
910
import os
1011
import sys
1112

examples/script_auth_friend_list.py

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
password.
88
99
"""
10+
1011
import os
1112
import sys
1213

prawcore/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
""""Low-level communication layer for PRAW 4+."""
1+
"""Low-level communication layer for PRAW 4+."""
22

33
import logging
44

prawcore/const.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
REVOKE_TOKEN_PATH = "/api/v1/revoke_token" # noqa: S105
88
TIMEOUT = float(
99
os.environ.get(
10-
"PRAWCORE_TIMEOUT", os.environ.get("prawcore_timeout", 16) # noqa: SIM112
10+
"PRAWCORE_TIMEOUT",
11+
os.environ.get("prawcore_timeout", 16), # noqa: SIM112
1112
)
1213
)
1314
WINDOW_SIZE = 600

prawcore/rate_limit.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44

55
import logging
66
import time
7-
from typing import TYPE_CHECKING, Any, Callable, Mapping
7+
from typing import TYPE_CHECKING, Any, Callable
88

99
if TYPE_CHECKING:
10+
from collections.abc import Mapping
11+
1012
from requests.models import Response
1113

1214
log = logging.getLogger(__package__)

prawcore/sessions.py

+5-8
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,8 @@ def _make_request(
205205
)
206206
return response, None
207207
except RequestException as exception:
208-
if (
209-
not retry_strategy_state.should_retry_on_failure()
210-
or not isinstance( # noqa: E501
211-
exception.original_exception, self.RETRY_EXCEPTIONS
212-
)
208+
if not retry_strategy_state.should_retry_on_failure() or not isinstance( # noqa: E501
209+
exception.original_exception, self.RETRY_EXCEPTIONS
213210
):
214211
raise
215212
return None, exception.original_exception
@@ -266,9 +263,9 @@ def _request_with_retries(
266263
raise self.STATUS_EXCEPTIONS[response.status_code](response)
267264
if response.status_code == codes["no_content"]:
268265
return None
269-
assert (
270-
response.status_code in self.SUCCESS_STATUSES
271-
), f"Unexpected status code: {response.status_code}"
266+
assert response.status_code in self.SUCCESS_STATUSES, (
267+
f"Unexpected status code: {response.status_code}"
268+
)
272269
if response.headers.get("content-length") == "0":
273270
return ""
274271
try:

pre_push.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def main():
6464
"-n",
6565
"--unstatic",
6666
action="store_true",
67-
help="Do not run static tests (black/flake8/pydocstyle)",
67+
help="Do not run static tests (ruff)",
6868
default=False,
6969
)
7070
parser.add_argument(

pyproject.toml

+5-13
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ classifiers = [
1212
"Natural Language :: English",
1313
"Programming Language :: Python",
1414
"Programming Language :: Python :: 3",
15-
"Programming Language :: Python :: 3.8",
1615
"Programming Language :: Python :: 3.9",
1716
"Programming Language :: Python :: 3.10",
1817
"Programming Language :: Python :: 3.11",
19-
"Programming Language :: Python :: 3.12"
18+
"Programming Language :: Python :: 3.12",
19+
"Programming Language :: Python :: 3.13"
2020
]
2121
dependencies = [
2222
"requests >=2.6.0, <3.0"
@@ -29,7 +29,7 @@ maintainers = [
2929
]
3030
name = "prawcore"
3131
readme = "README.rst"
32-
requires-python = "~=3.8"
32+
requires-python = "~=3.9"
3333

3434
[project.optional-dependencies]
3535
ci = ["coveralls"]
@@ -40,7 +40,7 @@ dev = [
4040
]
4141
lint = [
4242
"pre-commit",
43-
"ruff ==0.1.*"
43+
"ruff ==0.9.*"
4444
]
4545
test = [
4646
"betamax >=0.8, <0.9",
@@ -52,16 +52,8 @@ test = [
5252
"Issue Tracker" = "https://github.com/praw-dev/prawcore/issues"
5353
"Source Code" = "https://github.com/praw-dev/prawcore"
5454

55-
[tool.black]
56-
extend_exclude = '/(\.venv.*)/'
57-
line-length = 88
58-
59-
[tool.isort]
60-
profile = 'black'
61-
skip_glob = '.venv*'
62-
6355
[tool.ruff]
64-
target-version = "py38"
56+
target-version = "py39"
6557
include = [
6658
"prawcore/*.py"
6759
]

tools/set_version.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def add_unreleased_to_changelog():
2525
return False
2626

2727
with open("CHANGES.rst", "w") as fp:
28-
fp.write(f"{new_header}{content[len(CHANGELOG_HEADER):]}")
28+
fp.write(f"{new_header}{content[len(CHANGELOG_HEADER) :]}")
2929
return True
3030

3131

@@ -84,7 +84,7 @@ def update_changelog(version):
8484
version_header = f"{version_line}{'-' * len(version_line[:-1])}\n\n"
8585

8686
with open("CHANGES.rst", "w") as fp:
87-
fp.write(f"{CHANGELOG_HEADER}{version_header}{content[len(expected_header):]}")
87+
fp.write(f"{CHANGELOG_HEADER}{version_header}{content[len(expected_header) :]}")
8888
return True
8989

9090

0 commit comments

Comments
 (0)