mr-proper
Static Python code analyzer, that tries to check if functions in code are pure or not and why.
What it is and what it does
mr. Proper analyzes Python function definitions via AST inspection to assess whether they conform to a set of purity heuristics: no blacklisted calls (like print), no global state access, no argument mutation, no local imports, no forbidden argument types (like ORM objects), and only calls to other pure functions. It provides both a CLI tool and a programmatic API (is_function_pure) to report violations.
The tool is explicitly experimental and acknowledges edge cases—functions marked pure may not actually be pure, but the analysis tends to identify cleaner code. It requires fully type-annotated functions and no dynamic calls. With an abandoned status since 2021 and no active maintenance, it is suitable only for exploratory code quality checks or legacy codebases where the tool was already integrated.
Use it for:
- Audit existing Python codebases to identify which functions have no side effects and could be refactored for testability.
- Enforce functional programming patterns in a team by checking that utility functions remain pure during code review.
- Detect accidental use of global state or ORM objects in functions intended to be pure calculations.
- Analyze legacy code to find candidates for memoization or parallelization based on purity guarantees.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
mr. Proper is a static code analyzer that examines Python functions to determine whether they are pure—free from side effects, global state mutations, and forbidden operations—and reports why they fail purity checks.
No, unless you are maintaining legacy code that already uses it. The project is archived and unmaintained since 2021, with no bug fixes or Python version updates forthcoming. The purity heuristics are experimental and produce false positives. For new projects, consider actively maintained alternatives instead.
Install
mr-proper on PyPI
pip
pip install mr-properuv
uv add mr-properpoetry
poetry add mr-properInstalling mr-proper
Before you install
Low install friction with four lightweight runtime dependencies. However, the project is archived and abandoned since 2021, so maintenance and bug fixes are not expected.
License in practice
MIT license permits free use, modification, and distribution with minimal restrictions, making it safe to use in most projects without legal concern.
Quickstart
pip install mr_proper
import ast
from mr_proper.utils import is_function_pure
funcdef = ast.parse('def add_one(n: int) -> int:\n return n + 1').body[0]
is_function_pure(funcdef)
Functions must be fully type-annotated; no dynamic calls supported.
Verify before relying
- How accurately the purity heuristics identify truly pure functions in practice, given the disclaimer about edge cases and false positives.
- Whether the tool remains compatible with Python versions beyond 3.9 despite being last released in 2021.
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — click, setuptools, stdlib-list, typing-extensions |
| Maintenance | abandoned — 1,752 days since the last release |
| Last repo commit | (repository archived) |
| First released | |
| Downloads | 360,139/month — #7,246 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: mr_proper-0.0.7-py3-none-any.whl
Keywords: static-analyzer, pure-function
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
flawfinderFlawfinder scans C/C++ source code to identify…
copyleft · top 15,000 on PyPI
flake8-functionsA flake8 extension that enforces function-level…
permissive · top 15,000 on PyPI
uncalledDetects unused functions in Python projects…
permissive · top 15,000 on PyPI
lizardLizard analyzes code complexity and detects…
permissive · top 5,000 on PyPI
benigetBeniget performs compile-time analysis on…
permissive · top 15,000 on PyPI
cpplintCpplint is a command-line static code checker…
permissive · top 15,000 on PyPI
purifyA decorator that makes object-mutating…
permissive · top 15,000 on PyPI
reorder-python-importsAutomatically reorders Python imports into a…
permissive · top 15,000 on PyPI
ast-decompilerConverts Python abstract syntax trees (ASTs)…
permissive · top 15,000 on PyPI
luaparserParses Lua source code into an abstract syntax…
permissive · top 15,000 on PyPI