Excessive mutability checking for Python. This is a Pylint plugin.
I have been learning Haskell and Gleam, but those are not languages that I use in production. The motivation behind this project is to see how far I can get adding functional constraints to Python and see what I can actually build.
matchexhaustiveness checker, ensuring that allmatchstatements have a_clause- It is recommended to use something like
assert_never(value)so that type checkers likemypypick up on any unmatched cases For example:Then runfrom purelint import assert_never def taker(v: Animal | None | int): """Check animal lint""" match v: case None: pass case Animal(): pass case int(): pass case _: assert_never(v)
mypyon your code. It will give you an error if you're not checking all cases.
- It is recommended to use something like
- Variable rebinding
- No augmented assignments
- No mutable methods
- No subscript assignment
- No deletes
- A
pipetool for immutable transformations on a data structure For example:from purelint import pipe sorted_after_deletes = pipe( build_tree(values), # start with tree lambda t: delete(t, 2), # delete 2 lambda t: delete(t, 5), # delete 5 inorder, # get sorted tuple )
With uv:
uv add --dev purelint
With pip:
pip install -U purelint
pylint --load-plugins=purelint example.py
With uv:
uv run pylint --load-plugins=purelint example.py
uv run pytest