Skip to main content

Linter for Machine Learning projects

Project description

mllint — Linter for Machine Learning projects

GitHub Workflow Status GitHub go.mod Go version Code coverage Platform

PyPI PyPI - Status PyPI - Downloads - Daily PyPI - Downloads - Monthly PyPI - Python Version

mllint is a command-line utility to evaluate the quality of Machine Learning (ML) projects by means of static analysis of the project's repository. It measures the project's adherence to ML best practices, as collected and deduced from SE4ML and Google's Rules for ML.


Installing mllint

mllint is compiled for Linux, MacOS and Windows, both 64 and 32 bit x86 (except MacOS), as well as 64-bit ARM on Linux and MacOS (Apple M1).

mllint is published to PyPI, so it can be installed using pip:

pip install mllint

Running mllint

To run mllint in its default configuration, use one of the following commands:

# Run `mllint` on the project in the current folder
mllint

# Run `mllint` on the project in projects/my-ml-project
mllint projects/my-ml-project

Of course, feel free to explore mllint help for more information about its commands.

mllint will analyse your project and create a Markdown-formatted report of its analysis. By default, this will be pretty printed to your terminal.

If you instead prefer to export the raw Markdown text to a file, use the --output or -o flag and provide a filename. Using - as the filename prints the raw Markdown directly to your terminal.

# Prints the Markdown-formatted report of your project to 'report.md'
mllint --output report.md

# Prints the raw Markdown report to your terminal
mllint -o -

See docs/example-report.md for an example of a report that mllint generates.

Linters and rules

To list all available or all enabled linting rules, use one of the following commands:

# List all available (implemented) linting rules
mllint list all

# List only the enabled rules for the project in the current folder.
mllint list enabled

# or for a project in projects/my-ml-project
mllint list enabled projects/my-ml-project

To learn more about a certain rule or category, use mllint describe along with the slug of the category or rule. The slug is the lowercased, dashed text that is often or always displayed next to the category or rule. This is the same slug as you use to enable or disable rules.

As an example:

# Describe the Version Control category. This will also list the rules that it checks.
mllint describe version-control

# Describe the rule on DVC usage in the Version Control category
mllint describe version-control/data/dvc

Configuration

YAML

mllint can be configured using a .mllint.yml file that should be placed at the root of the project directory. This is a YAML file in which you can configure specific settings for various linting rules, as well as disable specific rules or even entire categories if you wish.

An example .mllint.yml that disables some rules looks as follows:

rules:
  disabled:
    - version-control/code/git
    - dependency-management/single

TOML

Alternatively, if no .mllint.yml exists, mllint searches the pyproject.toml file in the root of the project for a [tool.mllint] section. TOML has a slightly different syntax, but the structure is otherwise the same as the config in the YAML file. The example below is identical to the YAML example above.

[tool.mllint]
[tool.mllint.rules]
disabled = ["version-control/code/git", "dependency-management/single"]

Here are some useful commands related to configuration:

# Print the configuration of the project in the current folder
mllint config

# Print the configuration of the project in projects/my-ml-project
mllint config projects/my-ml-project

# Print the default configuration (unless there's a folder called 'default' in the current dir)
mllint config default

# Create a valid `.mllint.yml` file with the default configuration
mllint config default -q > .mllint.yml

Getting Started (development)

Clone this repository and run go run . in the root of this repository.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mllint-0.5.0.tar.gz (4.7 MB view hashes)

Uploaded Source

Built Distributions

mllint-0.5.0-pp37-pypy37_pp73-win32.whl (4.8 MB view hashes)

Uploaded PyPy Windows x86

mllint-0.5.0-pp37-pypy37_pp73-manylinux2010_x86_64.whl (4.8 MB view hashes)

Uploaded PyPy manylinux: glibc 2.12+ x86-64

mllint-0.5.0-pp37-pypy37_pp73-macosx_10_9_x86_64.whl (4.9 MB view hashes)

Uploaded PyPy macOS 10.9+ x86-64

mllint-0.5.0-pp36-pypy36_pp73-win32.whl (4.8 MB view hashes)

Uploaded PyPy Windows x86

mllint-0.5.0-pp36-pypy36_pp73-manylinux2010_x86_64.whl (4.8 MB view hashes)

Uploaded PyPy manylinux: glibc 2.12+ x86-64

mllint-0.5.0-pp36-pypy36_pp73-macosx_10_9_x86_64.whl (4.9 MB view hashes)

Uploaded PyPy macOS 10.9+ x86-64

mllint-0.5.0-cp39-cp39-win_amd64.whl (4.8 MB view hashes)

Uploaded CPython 3.9 Windows x86-64

mllint-0.5.0-cp39-cp39-win32.whl (4.8 MB view hashes)

Uploaded CPython 3.9 Windows x86

mllint-0.5.0-cp39-cp39-manylinux2010_x86_64.whl (4.8 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

mllint-0.5.0-cp39-cp39-manylinux2010_i686.whl (4.4 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.12+ i686

mllint-0.5.0-cp39-cp39-manylinux1_x86_64.whl (4.8 MB view hashes)

Uploaded CPython 3.9

mllint-0.5.0-cp39-cp39-manylinux1_i686.whl (4.4 MB view hashes)

Uploaded CPython 3.9

mllint-0.5.0-cp39-cp39-macosx_11_0_arm64.whl (4.9 MB view hashes)

Uploaded CPython 3.9 macOS 11.0+ ARM64

mllint-0.5.0-cp39-cp39-macosx_10_9_x86_64.whl (4.9 MB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

mllint-0.5.0-cp38-cp38-win_amd64.whl (4.8 MB view hashes)

Uploaded CPython 3.8 Windows x86-64

mllint-0.5.0-cp38-cp38-win32.whl (4.8 MB view hashes)

Uploaded CPython 3.8 Windows x86

mllint-0.5.0-cp38-cp38-manylinux2010_x86_64.whl (4.8 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

mllint-0.5.0-cp38-cp38-manylinux2010_i686.whl (4.4 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.12+ i686

mllint-0.5.0-cp38-cp38-manylinux1_x86_64.whl (4.8 MB view hashes)

Uploaded CPython 3.8

mllint-0.5.0-cp38-cp38-manylinux1_i686.whl (4.4 MB view hashes)

Uploaded CPython 3.8

mllint-0.5.0-cp38-cp38-macosx_10_9_x86_64.whl (4.9 MB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

mllint-0.5.0-cp37-cp37m-win_amd64.whl (4.8 MB view hashes)

Uploaded CPython 3.7m Windows x86-64

mllint-0.5.0-cp37-cp37m-win32.whl (4.8 MB view hashes)

Uploaded CPython 3.7m Windows x86

mllint-0.5.0-cp37-cp37m-manylinux2010_x86_64.whl (4.8 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64

mllint-0.5.0-cp37-cp37m-manylinux2010_i686.whl (4.4 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.12+ i686

mllint-0.5.0-cp37-cp37m-manylinux1_x86_64.whl (4.8 MB view hashes)

Uploaded CPython 3.7m

mllint-0.5.0-cp37-cp37m-manylinux1_i686.whl (4.4 MB view hashes)

Uploaded CPython 3.7m

mllint-0.5.0-cp37-cp37m-macosx_10_9_x86_64.whl (4.9 MB view hashes)

Uploaded CPython 3.7m macOS 10.9+ x86-64

mllint-0.5.0-cp36-cp36m-win_amd64.whl (4.8 MB view hashes)

Uploaded CPython 3.6m Windows x86-64

mllint-0.5.0-cp36-cp36m-win32.whl (4.8 MB view hashes)

Uploaded CPython 3.6m Windows x86

mllint-0.5.0-cp36-cp36m-manylinux2010_x86_64.whl (4.8 MB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.12+ x86-64

mllint-0.5.0-cp36-cp36m-manylinux2010_i686.whl (4.4 MB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.12+ i686

mllint-0.5.0-cp36-cp36m-manylinux1_x86_64.whl (4.8 MB view hashes)

Uploaded CPython 3.6m

mllint-0.5.0-cp36-cp36m-manylinux1_i686.whl (4.4 MB view hashes)

Uploaded CPython 3.6m

mllint-0.5.0-cp36-cp36m-macosx_10_9_x86_64.whl (4.9 MB view hashes)

Uploaded CPython 3.6m macOS 10.9+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page