Skip to main content

mlpylint

A static code analyzer tool for identifying ml-specific code smells.

Description

MLpylint is a static code analyzer designed specifically for Python applications. Drawing from extensive research in the field of ML-specific code smells, MLpylint focuses on identifying ML-specific issues in your code. This assists in enhancing the readability, maintainability, and efficiency of your ML codebase, ensuring it adheres to best practices in the field of artificial intelligence and machine learning software development.

Getting started

The project structure is organized into three main components:

  1. Code Smell Checkers: These are the core of our tool, designed to identify specific code smells in your Python scripts.

  2. Test Scripts: Each code smell checker comes with an associated test script. These are used to validate the functionality of each checker, ensuring it correctly identifies its corresponding code smell.

  3. Code Smell Test Files: These are Python scripts that contain examples of code smells. They serve as practical test cases for the code smell checkers, helping to ensure that the checkers are accurately identifying the intended code smells.

This organization allows for easy identification of different aspects of the tool, facilitating testing, extension, and maintenance.

Installation

cd mlpylint
py -m venv venv
source venv/Scripts/activate
pip install -e .[dev]

Update PyPI Package

=== Token required from PyPI ===
Create .pypirc file in C:\Users\<user_name> with pypi token parameters

=== In project root dir ===
py -m pip install --upgrade pip
py -m pip install --upgrade build
py -m build
py -m pip install --upgrade twine
py -m twine upload dist/*

Usage

$ mlpylint --help                          # View tool options
$ mlpylint <path>                          # Check for code smells (CS)
$ mlpylint -a,  --advice <path>            # Check for code smells (CS) and include advisory results (CSA)
$ mlpylint -ls, --list-smells              # List all available code smells
$ mlpylint -ds, --describe-smell <id>      # Get code smell description by id
$ mlpylint -c,  --color <path>             # Enable colorized analysis output

Analysis assumptions:

  • Imports and ImportFrom are done at the top of the .py file. It is considered a best practice to put all import statements at the top of a Python file. This makes it easier to read and understand the dependencies of the file, and can help prevent issues with circular imports.

Author

Peter Hamfelt - [peter.hamfelt@gmail.com, pehd16@student.bth.se]

Acknowledgements

This work is inspired by and built upon the research conducted by the following individuals:

  • Haiyin Zhang from AI for Fintech Research, ING, Amsterdam, Netherlands.
  • Luís Cruz from Delft University of Technology, Delft, Netherlands.
  • Arie van Deursen from Delft University of Technology, Delft, Netherlands.

Their contribution towards identifying and categorizing "Code Smells for Machine Learning Applications" has played a crucial role in the development of this tool. I would like to express my deepest gratitude for their pioneering work in this field.

Research link: https://arxiv.org/abs/2203.13746

License

MIT License

Metadata

Release files for mlpylint 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mlpylint 0.0.3
File Size Uploaded Provenance
mlpylint-0.0.3.tar.gz 37.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mlpylint 0.0.3
File Interpreter ABI Platform
mlpylint-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 109.0 kB

Release files / mlpylint-0.0.3.tar.gz

Download URL mlpylint-0.0.3.tar.gz
Size 37.7 kB
Tags Source
SHA-256 checksum
How to use checksums
5422be5f3c31c0444458dbb2f9acfc184ab644beafdfbf149dbcc563d99db770
BLAKE2b-256 checksum
How to use checksums
efae2b8d647ac0c6bfad18f8cbc3ea420bd6cf62682d72a29c69b827a8cb0814
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.2

Release files / mlpylint-0.0.3-py3-none-any.whl

Download URL mlpylint-0.0.3-py3-none-any.whl
Size 71.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a65b3ca35bf0c7afda5f94f569d93292bc14b2628fde848ccdadf52192d9115e
BLAKE2b-256 checksum
How to use checksums
41d3b026eeb037eb2f5c497c5f0a7ea754a500fbfc18217a76a7021e34d8af5b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.2

Security for mlpylint 0.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page