Run pylint standalone instead of via pytest-pylint - #437
Conversation
pytest-pylint 0.21.0 (latest release) hardcodes the pre-pytest-7
pytest_collect_file(path, parent) hookimpl signature with no version
guard (unlike pytest-flakes, which already branches on pytest
version). pytest 9.0 finally removed the long-deprecated path
parameter (slated since 7.0, a premature removal in 8.1.0 was yanked),
so any pytest>=9 install now hits:
PluginValidationError: Argument(s) {'path'} are declared in the
hookimpl but can not be found in the hookspec
Upstream has a fix (carsongee/pytest-pylint#193, pathlib.Path in
hooks) merged to git but not yet released to PyPI, so pinning to it
would mean depending on an unversioned commit. Decoupling pylint from
pytest's plugin/collection API entirely avoids that dependency and
means this can't break again the next time pytest revs a hook
signature. .pylintrc already scopes to the obal package via
`ignore=docs,tests`, so `pylint --rcfile=.pylintrc obal` covers the
same files pytest-pylint was checking.
Verified with a fresh venv (pytest 9.1.1, pylint 4.0.6): full suite
171 passed, pylint clean.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
I wish I could tag the packaging group for review. |
And why can't you? |
|
In Not saying the one solution is better than the other, but we should probably use the same in both places? (The new pytest also broke other plugins if I recall correctly, even if not used here) |
I just can't. Github does not give me the option in the |
quoting from the PR description
So I'd consider stopping using this pytest plugin in obsah too. Would you like me to raise a PR in obsah too? |
Sounds good to me. |
pytest-pylint 0.21.0 hardcodes the pre-pytest-7 pytest_collect_file(path, parent) hookimpl signature with no version guard. pytest 9.0 removed the long-deprecated path parameter, so any environment resolving latest pytest fails at pytest_configure before a single test runs. The plugin looks effectively dead upstream: its pytest-9 compat fix was merged without a release, and a follow-up compat PR has sat open unaddressed. Decouple pylint from pytest's plugin/collection API entirely: run it as its own tox command. This lets pytest go back to unpinned/latest and removes the previous pytest<9.1.0 workaround pin. See theforeman/obal#437.
Summary
CI is currently broken on every PR (unrelated to their actual changes, e.g. #435):
build (3.9-3.13)fails withpytest-pylint0.21.0 (latest release on PyPI) hardcodes the pre-pytest-7pytest_collect_file(path, parent)hookimpl signature with no version guard (unlikepytest-flakes, which already branches on pytest version internally). pytest 9.0 finally removed the long-deprecatedpathparameter (slated for removal since 7.0; a premature removal in 8.1.0 was yanked and reverted), so any environment that resolves latestpytestnow fails atpytest_configure, before a single test runs.pytest-pylintlooks effectively dead upstream: carsongee/pytest-pylint's last commit was 2024-04-13 (over 2 years ago) — which is also the commit that merged carsongee/pytest-pylint#193 (pathlib.Pathin hooks, the actual fix for this) without ever cutting a release containing it. A follow-up pytest-9 compat PR (carsongee/pytest-pylint#196) has sat open and unaddressed since 2025-12-16. So there's no unpinned-pytest-compatible release to wait for, and pinning to their git HEAD would mean depending on an unmaintained, unversioned commit.Fix
Decouple pylint from pytest's plugin/collection API entirely instead: run it as its own
toxcommand rather than throughpytest --pylint. This keepspytestunpinned/latest and doesn't depend on the health ofpytest-pylintat all going forward..pylintrcalready scopes to theobalpackage viaignore=docs,tests, sopylint --rcfile=.pylintrc obalcovers the same filespytest-pylintwas checking.Verification
Fresh venv, latest everything (
pytest==9.1.1,pylint==4.0.6): full suite171 passed,pylintclean (10.00/10).No other tox/CI/docs config references
pytest-pylintor--pylint(checked.github/workflows/,requirements-test.txt, README/docs).