{"id":4368,"library":"lintrunner-adapters","title":"Lintrunner Adapters","description":"Lintrunner Adapters provides a collection of wrappers and tools that integrate various linters (like Black, Ruff, Pylint, Bandit, etc.) with the `lintrunner` framework. It enables unified linting across a project using a single configuration. The current version is 0.13.0, and releases are frequent, primarily adding new linter adapters or fixing issues with existing ones.","status":"active","version":"0.13.0","language":"python","source_language":"en","source_url":"https://github.com/justinchuby/lintrunner-adapters","tags":["linting","code quality","tooling","adapters","lintrunner","ruff","black","pylint"],"install":[{"cmd":"pip install lintrunner-adapters","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"This library provides adapters for the lintrunner framework itself.","package":"lintrunner","optional":false},{"reason":"Required if you plan to use the Black linter adapter. Each adapter depends on its respective linter.","package":"black","optional":true},{"reason":"Required if you plan to use the Ruff linter adapter. Each adapter depends on its respective linter.","package":"ruff","optional":true},{"reason":"Required if you plan to use the Pylint linter adapter. Each adapter depends on its respective linter.","package":"pylint","optional":true},{"reason":"Required if you plan to use the Bandit linter adapter. Each adapter depends on its respective linter.","package":"bandit","optional":true},{"reason":"Required if you plan to use the Docformatter linter adapter. Each adapter depends on its respective linter.","package":"docformatter","optional":true}],"imports":[{"wrong":"from lintrunner_adapters import RuffLinter","symbol":"LintMessage","correct":"from lintrunner_adapters import LintMessage"},{"wrong":"from lintrunner_adapters import RuffLinter","symbol":"LintSeverity","correct":"from lintrunner_adapters import LintSeverity"},{"wrong":"from lintrunner_adapters import RuffLinter","symbol":"add_default_options","correct":"from lintrunner_adapters import add_default_options"}],"quickstart":{"code":"import os\n\n# 1. Create a sample Python file to lint\npython_code = \"\"\"def foo ( x ):\\n  return x+1\\n\"\"\"\nwith open(\"test_file.py\", \"w\") as f:\n    f.write(python_code)\n\n# 2. Create a lintrunner.toml configuration (simulating user setup)\n# In a real project, this would be a file named `lintrunner.toml`\nlintrunner_toml_content = \"\"\"\n[linter.ruff]\nlinter_class = \"lintrunner_adapters.ruff_linter:RuffLinter\"\n\n[linter.black]\nlinter_class = \"lintrunner_adapters.black_linter:BlackLinter\"\nargs = [\"--check\", \"--diff\"]\n\"\"\"\nwith open(\"lintrunner.toml\", \"w\") as f:\n    f.write(lintrunner_toml_content)\n\n# 3. Ensure lintrunner and the linters are installed for this example to run\n# In a real setup, `pip install lintrunner ruff black` would be done.\n# We can't actually run lintrunner directly in this snippet, but demonstrate setup.\nprint(\"Created test_file.py and lintrunner.toml. To run, execute:\")\nprint(\"pip install lintrunner ruff black\")\nprint(\"lintrunner --config lintrunner.toml test_file.py\")\n\n# Clean up (optional, for standalone execution)\n# os.remove(\"test_file.py\")\n# os.remove(\"lintrunner.toml\")","lang":"python","description":"This quickstart demonstrates how to configure `lintrunner` to use adapters from `lintrunner-adapters`. You define linters in a `lintrunner.toml` file, specifying the `linter_class` as a string path to the adapter. You must install `lintrunner` and the underlying linters (e.g., `ruff`, `black`) separately. The example creates a `test_file.py` and `lintrunner.toml` locally, and then provides instructions on how to execute `lintrunner` to apply the configured linters."},"warnings":[{"fix":"Ensure all linters referenced in your `lintrunner.toml` are installed in your environment (e.g., `pip install ruff black pylint`).","message":"The `lintrunner-adapters` library itself does not install the underlying linters (e.g., `ruff`, `black`, `pylint`). You must explicitly install each linter that you intend to use via its respective adapter.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Keep `lintrunner-adapters` updated to the latest version to ensure compatibility with recent linter releases. Check release notes for specific compatibility information.","message":"Breaking changes in underlying linters (e.g., `ruff`, `black`) can cause adapters to behave unexpectedly or fail. `lintrunner-adapters` updates are typically released to maintain compatibility with new linter versions.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Update any scripts or CI configurations that use the `PylintLinter` to handle explicit errors rather than assuming silent failure. Inspect Pylint output for issues.","message":"The `PylintLinter` adapter changed its behavior to raise an error when Pylint fails, instead of failing silently. Scripts or CI pipelines that relied on silent failures might break.","severity":"breaking","affected_versions":">=0.12.2"},{"fix":"Ensure your environment is using Python 3.9 or a newer version (e.g., `python3.9 -m pip install lintrunner-adapters`).","message":"This library requires Python 3.9 or newer. Running with older Python versions will result in installation or runtime errors.","severity":"gotcha","affected_versions":"<0.12.0 (but >=0.12.0 explicitly requires it)"}],"env_vars":null,"search_vec":"'0.13.0':41 'across':30 'ad':47 'adapt':2,4,50,61 'bandit':20 'black':17,64 'code':58 'collect':7 'configur':36 'current':38 'enabl':27 'etc':21 'exist':55 'fix':52 'framework':25 'frequent':45 'integr':13 'issu':53 'like':16 'lint':29,57 'linter':15,49 'lintrunn':1,3,24,62 'new':48 'one':56 'primarili':46 'project':32 'provid':5 'pylint':19,65 'qualiti':59 'releas':43 'ruff':18,63 'singl':35 'tool':11,60 'unifi':28 'use':33 'various':14 'version':39 'wrapper':9","created_at":"2026-04-12T08:52:47.405142+00:00","updated_at":"2026-04-16T16:15:15.831227+00:00","problems":null,"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.14.1","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/justinchuby/lintrunner-adapters","docs":null,"changelog":null,"pypi":"https://pypi.org/project/lintrunner-adapters/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-07-03","last_verified":"2026-08-29","next_check":"2026-08-02","install_tag":null}}