freezing-fall-2672
09/07/2023, 10:08 AM[tool.ruff]
in pyproject.toml
already, or is this maybe different due to the experimantel status of it?happy-kitchen-89482
09/07/2023, 12:32 PMpants.backend.experimental.python.lint.ruff
to your backend_packages
freezing-fall-2672
09/07/2023, 1:12 PMfreezing-fall-2672
09/07/2023, 1:15 PMhappy-kitchen-89482
09/07/2023, 1:17 PMhappy-kitchen-89482
09/07/2023, 1:17 PMhappy-kitchen-89482
09/07/2023, 1:17 PMfreezing-fall-2672
09/07/2023, 1:19 PMfreezing-fall-2672
09/07/2023, 1:20 PM[tool.ruff]
# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".mypy_cache",
".nox",
".pants.d",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
"edmmp/service_a/service_a/settings.py",
]
# Same as Django and Black.
line-length = 88
# Assume Python 3.11
target-version = "py311"
[tool.isort]
profile = "black"
line_length = 88
freezing-fall-2672
09/07/2023, 1:20 PMfreezing-fall-2672
09/07/2023, 1:21 PMpants lint ::
15:21:03.94 [INFO] Completed: Format with Black - black made no changes.
15:21:03.94 [INFO] Completed: Format with isort - isort made no changes.
15:21:04.34 [ERROR] Completed: Lint with ruff - ruff failed (exit code 1).
edmmp/service_a/service_a/settings.py:90:89: E501 Line too long (91 > 88 characters)
Found 1 error.
15:21:04.34 [INFO] Completed: Fix with ruff - ruff --fix made no changes.
15:21:04.39 [ERROR] Completed: Lint with Flake8 - flake8 failed (exit code 1).
Partition: ['CPython==3.11.*']
edmmp/service_a/service_a/settings.py:23:80: E501 line too long (81 > 79 characters)
edmmp/service_a/service_a/settings.py:90:80: E501 line too long (91 > 79 characters)
edmmp/service_a/service_a/settings.py:93:80: E501 line too long (81 > 79 characters)
edmmp/service_a/service_a/settings.py:96:80: E501 line too long (82 > 79 characters)
edmmp/service_a/service_a/settings.py:99:80: E501 line too long (83 > 79 characters)
edmmp/util/settings_for_tests.py:26:80: E501 line too long (80 > 79 characters)
✓ black succeeded.
✕ flake8 failed.
✓ isort succeeded.
✕ ruff failed.
✓ ruff --fix succeeded.
happy-kitchen-89482
09/07/2023, 1:22 PMhappy-kitchen-89482
09/07/2023, 1:22 PM--keep-sandboxes=always
and inspect the sandboxhappy-kitchen-89482
09/07/2023, 1:22 PMfreezing-fall-2672
09/07/2023, 1:23 PMhappy-kitchen-89482
09/07/2023, 1:23 PM__run.sh
) and modify the cmd line to see if you can figure out what's going onhappy-kitchen-89482
09/07/2023, 1:23 PMhappy-kitchen-89482
09/07/2023, 1:23 PMhappy-kitchen-89482
09/07/2023, 1:23 PMfreezing-fall-2672
09/07/2023, 1:24 PMfreezing-fall-2672
09/07/2023, 1:26 PMfind . -name '__run.sh'
after running pants lint :: --keep-sandboxes=always
happy-kitchen-89482
09/07/2023, 1:26 PMhappy-kitchen-89482
09/07/2023, 1:27 PMfreezing-fall-2672
09/07/2023, 1:27 PMfreezing-fall-2672
09/07/2023, 1:27 PMfreezing-fall-2672
09/07/2023, 1:28 PMcat __run.sh --style=plain
#!/usr/bin/env bash
# This command line should execute the same process as pants did internally.
cd /private/var/folders/ll/98hnvg_n5l3by0224q_qybc40000gn/T/pants-sandbox-oaUH8r
env -i PEX_EXTRA_SYS_PATH=__plugins ./flake8.pex_pex_shim.sh $'--jobs=8' edmmp/service_a/app_a/__init__.py edmmp/service_a/app_a/admin.py edmmp/service_a/app_a/apps.py edmmp/service_a/app_a/conftest.py edmmp/service_a/app_a/models.py edmmp/service_a/app_a/tests/test_views.py edmmp/service_a/app_a/urls.py edmmp/service_a/app_a/views.py edmmp/service_a/service_a/__init__.py edmmp/service_a/service_a/asgi.py edmmp/service_a/service_a/settings.py edmmp/service_a/service_a/urls.py edmmp/service_a/service_a/wsgi.py edmmp/util/settings_for_tests.py
freezing-fall-2672
09/07/2023, 1:29 PMfreezing-fall-2672
09/07/2023, 1:30 PMhappy-kitchen-89482
09/07/2023, 1:30 PMfreezing-fall-2672
09/07/2023, 1:30 PMhappy-kitchen-89482
09/07/2023, 1:30 PMhappy-kitchen-89482
09/07/2023, 1:30 PMfreezing-fall-2672
09/07/2023, 1:30 PMfreezing-fall-2672
09/07/2023, 1:31 PM<https://github.com/pantsbuild/pants>
?happy-kitchen-89482
09/07/2023, 1:31 PMhappy-kitchen-89482
09/07/2023, 1:31 PMhappy-kitchen-89482
09/07/2023, 1:31 PMfreezing-fall-2672
09/07/2023, 1:34 PMfreezing-fall-2672
09/07/2023, 1:34 PMfreezing-fall-2672
09/07/2023, 1:35 PMhappy-kitchen-89482
09/07/2023, 5:25 PMenough-analyst-54434
09/08/2023, 4:12 AMenough-analyst-54434
09/08/2023, 4:31 AMhappy-kitchen-89482
09/08/2023, 5:16 AMhappy-kitchen-89482
09/08/2023, 5:24 AMedmmp/service_a/service_a/settings.py:90:89: E501 Line too long (91 > 88 characters)
, so it is picking up your config (that is where the 88 comes from). For some reason the exclude is not taking effect, but you should debug that outside of Pants, by running ruff directly, to see if your config file is valid in the first place.happy-kitchen-89482
09/08/2023, 5:33 AMhappy-kitchen-89482
09/08/2023, 5:34 AM--force-exclude
to the command line, which we don't (https://beta.ruff.rs/docs/settings/#force-exclude)rhythmic-morning-87313
09/08/2023, 4:40 PMruff
in my repo:
https://github.com/lablup/backend.ai/blob/main/pants.toml#L9
https://github.com/lablup/backend.ai/blob/main/pyproject.toml#L69-L89
You may refer the repo settings!rhythmic-morning-87313
09/08/2023, 4:43 PMflake8
+ isort
with ruff
, while keeping black
. As black
takes care of the line length enforcements with a few exceptions, it is recommended to disable `ruff`'s own line length check by ignoring E501
.rhythmic-morning-87313
09/08/2023, 4:47 PMpants fix
, but not with pants fmt
.rhythmic-morning-87313
09/08/2023, 4:48 PMpants lint
but it has no effects because it seems to modify the pex env's copied source files, while pants fix
properly updates the original source files.freezing-fall-2672
09/09/2023, 4:30 PMenough-analyst-54434
09/09/2023, 4:38 PMfreezing-fall-2672
09/09/2023, 4:41 PM