Skip to content

Commit e42775c

Browse files
authored
ci: update pre-commit hooks, fix linting, and refresh dependencies (#1385)
* ci: update pre-commit hooks and fix linting issues * Update Ruff version in pre-commit configuration to v0.15.1. * Add noqa comments to suppress specific linting warnings in various files. * Update regex patterns in test cases for better matching. * style: correct indentation in GitHub Actions workflow file * Adjusted indentation for the enable-cache option in the test.yml workflow file to ensure proper YAML formatting. * refactor: reorder imports in indexed_field.rs for clarity * Adjusted the order of imports in indexed_field.rs to improve readability and maintain consistency with project conventions. * build: update dependencies in Cargo.toml and Cargo.lock * Bump versions of several dependencies including tokio, pyo3-log, prost, uuid, and log to their latest releases. * Update Cargo.lock to reflect the changes in dependency versions. * style: format pyproject.toml for consistency * Adjusted formatting in pyproject.toml for improved readability by aligning lists and ensuring consistent indentation. * Updated dependencies and configuration settings for better organization. * style: remove noqa comments for import statements * Cleaned up import statements in multiple files by removing unnecessary noqa comments, enhancing code readability and maintaining consistency across the codebase. * style: simplify formatting in pyproject.toml * Streamlined list formatting in pyproject.toml for improved readability by removing unnecessary line breaks and ensuring consistent structure across sections. * No functional changes were made; the focus was solely on code style and organization.
1 parent 57a50fa commit e42775c

File tree

14 files changed

+78
-75
lines changed

14 files changed

+78
-75
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767
- name: Install dependencies
6868
uses: astral-sh/setup-uv@v7
6969
with:
70-
enable-cache: true
70+
enable-cache: true
7171

7272
# Download the Linux wheel built in the build workflow
7373
- name: Download pre-built Linux wheel

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ repos:
2222
- id: actionlint-docker
2323
- repo: https://github.com/astral-sh/ruff-pre-commit
2424
# Ruff version.
25-
rev: v0.9.10
25+
rev: v0.15.1
2626
hooks:
2727
# Run the linter.
2828
- id: ruff

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ protoc = ["datafusion-substrait/protoc"]
4242
substrait = ["dep:datafusion-substrait"]
4343

4444
[dependencies]
45-
tokio = { version = "1.47", features = [
45+
tokio = { version = "1.49", features = [
4646
"macros",
4747
"rt",
4848
"rt-multi-thread",
@@ -54,16 +54,16 @@ pyo3 = { version = "0.26", features = [
5454
"abi3-py310",
5555
] }
5656
pyo3-async-runtimes = { version = "0.26", features = ["tokio-runtime"] }
57-
pyo3-log = "0.13.2"
57+
pyo3-log = "0.13.3"
5858
arrow = { version = "57", features = ["pyarrow"] }
5959
arrow-select = { version = "57" }
6060
datafusion = { version = "52", features = ["avro", "unicode_expressions"] }
6161
datafusion-substrait = { version = "52", optional = true }
6262
datafusion-proto = { version = "52" }
6363
datafusion-ffi = { version = "52" }
64-
prost = "0.14.1" # keep in line with `datafusion-substrait`
64+
prost = "0.14.3" # keep in line with `datafusion-substrait`
6565
serde_json = "1"
66-
uuid = { version = "1.18", features = ["v4"] }
66+
uuid = { version = "1.21", features = ["v4"] }
6767
mimalloc = { version = "0.1", optional = true, default-features = false, features = [
6868
"local_dynamic_tls",
6969
] }
@@ -77,11 +77,11 @@ object_store = { version = "0.12.4", features = [
7777
"http",
7878
] }
7979
url = "2"
80-
log = "0.4.27"
80+
log = "0.4.29"
8181
parking_lot = "0.12"
8282

8383
[build-dependencies]
84-
prost-types = "0.14.1" # keep in line with `datafusion-substrait`
84+
prost-types = "0.14.3" # keep in line with `datafusion-substrait`
8585
pyo3-build-config = "0.26"
8686

8787
[lib]

pyproject.toml

Lines changed: 41 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ description = "Build and run queries against data"
2525
readme = "README.md"
2626
license = { file = "LICENSE.txt" }
2727
requires-python = ">=3.10"
28-
keywords = ["datafusion", "dataframe", "rust", "query-engine"]
28+
keywords = ["dataframe", "datafusion", "query-engine", "rust"]
2929
classifiers = [
3030
"Development Status :: 2 - Pre-Alpha",
3131
"Intended Audience :: Developers",
@@ -62,7 +62,7 @@ profile = "black"
6262
python-source = "python"
6363
module-name = "datafusion._internal"
6464
include = [{ path = "Cargo.lock", format = "sdist" }]
65-
exclude = [".github/**", "ci/**", ".asf.yaml"]
65+
exclude = [".asf.yaml", ".github/**", "ci/**"]
6666
# Require Cargo.lock is up to date
6767
locked = true
6868
features = ["substrait"]
@@ -77,19 +77,19 @@ select = ["ALL"]
7777
ignore = [
7878
"A001", # Allow using words like min as variable names
7979
"A002", # Allow using words like filter as variable names
80+
"A005", # Allow module named io
8081
"ANN401", # Allow Any for wrapper classes
8182
"COM812", # Recommended to ignore these rules when using with ruff-format
82-
"FIX002", # Allow TODO lines - consider removing at some point
8383
"FBT001", # Allow boolean positional args
8484
"FBT002", # Allow boolean positional args
85+
"FIX002", # Allow TODO lines - consider removing at some point
8586
"ISC001", # Recommended to ignore these rules when using with ruff-format
87+
"N812", # Allow importing functions as `F`
88+
"PD901", # Allow variable name df
89+
"PLR0913", # Allow many arguments in function definition
8690
"SLF001", # Allow accessing private members
8791
"TD002", # Do not require author names in TODO statements
8892
"TD003", # Allow TODO lines
89-
"PLR0913", # Allow many arguments in function definition
90-
"PD901", # Allow variable name df
91-
"N812", # Allow importing functions as `F`
92-
"A005", # Allow module named io
9393
]
9494

9595
[tool.ruff.lint.pydocstyle]
@@ -99,7 +99,7 @@ convention = "google"
9999
max-doc-length = 88
100100

101101
[tool.ruff.lint.flake8-boolean-trap]
102-
extend-allowed-calls = ["lit", "datafusion.lit"]
102+
extend-allowed-calls = ["datafusion.lit", "lit"]
103103

104104
# Disable docstring checking for these directories
105105
[tool.ruff.lint.per-file-ignores]
@@ -108,68 +108,69 @@ extend-allowed-calls = ["lit", "datafusion.lit"]
108108
"ARG",
109109
"BLE001",
110110
"D",
111-
"S101",
112-
"SLF",
113111
"PD",
112+
"PLC0415",
113+
"PLR0913",
114114
"PLR2004",
115+
"PT004",
115116
"PT011",
116117
"RUF015",
118+
"S101",
117119
"S608",
118-
"PLR0913",
119-
"PT004",
120+
"SLF",
120121
]
121122
"examples/*" = [
122-
"D",
123-
"W505",
124-
"E501",
125-
"T201",
126-
"S101",
127-
"PLR2004",
128123
"ANN001",
129124
"ANN202",
130-
"INP001",
125+
"D",
131126
"DTZ007",
127+
"E501",
128+
"INP001",
129+
"PLR2004",
132130
"RUF015",
131+
"S101",
132+
"T201",
133+
"W505",
133134
]
134135
"dev/*" = [
136+
"ANN001",
137+
"C",
135138
"D",
136139
"E",
137-
"T",
138-
"S",
140+
"ERA001",
141+
"EXE",
142+
"N817",
139143
"PLR",
140-
"C",
144+
"S",
141145
"SIM",
146+
"T",
142147
"UP",
143-
"EXE",
144-
"N817",
145-
"ERA001",
146-
"ANN001",
147148
]
148149
"benchmarks/*" = [
150+
"ANN001",
151+
"BLE",
149152
"D",
153+
"E",
154+
"ERA001",
155+
"EXE",
150156
"F",
151-
"T",
152-
"BLE",
153157
"FURB",
158+
"INP001",
154159
"PLR",
155-
"E",
156-
"TD",
157-
"TRY",
158160
"S",
159161
"SIM",
160-
"EXE",
162+
"T",
163+
"TD",
164+
"TRY",
161165
"UP",
162-
"ERA001",
163-
"ANN001",
164-
"INP001",
165166
]
166167
"docs/*" = ["D"]
167-
"docs/source/conf.py" = ["ERA001", "ANN001", "INP001"]
168+
"docs/source/conf.py" = ["ANN001", "ERA001", "INP001"]
168169

169170
[tool.codespell]
170-
skip = ["./target", "uv.lock", "./python/tests/test_functions.py"]
171+
skip = ["./python/tests/test_functions.py", "./target", "uv.lock"]
171172
count = true
172-
ignore-words-list = ["ans", "IST"]
173+
ignore-words-list = ["IST", "ans"]
173174

174175
[dependency-groups]
175176
dev = [
@@ -182,8 +183,8 @@ dev = [
182183
"pre-commit>=4.3.0",
183184
"pyarrow>=19.0.0",
184185
"pygithub==2.5.0",
185-
"pytest>=7.4.4",
186186
"pytest-asyncio>=0.23.3",
187+
"pytest>=7.4.4",
187188
"pyyaml>=6.0.3",
188189
"ruff>=0.9.1",
189190
"toml>=0.10.2",
@@ -196,6 +197,6 @@ docs = [
196197
"pickleshare>=0.7.5",
197198
"pydata-sphinx-theme==0.8.0",
198199
"setuptools>=75.3.0",
199-
"sphinx>=7.1.2",
200200
"sphinx-autoapi>=3.4.0",
201+
"sphinx>=7.1.2",
201202
]

python/datafusion/expr.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
See :ref:`Expressions` in the online documentation for more details.
2121
"""
2222

23+
# ruff: noqa: PLC0415
24+
2325
from __future__ import annotations
2426

2527
from collections.abc import Iterable, Sequence

python/datafusion/user_defined.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -583,11 +583,11 @@ def from_pycapsule(func: AggregateUDFExportable | _PyCapsule) -> AggregateUDF:
583583
AggregateUDF that is exported via the FFI bindings.
584584
"""
585585
if _is_pycapsule(func):
586-
aggregate = cast(AggregateUDF, object.__new__(AggregateUDF))
586+
aggregate = cast("AggregateUDF", object.__new__(AggregateUDF))
587587
aggregate._udaf = df_internal.AggregateUDF.from_pycapsule(func)
588588
return aggregate
589589

590-
capsule = cast(AggregateUDFExportable, func)
590+
capsule = cast("AggregateUDFExportable", func)
591591
name = str(capsule.__class__)
592592
return AggregateUDF(
593593
name=name,

python/tests/test_catalog.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ def test_exception_not_mangled(ctx: SessionContext):
248248

249249
schema.register_table("test_table", create_dataset())
250250

251-
with pytest.raises(ValueError, match="^test_table is not an acceptable name$"):
251+
with pytest.raises(ValueError, match=r"^test_table is not an acceptable name$"):
252252
ctx.sql(f"select * from {catalog_name}.{schema_name}.test_table")
253253

254254

python/tests/test_dataframe.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2790,7 +2790,7 @@ def test_write_parquet_with_options_encoding(tmp_path, encoding, data_types, res
27902790
def test_write_parquet_with_options_unsupported_encoding(df, tmp_path, encoding):
27912791
"""Test that unsupported Parquet encodings do not work."""
27922792
# BaseException is used since this throws a Rust panic: https://github.com/PyO3/pyo3/issues/3519
2793-
with pytest.raises(BaseException, match="Encoding .*? is not supported"):
2793+
with pytest.raises(BaseException, match=r"Encoding .*? is not supported"):
27942794
df.write_parquet_with_options(tmp_path, ParquetWriterOptions(encoding=encoding))
27952795

27962796

python/tests/test_functions.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -303,31 +303,31 @@ def py_flatten(arr):
303303
lambda data: [np.concatenate([arr, arr]) for arr in data],
304304
),
305305
(
306-
lambda col: f.array_dims(col),
306+
f.array_dims,
307307
lambda data: [[len(r)] for r in data],
308308
),
309309
(
310-
lambda col: f.array_distinct(col),
310+
f.array_distinct,
311311
lambda data: [list(set(r)) for r in data],
312312
),
313313
(
314-
lambda col: f.list_distinct(col),
314+
f.list_distinct,
315315
lambda data: [list(set(r)) for r in data],
316316
),
317317
(
318-
lambda col: f.list_dims(col),
318+
f.list_dims,
319319
lambda data: [[len(r)] for r in data],
320320
),
321321
(
322322
lambda col: f.array_element(col, literal(1)),
323323
lambda data: [r[0] for r in data],
324324
),
325325
(
326-
lambda col: f.array_empty(col),
326+
f.array_empty,
327327
lambda data: [len(r) == 0 for r in data],
328328
),
329329
(
330-
lambda col: f.empty(col),
330+
f.empty,
331331
lambda data: [len(r) == 0 for r in data],
332332
),
333333
(
@@ -343,11 +343,11 @@ def py_flatten(arr):
343343
lambda data: [r[0] for r in data],
344344
),
345345
(
346-
lambda col: f.array_length(col),
346+
f.array_length,
347347
lambda data: [len(r) for r in data],
348348
),
349349
(
350-
lambda col: f.list_length(col),
350+
f.list_length,
351351
lambda data: [len(r) for r in data],
352352
),
353353
(
@@ -391,11 +391,11 @@ def py_flatten(arr):
391391
lambda data: [[i + 1 for i, _v in enumerate(r) if _v == 1.0] for r in data],
392392
),
393393
(
394-
lambda col: f.array_ndims(col),
394+
f.array_ndims,
395395
lambda data: [np.array(r).ndim for r in data],
396396
),
397397
(
398-
lambda col: f.list_ndims(col),
398+
f.list_ndims,
399399
lambda data: [np.array(r).ndim for r in data],
400400
),
401401
(
@@ -415,11 +415,11 @@ def py_flatten(arr):
415415
lambda data: [np.insert(arr, 0, 99.0) for arr in data],
416416
),
417417
(
418-
lambda col: f.array_pop_back(col),
418+
f.array_pop_back,
419419
lambda data: [arr[:-1] for arr in data],
420420
),
421421
(
422-
lambda col: f.array_pop_front(col),
422+
f.array_pop_front,
423423
lambda data: [arr[1:] for arr in data],
424424
),
425425
(

0 commit comments

Comments
 (0)