Skip to content

Commit 2684530

Browse files
committed
Migrate pre-commit hook, pin versions in setup.py
1 parent b1a4e5b commit 2684530

4 files changed

Lines changed: 16 additions & 14 deletions

File tree

.agent/skills/python-development/SKILL.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,10 @@ Use `--requirements_file=requirements.txt` or custom containers.
176176
## Code Quality Tools
177177
```bash
178178
# Linting
179-
pylint apache_beam/
179+
ruff check apache_beam/
180180

181181
# Type checking
182-
mypy apache_beam/
182+
pyrefly check apache_beam/
183183

184184
# Formatting (via yapf)
185185
yapf -i apache_beam/file.py

.pre-commit-config.yaml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,11 @@ repos:
3131
sdks/python/apache_beam/portability/api/.*pb2.*.py
3232
)$
3333

34-
- repo: https://github.com/pycqa/pylint
35-
# this rev is a release tag in the repo above and corresponds with a pylint
36-
# version. make sure this matches the version of pylint in tox.ini.
37-
rev: v4.0.2
34+
- repo: https://github.com/astral-sh/ruff-pre-commit
35+
# this rev is a release tag in the repo above and corresponds with a ruff
36+
# version. make sure this matches the version of yapf in setup.py
37+
rev: v0.15.7
3838
hooks:
39-
- id: pylint
40-
args: ["--rcfile=sdks/python/.pylintrc"]
41-
files: ^sdks/python/apache_beam/
42-
exclude: *exclude
39+
- id: ruff-check
40+
files: "sdks/python/apache_beam"
41+
args: ["--config=sdks/python/ruff.toml"]

sdks/python/setup.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,12 @@ def get_portability_package_data():
424424
python_requires=python_requires,
425425
# BEAM-8840: Do NOT use tests_require or setup_requires.
426426
extras_require={
427+
'dev': [
428+
'isort==7.0.0',
429+
'pyrefly==0.54.0',
430+
'ruff==0.15.7',
431+
'yapf==0.43.0',
432+
],
427433
'dill': [
428434
# Dill doesn't have forwards-compatibility guarantees within minor
429435
# version. Pickles created with a new version of dill may not

sdks/python/tox.ini

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,15 +190,12 @@ commands =
190190
[testenv:lint]
191191
# Don't set TMPDIR to avoid "AF_UNIX path too long" errors in pylint.
192192
setenv =
193-
# keep the version of pylint in sync with the 'rev' in .pre-commit-config.yaml
194193
deps =
195-
ruff==0.15.7
196-
isort==7.0.0
197-
pyrefly==0.54.0
198194
dask==2022.01.0
199195
distributed==2022.01.0
200196
extras =
201197
gcp
198+
dev
202199
commands =
203200
ruff --version
204201
time {toxinidir}/scripts/run_pylint.sh

0 commit comments

Comments
 (0)