Skip to content

Commit c50d1fd

Browse files
authored
Migrate to hatchling, bump tool versions (#100)
1 parent 12bda1f commit c50d1fd

File tree

11 files changed

+84
-69
lines changed

11 files changed

+84
-69
lines changed

.pre-commit-config.yaml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.11.2
3+
rev: v0.12.1
44
hooks:
5-
- id: ruff
5+
- id: ruff-check
66
args: [ --fix ]
77
- id: ruff-format
8+
- repo: https://github.com/adamchainz/blacken-docs
9+
rev: 1.19.1
10+
hooks:
11+
- id: blacken-docs
12+
additional_dependencies:
13+
- black==25.1.0
14+
- repo: https://github.com/pre-commit/pre-commit-hooks
15+
rev: v5.0.0
16+
hooks:
17+
- id: trailing-whitespace
18+
- repo: https://github.com/sphinx-contrib/sphinx-lint
19+
rev: v1.0.0
20+
hooks:
21+
- id: sphinx-lint

MANIFEST.in

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

docs/api-reference.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ API Reference
44
==================
55

66
.. autoclass:: itemloaders.ItemLoader
7-
:members:
7+
:members:

docs/built-in-processors.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ executed in order, to produce the final parsed value.
1414
Here is a list of all built-in processors:
1515

1616
.. automodule:: itemloaders.processors
17-
:members:
17+
:members:

docs/extending-loaders.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@ There are many other possible ways to extend, inherit and override your Item
4242
Loaders, and different Item Loaders hierarchies may fit better for different
4343
projects. ``itemloaders`` only provides the mechanism; it doesn't impose any specific
4444
organization of your Loaders collection - that's up to you and your project's
45-
needs.
45+
needs.

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ locations, using the :meth:`~ItemLoader.add_xpath` method. This is the
8181
data that will be assigned to the ``name`` field later.
8282

8383
Afterwards, similar calls are used for ``price`` field using a CSS selector with
84-
the :meth:`~ItemLoader.add_css` method, and finally the ``last_update`` field is
84+
the :meth:`~ItemLoader.add_css` method, and finally the ``last_update`` field is
8585
populated directly with a literal value
8686
(``today``) using a different method: :meth:`~ItemLoader.add_value`.
8787

itemloaders/processors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ class SelectJmes:
211211

212212
def __init__(self, json_path: str):
213213
self.json_path: str = json_path
214-
import jmespath.parser
214+
import jmespath.parser # noqa: PLC0415
215215

216216
self.compiled_path: jmespath.parser.ParsedResult = jmespath.compile(
217217
self.json_path

pyproject.toml

Lines changed: 55 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,62 @@
1+
[build-system]
2+
requires = ["hatchling>=1.27.0"]
3+
build-backend = "hatchling.build"
4+
5+
[project]
6+
name = "itemloaders"
7+
version = "1.3.2"
8+
description = "Base library for scrapy's ItemLoader"
9+
authors = [
10+
{ name = "Zyte", email = "[email protected]" },
11+
]
12+
readme = "README.rst"
13+
license = "BSD-3-Clause"
14+
license-files = ["LICENSE"]
15+
dependencies = [
16+
# before updating these versions, be sure they are not higher than
17+
# scrapy's requirements
18+
"itemadapter>=0.1.0",
19+
"jmespath>=0.9.5",
20+
"parsel>=1.5.0",
21+
]
22+
requires-python = ">=3.9"
23+
classifiers = [
24+
"Development Status :: 5 - Production/Stable",
25+
"Intended Audience :: Developers",
26+
"Programming Language :: Python",
27+
"Programming Language :: Python :: 3",
28+
"Programming Language :: Python :: 3.9",
29+
"Programming Language :: Python :: 3.10",
30+
"Programming Language :: Python :: 3.11",
31+
"Programming Language :: Python :: 3.12",
32+
"Programming Language :: Python :: 3.13",
33+
"Programming Language :: Python :: Implementation :: CPython",
34+
"Programming Language :: Python :: Implementation :: PyPy",
35+
"Operating System :: OS Independent",
36+
"Framework :: Scrapy",
37+
"Topic :: Internet :: WWW/HTTP",
38+
"Topic :: Software Development :: Libraries :: Python Modules",
39+
]
40+
41+
[project.urls]
42+
Homepage = "https://github.com/scrapy/itemloaders"
43+
Documentation = "https://itemloaders.readthedocs.io/"
44+
Source = "https://github.com/scrapy/itemloaders"
45+
Tracker = "https://github.com/scrapy/itemloaders/issues"
46+
"Release notes" = "https://itemloaders.readthedocs.io/en/latest/release-notes.html"
47+
48+
[tool.hatch.build.targets.sdist]
49+
include = [
50+
"/docs",
51+
"/itemloaders",
52+
"/tests",
53+
"/tox.ini",
54+
]
55+
156
[tool.bumpversion]
2-
current_version = "1.3.2"
357
commit = true
458
tag = true
559

6-
[[tool.bumpversion.files]]
7-
filename = "setup.py"
8-
960
[tool.coverage.run]
1061
branch = true
1162

setup.py

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

tests/test_nested_items.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def _test_item(self, item: Any) -> None:
1616

1717
def test_attrs(self):
1818
try:
19-
import attr
19+
import attr # noqa: PLC0415
2020
except ImportError:
2121
self.skipTest("Cannot import attr")
2222

@@ -28,7 +28,7 @@ class TestItem:
2828

2929
def test_dataclass(self):
3030
try:
31-
from dataclasses import dataclass
31+
from dataclasses import dataclass # noqa: PLC0415
3232
except ImportError:
3333
self.skipTest("Cannot import dataclasses.dataclass")
3434

@@ -43,7 +43,7 @@ def test_dict(self):
4343

4444
def test_scrapy_item(self):
4545
try:
46-
from scrapy import Field, Item
46+
from scrapy import Field, Item # noqa: PLC0415
4747
except ImportError:
4848
self.skipTest("Cannot import Field or Item from scrapy")
4949

0 commit comments

Comments
 (0)