Skip to content

Commit fc6065d

Browse files
authored
Modernize (#52)
1 parent f1ecb67 commit fc6065d

File tree

16 files changed

+581
-309
lines changed

16 files changed

+581
-309
lines changed

.bumpversion.cfg

Lines changed: 0 additions & 8 deletions
This file was deleted.

.coveragerc

Lines changed: 0 additions & 3 deletions
This file was deleted.

.github/workflows/main.yml

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,44 @@
11
name: CI
2-
32
on:
43
push:
54
branches: [ master ]
65
pull_request:
7-
branches: [ master ]
8-
96
jobs:
10-
build:
11-
7+
test:
128
runs-on: ubuntu-latest
139
strategy:
10+
fail-fast: false
1411
matrix:
15-
python-version: [3.5, 3.6, 3.7, 3.8, 3.9]
16-
12+
include:
13+
- python-version: "3.9"
14+
toxenv: min
15+
- python-version: "3.9"
16+
- python-version: "3.10"
17+
- python-version: "3.11"
18+
- python-version: "3.12"
19+
- python-version: "3.13"
20+
- python-version: "3.13"
21+
toxenv: pre-commit
22+
- python-version: "3.13"
23+
toxenv: mypy
24+
- python-version: "3.13"
25+
toxenv: pylint
26+
- python-version: "3.13"
27+
toxenv: twinecheck
1728
steps:
18-
- uses: actions/checkout@v2
29+
- uses: actions/checkout@v4
1930
- name: libddb
2031
run: |
2132
sudo apt-get install libdb-dev
22-
2333
- name: Set up Python ${{ matrix.python-version }}
24-
uses: actions/setup-python@v2
34+
uses: actions/setup-python@v5
2535
with:
2636
python-version: ${{ matrix.python-version }}
27-
- name: Cache pip
28-
uses: actions/cache@v2
29-
with:
30-
path: ~/.cache/pip
31-
key: ${{ runner.os}}-pip-${{ hashFiles('tests/requirements-test.txt') }}
32-
restore-keys: |
33-
${{ runner.os}}-pip-
34-
${{ runner.os}}-
35-
- name: Install dependencies
36-
run: |
37-
python -m pip install --upgrade pip
38-
pip install -r tests/requirements-test.txt
39-
- name: Test with pytest
37+
- name: Run
38+
env:
39+
TOXENV: ${{ matrix.toxenv }}
4040
run: |
41-
pytest
41+
pip install -U tox
42+
tox
43+
- name: Upload coverage report
44+
uses: codecov/codecov-action@v5

.github/workflows/publish.yml

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,23 @@
1-
name: Upload Python Package
2-
1+
name: Publish
32
on:
4-
release:
5-
types: [created]
6-
3+
push:
4+
tags:
5+
- '[0-9]+.[0-9]+.[0-9]+'
76
jobs:
8-
deploy:
7+
publish:
98
runs-on: ubuntu-latest
10-
9+
environment:
10+
name: pypi
11+
url: https://pypi.org/p/${{ github.event.repository.name }}
12+
permissions:
13+
id-token: write
1114
steps:
12-
- uses: actions/checkout@v2
13-
- name: Set up Python
14-
uses: actions/setup-python@v2
15-
with:
16-
python-version: "3.x"
17-
- name: Install dependencies
18-
run: |
19-
python -m pip install --upgrade pip
20-
pip install setuptools wheel twine
21-
- name: Build and publish
22-
env:
23-
TWINE_USERNAME: __token__
24-
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
25-
run: |
26-
python setup.py sdist bdist_wheel
27-
twine upload dist/*
15+
- uses: actions/checkout@v4
16+
- uses: actions/setup-python@v5
17+
with:
18+
python-version: 3.13
19+
- run: |
20+
python -m pip install --upgrade build
21+
python -m build
22+
- name: Publish to PyPI
23+
uses: pypa/gh-action-pypi-publish@release/v1

.pre-commit-config.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
repos:
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.9.7
4+
hooks:
5+
- id: ruff
6+
args: [ --fix ]
7+
- id: ruff-format

CHANGES.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
Changes
22
=======
3+
4+
2.1.0 (unreleased)
5+
------------------
6+
7+
* Drop support for Python 3.8 and lower, add support for Python 3.9 and higher.
8+
* Add support for Scrapy 2.12.
9+
* Use the ``REQUEST_FINGERPRINTER_CLASS`` setting introduced in Scrapy 2.7.
10+
* Support new item types introduced in Scrapy 2.2.
11+
* Support ``Path`` instances in the ``DELTAFETCH_DIR`` setting.
12+
313
2.0.0 (2021-09-20)
414
------------------
515
* drop Python 2 support

pyproject.toml

Lines changed: 228 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,228 @@
1+
[build-system]
2+
requires = ["setuptools>=61.2"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "scrapy-deltafetch"
7+
version = "2.0.1"
8+
authors = [{name = "Zyte", email = "[email protected]"}]
9+
license = {text = "BSD"}
10+
description = "Scrapy middleware to ignore previously crawled pages"
11+
readme = "README.rst"
12+
classifiers = [
13+
"Development Status :: 4 - Beta",
14+
"License :: OSI Approved :: BSD License",
15+
"Operating System :: OS Independent",
16+
"Programming Language :: Python",
17+
"Programming Language :: Python :: 3",
18+
"Programming Language :: Python :: 3.9",
19+
"Programming Language :: Python :: 3.10",
20+
"Programming Language :: Python :: 3.11",
21+
"Programming Language :: Python :: 3.12",
22+
"Programming Language :: Python :: 3.13",
23+
]
24+
requires-python = ">=3.9"
25+
dependencies = ["Scrapy>=1.1.0"]
26+
27+
[project.urls]
28+
Homepage = "http://github.com/scrapy-plugins/scrapy-deltafetch"
29+
30+
[tool.bumpversion]
31+
current_version = "2.0.1"
32+
commit = true
33+
tag = true
34+
35+
[[tool.bumpversion.files]]
36+
filename = 'CHANGES.rst'
37+
search = "\\(unreleased\\)$"
38+
replace = "({now:%Y-%m-%d})"
39+
regex = true
40+
41+
[[tool.bumpversion.files]]
42+
search = "version = \"{current_version}\""
43+
replace = "version = \"{new_version}\""
44+
filename = "pyproject.toml"
45+
46+
[[tool.bumpversion.files]]
47+
filename = "scrapy_deltafetch/__init__.py"
48+
49+
[tool.coverage.run]
50+
branch = true
51+
include = ["scrapy_deltafetch/*"]
52+
omit = ["tests/*"]
53+
disable_warnings = ["include-ignored"]
54+
55+
[tool.coverage.paths]
56+
source = [
57+
"scrapy_deltafetch",
58+
".tox/**/site-packages/scrapy-deltafetch"
59+
]
60+
61+
[tool.coverage.report]
62+
# https://github.com/nedbat/coveragepy/issues/831#issuecomment-517778185
63+
exclude_lines = ["pragma: no cover", "if TYPE_CHECKING:"]
64+
65+
[tool.pylint.MASTER]
66+
persistent = "no"
67+
jobs = 1 # >1 hides results
68+
69+
[tool.pylint."MESSAGES CONTROL"]
70+
enable = [
71+
"useless-suppression",
72+
]
73+
disable = [
74+
# Ones we want to ignore
75+
"attribute-defined-outside-init",
76+
"broad-exception-caught",
77+
"consider-using-with",
78+
"cyclic-import",
79+
"disallowed-name",
80+
"duplicate-code", # https://github.com/pylint-dev/pylint/issues/214
81+
"fixme",
82+
"import-outside-toplevel",
83+
"inherit-non-class", # false positives with create_deprecated_class()
84+
"invalid-name",
85+
"invalid-overridden-method",
86+
"isinstance-second-argument-not-valid-type", # false positives with create_deprecated_class()
87+
"line-too-long",
88+
"logging-format-interpolation",
89+
"logging-fstring-interpolation",
90+
"logging-not-lazy",
91+
"missing-docstring",
92+
"no-member",
93+
"no-name-in-module", # caught by mypy already
94+
"no-value-for-parameter", # https://github.com/pylint-dev/pylint/issues/3268
95+
"not-callable",
96+
"protected-access",
97+
"redefined-builtin",
98+
"redefined-outer-name",
99+
"too-few-public-methods",
100+
"too-many-ancestors",
101+
"too-many-arguments",
102+
"too-many-branches",
103+
"too-many-function-args",
104+
"too-many-instance-attributes",
105+
"too-many-lines",
106+
"too-many-locals",
107+
"too-many-positional-arguments",
108+
"too-many-public-methods",
109+
"too-many-return-statements",
110+
"unused-argument",
111+
"unused-import",
112+
"unused-variable",
113+
"useless-import-alias", # used as a hint to mypy
114+
"useless-return", # https://github.com/pylint-dev/pylint/issues/6530
115+
"wrong-import-position",
116+
]
117+
118+
[tool.ruff.lint]
119+
extend-select = [
120+
# flake8-bugbear
121+
"B",
122+
# flake8-comprehensions
123+
"C4",
124+
# pydocstyle
125+
"D",
126+
# flake8-future-annotations
127+
"FA",
128+
# flynt
129+
"FLY",
130+
# refurb
131+
"FURB",
132+
# isort
133+
"I",
134+
# flake8-implicit-str-concat
135+
"ISC",
136+
# flake8-logging
137+
"LOG",
138+
# Perflint
139+
"PERF",
140+
# pygrep-hooks
141+
"PGH",
142+
# flake8-pie
143+
"PIE",
144+
# pylint
145+
"PL",
146+
# flake8-pytest-style
147+
"PT",
148+
# flake8-use-pathlib
149+
"PTH",
150+
# flake8-pyi
151+
"PYI",
152+
# flake8-quotes
153+
"Q",
154+
# flake8-return
155+
"RET",
156+
# flake8-raise
157+
"RSE",
158+
# Ruff-specific rules
159+
"RUF",
160+
# flake8-bandit
161+
"S",
162+
# flake8-simplify
163+
"SIM",
164+
# flake8-slots
165+
"SLOT",
166+
# flake8-debugger
167+
"T10",
168+
# flake8-type-checking
169+
"TC",
170+
# pyupgrade
171+
"UP",
172+
# pycodestyle warnings
173+
"W",
174+
# flake8-2020
175+
"YTT",
176+
]
177+
ignore = [
178+
# Missing docstring in public module
179+
"D100",
180+
# Missing docstring in public class
181+
"D101",
182+
# Missing docstring in public function
183+
"D103",
184+
# Missing docstring in public package
185+
"D104",
186+
# Missing docstring in magic method
187+
"D105",
188+
# Missing docstring in __init__
189+
"D107",
190+
# One-line docstring should fit on one line with quotes
191+
"D200",
192+
# No blank lines allowed after function docstring
193+
"D202",
194+
# 1 blank line required between summary line and description
195+
"D205",
196+
# Multi-line docstring closing quotes should be on a separate line
197+
"D209",
198+
# First line should end with a period
199+
"D400",
200+
# First line should be in imperative mood; try rephrasing
201+
"D401",
202+
# First line should not be the function's "signature"
203+
"D402",
204+
# Too many return statements
205+
"PLR0911",
206+
# Too many branches
207+
"PLR0912",
208+
# Too many arguments in function definition
209+
"PLR0913",
210+
# Too many statements
211+
"PLR0915",
212+
# Magic value used in comparison
213+
"PLR2004",
214+
# Mutable class attributes should be annotated with `typing.ClassVar`
215+
"RUF012",
216+
# Use of `assert` detected
217+
"S101",
218+
]
219+
220+
[tool.ruff.lint.per-file-ignores]
221+
# D102: Missing docstring in public method
222+
"tests/**" = ["D102"]
223+
224+
[tool.ruff.lint.pydocstyle]
225+
convention = "pep257"
226+
227+
[tool.setuptools]
228+
packages = ["scrapy_deltafetch"]

requirements.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

scrapy_deltafetch/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
from .middleware import DeltaFetch
22

3-
3+
__all__ = ["DeltaFetch"]
44
__version__ = "2.0.1"

0 commit comments

Comments
 (0)