Skip to content

Commit 8567545

Browse files
authored
Drop Python 3.8 and PyPy 3.9, add more CI tools, fix building docs (#94)
1 parent 001bf7c commit 8567545

12 files changed

+74
-30
lines changed

.bandit.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
skips:
2+
- B101
3+
exclude_dirs: ['tests']

.github/workflows/main.yml

+9-9
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
- uses: actions/checkout@v4
1010
- uses: actions/setup-python@v5
1111
with:
12-
python-version: "3.12"
12+
python-version: "3.13"
1313
- uses: pre-commit/[email protected]
1414

1515
tests:
@@ -21,18 +21,18 @@ jobs:
2121
- python-version: '3.12' # Keep in sync with .readthedocs.yml
2222
env:
2323
TOXENV: docs
24-
- python-version: '3.12'
24+
- python-version: '3.13'
25+
env:
26+
TOXENV: pylint
27+
- python-version: '3.13'
2528
env:
2629
TOXENV: twinecheck
27-
- python-version: 3.8
30+
- python-version: '3.13'
2831
env:
29-
TOXENV: py
32+
TOXENV: typing
3033
- python-version: 3.9
3134
env:
3235
TOXENV: py
33-
- python-version: pypy-3.9
34-
env:
35-
TOXENV: py
3636
- python-version: pypy-3.10
3737
env:
3838
TOXENV: py
@@ -48,13 +48,13 @@ jobs:
4848
- python-version: '3.12'
4949
env:
5050
TOXENV: py
51-
- python-version: '3.13.0-rc.1'
51+
- python-version: '3.13'
5252
env:
5353
TOXENV: py
5454
steps:
5555
- uses: actions/checkout@v4
5656
- name: Install system libraries
57-
if: contains(matrix.python-version, 'pypy') || contains(matrix.python-version, 'beta')
57+
if: contains(matrix.python-version, 'pypy')
5858
run: |
5959
sudo apt-get update
6060
sudo apt-get install libxml2-dev libxslt-dev

.github/workflows/publish.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
- name: Set up Python
1111
uses: actions/setup-python@v5
1212
with:
13-
python-version: 3.12
13+
python-version: 3.13
1414
- name: Install dependencies
1515
run: |
1616
python -m pip install --upgrade pip

.pre-commit-config.yaml

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
default_language_version:
2-
python: python3.12
2+
python: python3.13
33
repos:
4+
- hooks:
5+
- id: bandit
6+
args: [-r, -c, .bandit.yml]
7+
repo: https://github.com/PyCQA/bandit
8+
rev: 1.7.10
49
- hooks:
510
- id: black
611
language_version: python3
712
repo: https://github.com/ambv/black
8-
rev: 24.8.0
13+
rev: 24.10.0
914
- hooks:
1015
- id: isort
1116
language_version: python3

docs/conf.py

-9
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
import sys
1515
from os import path
1616

17-
import sphinx_rtd_theme
18-
1917
# If your extensions are in another directory, add it here. If the directory
2018
# is relative to the documentation root, use os.path.abspath to make it
2119
# absolute, like shown here.
@@ -108,13 +106,6 @@
108106
# documentation.
109107
# html_theme_options = {}
110108

111-
# Add any paths that contain custom themes here, relative to this directory.
112-
# Add path to the RTD explicitly to robustify builds (otherwise might
113-
# fail in a clean Debian build env)
114-
115-
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
116-
117-
118109
# The style sheet to use for HTML and HTML Help pages. A file of that name
119110
# must exist either in Sphinx' static/ path, or in one of the custom paths
120111
# given in html_static_path.

itemloaders/processors.py

+1
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ def __call__(self, values: Any) -> Any:
159159
for value in values:
160160
if value is not None and value != "":
161161
return value
162+
return None
162163

163164

164165
class Identity:

pylintrc

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
[MASTER]
2+
ignore=typing
3+
persistent=no
4+
5+
[MESSAGES CONTROL]
6+
disable=broad-exception-caught,
7+
c-extension-no-member,
8+
consider-using-f-string,
9+
disallowed-name,
10+
duplicate-code,
11+
fixme,
12+
import-error,
13+
import-outside-toplevel,
14+
invalid-name,
15+
line-too-long,
16+
missing-class-docstring,
17+
missing-function-docstring,
18+
missing-module-docstring,
19+
no-else-return,
20+
no-member,
21+
not-callable,
22+
parse-error,
23+
protected-access,
24+
raise-missing-from,
25+
redefined-builtin,
26+
redefined-outer-name,
27+
too-few-public-methods,
28+
too-many-arguments,
29+
too-many-lines,
30+
too-many-positional-arguments,
31+
too-many-public-methods,
32+
unidiomatic-typecheck,
33+
unused-argument,
34+
use-a-generator,
35+
wrong-import-order,
36+
wrong-import-position,

setup.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from setuptools import find_packages, setup
22

3-
with open("README.rst") as f:
3+
with open("README.rst", encoding="utf-8") as f:
44
long_description = f.read()
55

66
setup(
@@ -30,7 +30,6 @@
3030
"Operating System :: OS Independent",
3131
"Programming Language :: Python",
3232
"Programming Language :: Python :: 3",
33-
"Programming Language :: Python :: 3.8",
3433
"Programming Language :: Python :: 3.9",
3534
"Programming Language :: Python :: 3.10",
3635
"Programming Language :: Python :: 3.11",
@@ -39,7 +38,7 @@
3938
"Programming Language :: Python :: Implementation :: CPython",
4039
"Programming Language :: Python :: Implementation :: PyPy",
4140
],
42-
python_requires=">=3.8",
41+
python_requires=">=3.9",
4342
install_requires=[
4443
# before updating these versions, be sure they are not higher than
4544
# scrapy's requirements

tests/test_base_loader.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ def validate_sku(value):
4141
# Let's assume a SKU is only digits.
4242
if value.isdigit():
4343
return value
44+
return None
4445

4546
class MyLoader(ItemLoader):
4647
name_out = Compose(lambda vs: vs[0]) # take first which allows empty values
@@ -278,10 +279,11 @@ class CustomItemLoader(ItemLoader):
278279

279280
il = CustomItemLoader()
280281
il.add_value("name", ["$10"])
282+
expected_exc = None
281283
try:
282284
float("$10")
283285
except Exception as e:
284-
expected_exc_str = str(e)
286+
expected_exc = e
285287

286288
exc = None
287289
try:
@@ -293,7 +295,7 @@ class CustomItemLoader(ItemLoader):
293295
assert "name" in s, s
294296
assert "$10" in s, s
295297
assert "ValueError" in s, s
296-
assert expected_exc_str in s, s
298+
assert str(expected_exc) in s, s
297299

298300
def test_output_processor_using_classes(self):
299301
il = CustomItemLoader()

tests/test_output_processor.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class TestOutputProcessorDict(unittest.TestCase):
99
def test_output_processor(self):
1010
class TempDict(Dict[str, Any]):
1111
def __init__(self, *args, **kwargs):
12-
super(TempDict, self).__init__(self, *args, **kwargs)
12+
super().__init__(*args, **kwargs)
1313
self.setdefault("temp", 0.3)
1414

1515
class TempLoader(ItemLoader):

tests/test_select_jmes.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ class SelectJmesTestCase(unittest.TestCase):
1818
}
1919

2020
def test_output(self):
21-
for key in self.test_list_equals:
22-
expr, test_list, expected = self.test_list_equals[key]
21+
for key, value in self.test_list_equals.items():
22+
expr, test_list, expected = value
2323
test = SelectJmes(expr)(test_list)
2424
self.assertEqual(
2525
test, expected, msg=f"test {key!r} got {test} expected {expected}"

tox.ini

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = py38,py39,py310,py311,py312
2+
envlist = py39,py310,py311,py312,py313
33

44
[testenv]
55
deps =
@@ -61,3 +61,10 @@ deps =
6161
pre-commit
6262
commands =
6363
pre-commit run {posargs:--all-files}
64+
65+
[testenv:pylint]
66+
deps =
67+
{[testenv]deps}
68+
pylint==3.3.1
69+
commands =
70+
pylint docs itemloaders tests setup.py

0 commit comments

Comments
 (0)