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.github.io and Google's Rules for ML.

TODO: write overview of linting rules or implement mllint describe <rule>


Getting Started


Installing mllint

mllint works on Linux, MacOS and Windows, and 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

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

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 disable specific rules / linters, as well as configure specific settings for various linters.

An example .mllint.yml looks as follows:

rules:
  disabled:
    - use-git # disables the 'use-git' linter
    - use-dependency-manager/single # disables the 'single' rule of the 'use-dependency-manager' linter.
    # - use-dependency-manager # this would disable the 'use-dependency-manager' linter and all of its rules entirely.

TOML

Alternatively, if no .mllint.yml exists, mllint can be configured from the pyproject.toml file in the root of the project. This should be done in the [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 = ["use-git", "use-dependency-manager/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.3.2.tar.gz (1.6 MB view hashes)

Uploaded Source

Built Distributions

mllint-0.3.2-pp37-pypy37_pp73-win32.whl (1.7 MB view hashes)

Uploaded PyPy Windows x86

mllint-0.3.2-pp37-pypy37_pp73-macosx_10_9_x86_64.whl (1.7 MB view hashes)

Uploaded PyPy macOS 10.9+ x86-64

mllint-0.3.2-pp36-pypy36_pp73-win32.whl (1.7 MB view hashes)

Uploaded PyPy Windows x86

mllint-0.3.2-pp36-pypy36_pp73-macosx_10_9_x86_64.whl (1.7 MB view hashes)

Uploaded PyPy macOS 10.9+ x86-64

mllint-0.3.2-cp39-cp39-win_amd64.whl (1.7 MB view hashes)

Uploaded CPython 3.9 Windows x86-64

mllint-0.3.2-cp39-cp39-win32.whl (1.7 MB view hashes)

Uploaded CPython 3.9 Windows x86

mllint-0.3.2-cp39-cp39-macosx_10_9_x86_64.whl (1.7 MB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

mllint-0.3.2-cp38-cp38-win_amd64.whl (1.7 MB view hashes)

Uploaded CPython 3.8 Windows x86-64

mllint-0.3.2-cp38-cp38-win32.whl (1.7 MB view hashes)

Uploaded CPython 3.8 Windows x86

mllint-0.3.2-cp38-cp38-macosx_10_9_x86_64.whl (1.7 MB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

mllint-0.3.2-cp37-cp37m-win_amd64.whl (1.7 MB view hashes)

Uploaded CPython 3.7m Windows x86-64

mllint-0.3.2-cp37-cp37m-win32.whl (1.7 MB view hashes)

Uploaded CPython 3.7m Windows x86

mllint-0.3.2-cp37-cp37m-macosx_10_9_x86_64.whl (1.7 MB view hashes)

Uploaded CPython 3.7m macOS 10.9+ x86-64

mllint-0.3.2-cp36-cp36m-win_amd64.whl (1.7 MB view hashes)

Uploaded CPython 3.6m Windows x86-64

mllint-0.3.2-cp36-cp36m-win32.whl (1.7 MB view hashes)

Uploaded CPython 3.6m Windows x86

mllint-0.3.2-cp36-cp36m-macosx_10_9_x86_64.whl (1.7 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