Skip to content

Repository files navigation

flake8_tensors

pyversion PyPI - License

flake8 plugin which recommends some tricks for machine learning codes.

Installation

The plugin requires python3.10+.

Using UV (recommended)

Run flake8 with the plugin without installation:

uvx --with flake8-tensors flake8 .

Or install as a UV tool:

uv tool install flake8 --with flake8-tensors

Using pip

Alternatively, install with pip:

pip install flake8_tensors --upgrade

Usage

After the code is installed, call flake8 on your project. The plugin emits warning messages with "WT" prefix, e.g. WT100.

The messages meant to refer my opinionated best practices, or cool projects, like einops, opt_einsum, Adabelief, etc.

If you don't understand a warning, open a ticket, and i will clarify it. If you have suggestions, let me know. And of course, if you find a false positive, share the problematic snippet. (False positives are absolutely possible, actually, quite easy to make one. But assuming reasonable developer practices, like not calling your variable as "BatchNorm3d", the false positive rate should be low.)

About

No description, website, or topics provided.

Resources

Stars

5 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages