Registry / testing / pylama

pylama

JSON →
library8.4.1pypypi✓ verified 85d ago

Pylama is a comprehensive code audit tool for Python. It acts as a wrapper, integrating various popular linters and checkers such as pycodestyle, pydocstyle, PyFlakes, Mccabe, Pylint, Radon, Mypy, and Vulture, to provide a unified interface for checking code quality. The current version is 8.4.1, and it receives updates periodically to support newer Python versions and linter functionalities.

pip install pylama
INSTALL
IMPORT
SIG · PYLAMA
P
pylama
testingpythonv8.4.1
Install
2.8s avg
Import
1301ms
Disk
83MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v8.4.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.980 runs
installs and imports cleanly · install 0.0s · import 0.843s · 85.4MB
glibc
py 3.103.980 runs
installs and imports cleanly · install 2.8s · import 0.718s · 84MB
83MB installed
● package 83MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

LOGGER
from pylama import LOGGER
from pylama.main import check_path
logging
from pylama import logging
from pylama.main import check_path

The primary way to use Pylama is via the command line, running `pylama` in your project's root or specifying files/directories. For programmatic use, you can import `check_path` and `parse_options` from `pylama.main` to analyze files and retrieve issues directly within Python code. This example demonstrates creating a temporary file with known issues, running `pylama` on it, and printing the reported errors.

import os import textwrap from pylama.main import check_path, parse_options # Create a dummy Python file to check file_content = textwrap.dedent(''' import os, sys def my_function(): x=10 # E225 missing whitespace around operator if x > 5: print("Hello") return "world" my_function() # W0612 unused variable 'x' ''') file_path = "./temp_pylama_test.py" with open(file_path, "w") as f: f.write(file_content) # Run pylama programmatically # Options can be passed as a dictionary options_dict = { 'linters': ['pycodestyle', 'pyflakes'], # Specify linters to use 'ignore': ['W0611'], # Ignore specific warnings, e.g., unused imports 'select': [] } # parse_options processes paths and dictionary options into an options object options = parse_options([file_path], **options_dict) errors = check_path(options) if errors: print(f"Found {len(errors)} issues in {file_path}:") for error in errors: print(f" {error.filename}:{error.lnum}:{error.col} [{error.type}] {error.text} [{error.linter}]") else: print(f"No issues found in {file_path}.") # Clean up the dummy file os.remove(file_path)
pylama --version
Debug
Known issues
breakingPylama dropped support for Python 2.x. It now requires Python 3.7 or newer. Older Python versions need Pylama 7.7.1 or earlier.
fix
Upgrade your Python environment to 3.7+ or pin Pylama to version <=7.7.1 for Python 2.x projects.
affects: >=8.0.5
breakingThe `--force` option, which allowed Pylama to check non-Python files, was removed. By default, Pylama now only checks Python files.
fix
Ensure you are only passing Python files to Pylama, or consider alternative tools for non-Python file auditing.
affects: >=8.1.4
gotchaWhen using the 'mccabe' linter, the argument for complexity was renamed from `complexity` to `max-complexity`.
fix
Update your Pylama configuration (e.g., `pylama.ini`) to use `max-complexity` instead of `complexity` for mccabe settings.
affects: >=8.1.4
gotchaPylama's integration with Pylint can be sensitive to Pylint's internal changes. Specifically, Pylint 2.8.0 temporarily removed `__pkginfo__.numversion`, causing issues with Pylama. While `numversion` was temporarily re-added in Pylint 2.8.1, ensure compatibility.
fix
Ensure you are using a compatible version of Pylint (e.g., Pylint >= 2.8.1) or explicitly install `pylama_pylint` if available for better integration.
affects: Pylama versions using Pylint <= 2.8.0
Upgrade
Version history
8.4.1latest on PyPI · released Aug 8, 2022
Audit
Dependencies
pycodestyleoptionalCore linter wrapped by Pylama
pydocstyleoptionalCore linter wrapped by Pylama
pyflakesoptionalCore linter wrapped by Pylama
mccabeoptionalCore linter wrapped by Pylama
pylintoptionalPopular linter wrapped by Pylama; often requires separate installation for full functionality.
radonoptionalCode complexity checker wrapped by Pylama
mypyoptionalOptional static type checker wrapped by Pylama, installed via `pylama[mypy]`
vultureoptionalDead code checker wrapped by Pylama
Agent activity
14 hits · last 30 days
node
12
Resources
pylama — pip install pylama · libregistry