Skip to content

Commit 02df424

Browse files
woodruffwwebknjaz
andauthored
chore(ci): cleanup, add Python 3.14 (#392)
Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
1 parent 9af76f7 commit 02df424

File tree

13 files changed

+1458
-139
lines changed

13 files changed

+1458
-139
lines changed

.github/dependabot.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ updates:
55
directory: /
66
schedule:
77
interval: daily
8+
cooldown:
9+
default-days: 7
810
open-pull-requests-limit: 99
911
rebase-strategy: "disabled"
1012
groups:

.github/workflows/release.yml

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,22 @@ jobs:
1313
runs-on: ubuntu-latest
1414

1515
permissions:
16-
# Used to authenticate to PyPI via OIDC.
17-
# Used to sign the release's artifacts with sigstore-python.
18-
id-token: write
19-
20-
# Used to attach signing artifacts to the published release.
21-
contents: write
16+
id-token: write # For Trusted Publishing + attestations.
17+
contents: write # For uploading release assets.
2218

2319
steps:
24-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
25-
with:
26-
persist-credentials: false
27-
28-
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
29-
with:
30-
python-version-file: pyproject.toml
20+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
21+
with:
22+
persist-credentials: false
3123

32-
- name: deps
33-
run: python -m pip install -U build
24+
- name: Install the latest version of uv
25+
uses: astral-sh/setup-uv@85856786d1ce8acfbcc2f13a5f3fbd6b938f9f41 # v7.1.2
26+
with:
27+
enable-cache: false
3428

35-
- name: build
36-
run: python -m build
29+
- name: build
30+
run: make dist
3731

38-
- name: publish
39-
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
32+
- name: publish
33+
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
4034

.github/workflows/tests.yml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ on:
1010

1111
permissions: {}
1212

13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
15+
cancel-in-progress: true
16+
1317
jobs:
1418
tests:
1519
name: "Python ${{ matrix.python-version }} ${{ matrix.os }}"
@@ -18,25 +22,23 @@ jobs:
1822
strategy:
1923
fail-fast: false
2024
matrix:
21-
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
25+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
2226
os: ["macos-latest", "windows-latest", "ubuntu-latest"]
2327

2428
steps:
25-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
29+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2630
with:
2731
persist-credentials: false
2832

29-
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
33+
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
3034
with:
3135
python-version: "${{ matrix.python-version }}"
3236
allow-prereleases: true
3337

34-
- name: "Install dependencies"
35-
run: |
36-
python -VV
37-
python -m site
38-
python -m pip install --upgrade pip setuptools wheel
39-
python -m pip install --upgrade virtualenv tox tox-gh-actions
38+
- name: Install the latest version of uv
39+
uses: astral-sh/setup-uv@85856786d1ce8acfbcc2f13a5f3fbd6b938f9f41 # v7.1.2
4040

41-
- name: "Run tox targets for ${{ matrix.python-version }}"
42-
run: "python -m tox"
41+
- name: Run tests for ${{ matrix.python-version }}
42+
run: |
43+
make bootstrap
44+
make test

.github/workflows/zizmor.yml

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,15 @@ permissions: {}
1010

1111
jobs:
1212
zizmor:
13-
name: zizmor latest via PyPI
13+
name: Run zizmor 🌈
1414
runs-on: ubuntu-latest
1515
permissions:
16-
security-events: write
17-
# required for workflows in private repositories
18-
contents: read
19-
actions: read
16+
security-events: write # For uploading security analysis results.
2017
steps:
2118
- name: Checkout repository
22-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
19+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2320
with:
2421
persist-credentials: false
2522

26-
- name: Install the latest version of uv
27-
uses: astral-sh/setup-uv@f0ec1fc3b38f5e7cd731bb6ce540c5af426746bb # v6.1.0
28-
2923
- name: Run zizmor 🌈
30-
run: uvx zizmor --format sarif . > results.sarif
31-
env:
32-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33-
34-
- name: Upload SARIF file
35-
uses: github/codeql-action/upload-sarif@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3.28.18
36-
with:
37-
sarif_file: results.sarif
38-
category: zizmor
24+
uses: zizmorcore/zizmor-action@e673c3917a1aef3c65c972347ed84ccd013ecda4 # v0.2.0

Makefile

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,24 @@
33
# SPDX-License-Identifier: Apache-2.0
44

55
VENV=.venv
6-
VENV_CMD=python3 -m venv
76
ACTIVATE = $(VENV)/bin/activate
87

9-
$(VENV)/bin/pip:
10-
$(VENV_CMD) $(VENV)
8+
bootstrap:
9+
uv sync --extra dev
1110

12-
bootstrap: $(VENV)/bin/pip
13-
$(VENV)/bin/pip install -e .[dev]
11+
lint:
12+
uv run ruff check
13+
uv run mypy cachecontrol
1414

1515
format:
16-
$(VENV)/bin/codespell
17-
$(VENV)/bin/ruff check --fix
18-
$(VENV)/bin/ruff format
16+
uv run codespell
17+
uv run ruff check --fix
18+
uv run ruff format
1919

2020
doc: $(VENV)/bin/sphinx-build
21-
. $(ACTIVATE);
22-
cd docs && make html
21+
. $(ACTIVATE) && \
22+
cd docs && \
23+
make html
2324

2425
clean: clean-build clean-pyc clean-test
2526

@@ -35,19 +36,15 @@ clean-pyc:
3536
find . -name '__pycache__' -exec rm -fr {} +
3637

3738
clean-test:
38-
rm -fr .tox/
3939
rm -f .coverage
4040
rm -fr htmlcov/
4141

42-
test-all:
43-
$(VENV)/bin/tox
44-
4542
test:
46-
$(VENV)/bin/py.test
43+
uv run py.test
4744

4845
coverage:
49-
$(VENV)/bin/py.test --cov cachecontrol
46+
uv run py.test --cov cachecontrol
5047

5148
dist: clean
52-
$(VENV)/bin/python -m build
49+
uv build
5350
ls -l dist

cachecontrol/__init__.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,16 @@
77
Make it easy to import from cachecontrol without long namespaces.
88
"""
99

10-
__author__ = "Eric Larson"
11-
__email__ = "eric@ionrock.org"
12-
__version__ = "0.14.3"
10+
import importlib.metadata
1311

1412
from cachecontrol.adapter import CacheControlAdapter
1513
from cachecontrol.controller import CacheController
1614
from cachecontrol.wrapper import CacheControl
1715

16+
__author__ = "Eric Larson"
17+
__email__ = "eric@ionrock.org"
18+
__version__ = importlib.metadata.version("cachecontrol")
19+
1820
__all__ = [
1921
"__author__",
2022
"__email__",

cachecontrol/adapter.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from __future__ import annotations
55

66
import functools
7-
import types
87
import weakref
98
import zlib
109
from typing import TYPE_CHECKING, Any, Collection, Mapping

cachecontrol/filewrapper.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from typing import TYPE_CHECKING, Any, Callable
99

1010
if TYPE_CHECKING:
11+
from collections.abc import Buffer
1112
from http.client import HTTPResponse
1213

1314

@@ -31,7 +32,7 @@ class CallbackFileWrapper:
3132
"""
3233

3334
def __init__(
34-
self, fp: HTTPResponse, callback: Callable[[bytes], None] | None
35+
self, fp: HTTPResponse, callback: Callable[[Buffer], None] | None
3536
) -> None:
3637
self.__buf = NamedTemporaryFile("rb+", delete=True)
3738
self.__fp = fp
@@ -68,6 +69,7 @@ def __is_fp_closed(self) -> bool:
6869
return False
6970

7071
def _close(self) -> None:
72+
result: Buffer
7173
if self.__callback:
7274
if self.__buf.tell() == 0:
7375
# Empty file:

docs/release_notes.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77
Release Notes
88
===============
99

10+
0.14.4
11+
======
12+
13+
* Explicitly support Python 3.14.
14+
* Drop support for Python 3.9.
15+
1016
0.14.3
1117
======
1218

pyproject.toml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
[build-system]
2-
requires = ["flit_core >=3.11,<4"]
3-
build-backend = "flit_core.buildapi"
2+
requires = ["uv_build>=0.9.6,<0.10.0"]
3+
build-backend = "uv_build"
44

5-
[tool.flit.module]
6-
name = "cachecontrol"
5+
[tool.uv.build-backend]
6+
source-include = ["tests/"]
7+
module-name = "cachecontrol"
8+
module-root = ""
79

8-
[tool.flit.sdist]
9-
include = ["tests/"]
1010

1111
[project]
1212
name = "CacheControl"
13-
dynamic = ["version"]
13+
version = "0.14.3"
1414
description = "httplib2 caching for requests"
1515
readme = "README.rst"
1616
license = "Apache-2.0"
@@ -24,16 +24,16 @@ classifiers = [
2424
"Development Status :: 4 - Beta",
2525
"Environment :: Web Environment",
2626
"Operating System :: OS Independent",
27-
"Programming Language :: Python :: 3.9",
2827
"Programming Language :: Python :: 3.10",
2928
"Programming Language :: Python :: 3.11",
3029
"Programming Language :: Python :: 3.12",
3130
"Programming Language :: Python :: 3.13",
31+
"Programming Language :: Python :: 3.14",
3232
"Topic :: Internet :: WWW/HTTP",
3333
]
3434
keywords = ["requests", "http", "caching", "web"]
3535
dependencies = ["requests >= 2.16.0", "msgpack >= 0.5.2, < 2.0.0"]
36-
requires-python = ">=3.9"
36+
requires-python = ">=3.10"
3737

3838
[project.urls]
3939
Homepage = "https://pypi.org/project/CacheControl/"
@@ -48,17 +48,18 @@ redis = ["redis>=2.10.5"]
4848
# Development extras.
4949
dev = [
5050
"CacheControl[filecache,redis]",
51-
"build",
5251
"cherrypy",
53-
"codespell[tomli]",
52+
# See: https://github.com/cherrypy/cherrypy/issues/2070
53+
# See: https://github.com/cherrypy/cheroot/issues/769
54+
"cheroot >= 11.1.2",
55+
"codespell",
5456
"furo",
5557
"mypy",
5658
"pytest",
5759
"pytest-cov",
5860
"ruff",
5961
"sphinx",
6062
"sphinx-copybutton",
61-
"tox",
6263
"types-redis",
6364
"types-requests",
6465
]

0 commit comments

Comments
 (0)