Skip to content

Commit 226b5ab

Browse files
committed
Migrate pre-commit hook, pin versions in setup.py
1 parent 5ad0aa9 commit 226b5ab

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
@@ -418,6 +418,12 @@ def get_portability_package_data():
418418
python_requires=python_requires,
419419
# BEAM-8840: Do NOT use tests_require or setup_requires.
420420
extras_require={
421+
'dev': [
422+
'isort==7.0.0',
423+
'pyrefly==0.54.0',
424+
'ruff==0.15.7',
425+
'yapf==0.43.0',
426+
],
421427
'dill': [
422428
# Dill doesn't have forwards-compatibility guarantees within minor
423429
# 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
@@ -180,15 +180,12 @@ commands =
180180
[testenv:lint]
181181
# Don't set TMPDIR to avoid "AF_UNIX path too long" errors in pylint.
182182
setenv =
183-
# keep the version of pylint in sync with the 'rev' in .pre-commit-config.yaml
184183
deps =
185-
ruff==0.15.7
186-
isort==7.0.0
187-
pyrefly==0.54.0
188184
dask==2022.01.0
189185
distributed==2022.01.0
190186
extras =
191187
gcp
188+
dev
192189
commands =
193190
ruff --version
194191
time {toxinidir}/scripts/run_pylint.sh

0 commit comments

Comments
 (0)