A python documentation linter which checks that the docstring description matches the definition.

Overview

Build Status

Darglint

A functional docstring linter which checks whether a docstring's description matches the actual function/method implementation. Darglint expects docstrings to be formatted using the Google Python Style Guide, or Sphinx Style Guide, or Numpy Style Guide.

Feel free to submit an issue/pull request if you spot a problem or would like a feature in darglint.

Table of Contents:

Installation

To install darglint, use pip.

pip install darglint

Or, clone the repository, cd to the directory, and

pip install .

Configuration

darglint can be configured using a configuration file. The configuration file must be named either .darglint, setup.cfg, or tox.ini. It must also have a section starting with the section header, [darglint]. Finally, the configuration file must be located either in the directory darglint is called from, or from a parent directory of that working directory.

Currently, the configuration file allows us to ignore errors, to specify message templates, to specify the strictness of checks and to ignore common exceptions.

Error Configuration

If we would like to ignore ExcessRaiseErrors (because we know that an underlying function will raise an exception), then we would add its error code to a file named .darglint:

[darglint]
ignore=DAR402

We can ignore multiple errors by using a comma-separated list:

[darglint]
ignore=DAR402,DAR103

Instead of specifying error codes to ignore in general one can also specify a regex to exclude certain function names from tests. For example, the following configuration would disable linting on all private methods.

[darglint]
ignore_regex=^_(.*)

Message Template Configuration

If we would like to specify a message template, we may do so as follows:

[darglint]
message_template={msg_id}@{path}:{line}

Which will produce a message such as [email protected]:72.

Finally, we can specify the docstring style type using docstring_style ("google" by default):

[darglint]
docstring_style=sphinx

Strictness Configuration

Strictness determines how lax darglint will be when checking docstrings. There are three levels of strictness available:

  • short: One-line descriptions are acceptable; anything more and the docstring will be fully checked.

  • long: One-line descriptions and descriptions without arguments/returns/yields/etc. sections will be allowed. Anything more, and the docstring will be fully checked.

  • full: (Default) Docstrings will be fully checked.

For example, if we have the following function:

def double(x):
    # <docstring>
    return x * 2

Then the following table describes which errors will be raised for each of the docstrings (rows) when checked against each of the configurations (columns):

┌──────────────────────────────┬──────────────────┬────────────────┬──────────────────┐
│ Docstring                    │  short           │  long          │  full            │
├──────────────────────────────┼──────────────────┼────────────────┼──────────────────┤
│ """Doubles the argument."""  │ None             │ None           │ Missing argument │
│                              │                  │                │ Missing return   │
│                              │                  │                │                  │
│                              │                  │                │                  │
├──────────────────────────────┼──────────────────┼────────────────┼──────────────────┤
│ """Doubles the argument.     │ Missing argument │ None           │ Missing argument │
│                              │ Missing return   │                │ Missing return   │
│ Not very pythonic.           │                  │                │                  │
│                              │                  │                │                  │
│ """                          │                  │                │                  │
│                              │                  │                │                  │
├──────────────────────────────┼──────────────────┼────────────────┼──────────────────┤
│ """Doubles the argument.     │ Missing return   │ Missing return │ Missing return   │
│                              │                  │                │                  │
│ Args:                        │                  │                │                  │
│     x: The number to double. │                  │                │                  │
│                              │                  │                │                  │
│ """                          │                  │                │                  │
└──────────────────────────────┴──────────────────┴────────────────┴──────────────────┘

In short, if you want to be able to have single-line docstrings, and check all other docstrings against their described parameters, you would specify

[darglint]
strictness=short

In your configuration file.

Ignoring common exceptions

We can specify a list of exceptions that don't need to be documented in the raises section of a docstring. For example,

[darglint]
ignore_raise=ValueError,MyCustomError

Logging

When darglint fails unexpectedly, you can try to gather more information when submitting a bug by running with logging. For example,

darglint --log-level=INFO unexpected_failures.py

Darglint accepts the levels, DEBUG, INFO, WARNING, ERROR, and CRITICAL.

Usage

Command Line use

Given a python source file, serializers.py, you would check the docstrings as follows:

darglint serializers.py

You can give an optional verbosity setting to darglint. For example,

darglint -v 2 *.py

Would give a description of the error along with information as to this specific instance. The default verbosity is 1, which gives the filename, function name, line number, error code, and some general hints.

To use an arbitrary error format, you can pass a message template, which is a python format string. For example, if we pass the message template

darglint -m "{path}:{line} -> {msg_id}" darglint/driver.py

Then we would get back error messages like

darglint/driver.py :61 -> DAR101

The following attributes can be passed to the format string:

  • line: The line number,
  • msg: The error message,
  • msg_id: The error code,
  • obj: The function/method name,
  • path: The relative file path.

The message template can also be specified in the configuration file as the value message_template.

darglint is particularly useful when combined with the utility, find. This allows us to check all of the files in our project at once. For example, when eating my own dogfood (as I tend to do), I invoke darglint as follows:

find . -name "*.py" | xargs darglint

Where I'm searching all files ending in ".py" recursively from the current directory, and calling darglint on each one in turn.

Ignoring Errors in a Docstring

You can ignore specific errors in a particular docstring. The syntax is much like that of pycodestyle, etc. It generally takes the from of:

# noqa: <error> <argument>

Where <error> is the particular error to ignore (DAR402, or DAR201 for example), and <argument> is what (if anything) the ignore statement refers to (if nothing, then it is not specified).

Let us say that we want to ignore a missing return statement in the following docstring:

def we_dont_want_a_returns_section():
  """Return the value, 3.

  # noqa: DAR201

  """
  return 3

We put the noqa anywhere in the top level of the docstring. However, this won't work if we are missing something more specific, like a parameter. We may not want to ignore all missing parameters, either, just one particular one. For example, we may be writing a function that takes a class instance as self. (Say, in a bound celery task.) Then we would do something like:

def a_bound_function(self, arg1):
  """Do something interesting.

  Args:
    arg1: The first argument.

  # noqa: DAR101 arg1

  """
  arg1.execute(self)

So, the argument comes to the right of the error.

We may also want to mark excess documentation as being okay. For example, we may not want to explicitly catch and raise a ZeroDivisionError. We could do the following:

def always_raises_exception(x):
    """Raise a zero division error or type error.o

    Args:
      x: The argument which could be a number or could not be.

    Raises:
      ZeroDivisionError: If x is a number.  # noqa: DAR402
      TypeError: If x is not a number.  # noqa: DAR402

    """
    x / 0

So, in this case, the argument for noqa is really all the way to the left. (Or whatever description we are parsing.) We could also have put it on its own line, as # noqa: DAR402 ZeroDivisionError.

Type Annotations

Darglint parses type annotations in docstrings, and can, optionally, compare the documented type to the actual type annotation. This can be useful when migrating a codebase to use type annotations.

In order to make these comparisons, Darglint only accepts types accepted by Python (see PEP 484.) That is, it does not accept parentheses in type signatures. (If parentheses are used in the type signature, Darglint will mark that argument as missing. See Issue #90.)

Error Codes

  • DAR001: The docstring was not parsed correctly due to a syntax error.
  • DAR002: An argument/exception lacks a description
  • DAR003: A line is under-indented or over-indented.
  • DAR004: The docstring contains an extra newline where it shouldn't.
  • DAR005: The item contains a type section (parentheses), but no type.
  • DAR101: The docstring is missing a parameter in the definition.
  • DAR102: The docstring contains a parameter not in function.
  • DAR103: The docstring parameter type doesn't match function.
  • DAR104: (disabled) The docstring parameter has no type specified
  • DAR105: The docstring parameter type is malformed.
  • DAR201: The docstring is missing a return from definition.
  • DAR202: The docstring has a return not in definition.
  • DAR203: The docstring parameter type doesn't match function.
  • DAR301: The docstring is missing a yield present in definition.
  • DAR302: The docstring has a yield not in definition.
  • DAR401: The docstring is missing an exception raised.
  • DAR402: The docstring describes an exception not explicitly raised.
  • DAR501: The docstring describes a variable which is not defined.

The number in the hundreds narrows the error by location in the docstring:

  • 000: Syntax, formatting, and style
  • 100: Args section
  • 200: Returns section
  • 300: Yields section
  • 400: Raises section
  • 500: Variables section

You can enable disabled-by-default exceptions in the configuration file using the enable option. It accepts a comma-separated list of error codes.

[darglint]
enable=DAR104

Scope

Darglint's primary focus is to identify incorrect and missing documentationd of a function's signature. Checking style is a stretch goal, and is supported on a best-effort basis. Darglint does not check stylistic preferences expressed by tools in the Python Code Quality Authority (through tools such as pydocstyle). So when using Darglint, it may be a good idea to also use pydocstyle, if you want to enforce style. (For example, pydocstyle requires the short summary to be separated from other sections by a line break. Darglint makes no such check.)

Sphinx

Darglint can handle sphinx-style docstrings, but imposes some restrictions on top of the Sphinx style. For example, all fields (such as :returns:) must be the last items in the docstring. They must be together, and all indents should be four spaces. These restrictions may be loosened at a later date.

To analyze Sphinx-style docstrings, pass the style flag to the command:

darglint -s sphinx example.py
darglint --docstring-style sphinx example.py

Alternatively, you can specify the style in the configuration file using the setting, "docstring_style":

[darglint]
docstring_style=sphinx

Numpy

Darglint now has an initial implementation for Numpy-style docstrings. Similarly to Sphinx-style docstrings, you can pass a style flag to the command:

darglint -s numpy example.py
darglint --docstring-style numpy example.py

Or set it in a configuration file:

[darglint]
docstring_style=numpy

The numpy parser and error reporter are not yet fully stabilized. Add issues or suggestions to the tracking bug, Issue #69.

Integrations

Flake8

Darglint can be used in conjunction with Flake8 as a plugin. The only setup necessary is to install Flake8 and Darglint in the same environment. Darglint will pull its configuration from Flake8. So, if you would like to lint Sphinx-style comments, then you should have docstring_style=sphinx in a Flake8 configuration file in the project directory. The settings would be entered under the flake8 configuration, not a separate configuration for Darglint. E.g.:

[flake8]
strictness=short
docstring_style=sphinx

To see which options are exposed through Flake8, you can check the Flake8 tool:

flake8 --help | grep --before-context=2 Darglint

SublimeLinter

A plugin for SublimeLinter can be found here

Pre-commit

Download pre-commit and install it. Once it is installed, add this to .pre-commit-config.yaml in your repository:

repos:
-   repo: https://github.com/terrencepreilly/darglint
    rev: master
    hooks:
    - id: darglint

Then run pre-commit install and you're ready to go. Before commiting, darglint will be run on the staged files. If it finds any errors, the user is notified and the commit is aborted. Store necessary configuration (such as error formatting) in .darglint, setup.cfg or tox.ini.

Roadmap

Below are some of the current features or efforts. Where a milestone or issue is associated with the idea, it will be mentioned. Some of these ideas are moonshots and may not get implemented. They are ordered roughly according to current priority/feasibility.

  • Expose command-line options through sphinx.
  • Robust logging for errors caused/encountered by darglint.
  • Check class docstrings (See Issue #25).
  • Autoformatting docstrings. (See Milestone #3).
  • Optional aggressive style checking through command line flag.
  • ALE support.
  • Syntastic support. (Syntastic is not accepting new checkers until their next API stabilizes, so this may take some time.)

Development and Contributions

Development Setup

Install darglint. First, clone the repository:

git clone https://github.com/terrencepreilly/darglint.git

cd into the directory, create a virtual environment (optional), then setup:

cd darglint/
virtualenv -p python3.6 .env
source .env/bin/activate
pip install -e .

You can install dependencies using

pip install poetry
poetry install

You can run the tests using

python setup.py test

Or, install pytest manually, cd to the project's root directory, and run

pytest

This project tries to conform by the styles imposed by pycodestyle and pydocstyle, as well as by darglint itself.

A dockerfile exists for testing with Python3.4. Although it's not officially supported (only 3.6+), it's nice to try to make minor version numbers support it. You would build the dockerfile and test using something like

pushd docker-build
docker build -t darglint-34 -f Dockerfile.test34 .
popd
docker run -it --rm -v $(pwd):/code darglint-34 pytest

Contribution

If you would like to tackle an issue or feature, email me or comment on the issue to make sure it isn't already being worked on. Contributions will be accepted through pull requests. New features should include unit tests, and, of course, properly formatted documentation.

Also, check out the wiki prior to updating the grammar. It includes a description of darglint's parsing pipline.

Comments
  • Ignore return, yield and raises checks in abstractmethods

    Ignore return, yield and raises checks in abstractmethods

    Ignore some checks in abstract methods to avoid false positives.

    A function is considered abstract if it is decorated with @abstractmethod,
    and considered pure if it has "no implementation".
    
    Since Python does not have entirely empty functions, all functions which contain
    one of the following (and possibly a docstring) are considered empty
    
     - ... (Ellipsis)
     - pass
     - raise NotImplementedException
     - return NotImplementedException
     - only a docstring
    

    Closes #54

    opened by maltevesper 12
  • Consistency with flake8-docstrings and flake8-rst-docstrings

    Consistency with flake8-docstrings and flake8-rst-docstrings

    There are quite popular tools to lint existing docstrings:

    • flake8-docstrings
    • flake8-rst-docstrings

    It would be awesome to have a note in the README if this project is compatible with them or not.

    It would be also awesome to include a test of some kind if they should be compatible.

    documentation 
    opened by sobolevn 12
  • Feature: support ast type hints subscript

    Feature: support ast type hints subscript

    Hello, and thank you for dev Darglint 🙂 This Pr is intended to allow more complicated types hints to be detected for parameters and return. (With "[") Ex: List[int], Union[int, str], ....

    Solution :

    Ex: test.py

    def fib(self, a: List[int], b: int) -> List[int]:
            """Fibo.
    
            Parameters
            ----------
            a : List[str]
                the first number
            b : int
                the second number
    
            Returns
            -------
            List[str]
                the fibo resut
            """
            return a
    
    original_darglint test.py  
    // no error
    darglint test.py  
    // test.py:fib:0: DAR103:  ~a: expected List[int] but was List[str]
    // test.py:fib:0: DAR203:  ~Return: expected List[int] but was List[str]
    
    opened by lucasiscovici2 10
  • pre-commit hook is broken

    pre-commit hook is broken

    Support for pre-commit was merged in #43. However, I can't get it to work.

    When running pre-commit run --all-files (and not having darglint installed, yet), it fetches the darglint repository and installs it, but then errors out with:

    Executable darglint not found

    The requirements on the pre-commit project say:

    The hook repository must be installable via pip install . (usually by either setup.py or pyproject.toml). The installed package will provide an executable that will match the entry – usually through console_scripts or scripts in setup.py.

    I'm not really familiar with publishing a package, but indeed when I do pip install . in a clone of this repository, it does not install any darglint binary. Is there something wrong with how the project gets installed through pip?

    On a side-note: pre-commit reports the used version as 1.0.0a1, I guess it fetches this from pyproject.toml where it is specified as 1.0.0-alpha.1. Also, pre-commit says that darglint requires Python 3.7, which it probably also picks up from the dependencies in pyproject.toml. These should be corrected to match Python 3.5 as in setup.py, correct?

    All these issues are fixed when I delete the pyproject.toml file, which makes pip fall back to setup.py, which sets the correct version information and installs the darglint binary. Is the pyproject.toml file maybe not used anymore by this project?

    bug 
    opened by nioncode 10
  • Usage question: short docstring vs full-docstring

    Usage question: short docstring vs full-docstring

    Hi, thanks for this project! It is awesome!

    My question is about two different modes of docstrings that I use in my apps. I can either write a short one like:

    class SimpleViolation(BaseViolation):
        """Violation for cases where there's no associated nodes."""
    
        _node: None
    
        def __init__(self, node=None, text: Optional[str] = None) -> None:
            """Creates new instance of simple style violation."""
            super().__init__(node, text=text)
    

    Or full one like here:

    class BaseViolation(object):
        """
        Abstract base class for all style violations.
    
        It basically just defines how to create any error and how to format
        this error later on.
    
        Each subclass must define ``error_template`` and ``code`` fields.
    
        Attributes:
            error_template: message that will be shown to user after formatting.
            code: violation unique number. Used to identify the violation.
    
        """
    
        error_template: ClassVar[str]
        code: ClassVar[int]
    
        def __init__(self, node: ErrorNode, text: Optional[str] = None) -> None:
            """
            Creates new instance of abstract violation.
    
            Parameters:
                node: violation was raised by this node. If applied.
                text: extra text to format the final message. If applied.
    
            """
            self._node = node
            self._text = text
    

    Full source here: https://github.com/wemake-services/wemake-python-styleguide/blob/master/wemake_python_styleguide/violations/base.py

    The problem is that I get an error from the short version:

    ./wemake_python_styleguide/violations/base.py:168:1: I101 Missing parameter(s) in Docstring: - text
    ./wemake_python_styleguide/violations/base.py:168:1: I101 Missing parameter(s) in Docstring: - node
    

    What do I suggest? Allow short docstring (= docstrings without ANY arguments/returns/raises/etc declarations) or require to write a full one (in case ANY formatters are found). It might be a configuration option turned off by default.

    How does it sound to you?

    enhancement 
    opened by sobolevn 9
  • DAR402 wrongly reported on bare raise

    DAR402 wrongly reported on bare raise

    With this code, I get Excess exception(s) in Raises section: +r TypeErrorflake8(DAR402) with darglint 1.5.5 via flake8:

    """Test."""
    
    from somewhere import y, z
    
    
    def x():
        """Do stuff.
    
        Raises:
            TypeError: wrong type
        """
        try:
            y()
        except TypeError as err:
            z(err)
            raise
    

    I feel this is wrong, as I am inside of x() indeed re-raising TypeError.

    Related:

    • https://github.com/terrencepreilly/darglint/issues/102
    • https://github.com/terrencepreilly/darglint/commit/4c615c9d054f6f17ba75f210fc72c0e7490b7d9e
    bug 
    opened by fredrikaverpil 8
  • False Positive for DAR103 with optional arguments

    False Positive for DAR103 with optional arguments

    It appears that optional arguments are generating a false positive alert on DAR103. For example, this function:

    def a_fn(x: str = "default"):
        """Summary.
    
        Args:
            x (str, optional): Val. Defaults to "default".
        """
        pass
    

    generates:

    >> darglint function_file.py
    function_file.py:a_fn:5: DAR103:  ~x: expected str but was str, optional
    

    I think this is a repeat of #1 but as that issue was closed, I've created a new one.

    duplicate 
    opened by diabolical-ninja 8
  • Wrong expected type in numpy format

    Wrong expected type in numpy format

    In the following signature (using numpy mode), I get the error src/edges_cal/cal_coefficients.py:from_load_name:609: DAR103: ~load_name: expected str but was int

    Is this an instability in the numpy format?

    @classmethod
        def from_load_name(
            cls,
            load_name: str,
            direc: [str, Path],
            run_num: Optional[int] = None,
            filetype: Optional[str] = None,
            **kwargs,
        ):
            """Instantiate the class from a given load name and directory.
    
            Parameters
            ----------
            load_name : str
                The load name (one of 'ambient', 'hot_load', 'open' or 'short').
            direc : str or Path
                The top-level calibration observation directory.
            run_num : int
                The run number to use for the spectra.
            filetype : str
                The filetype to look for (acq or h5).
            kwargs :
                All other arguments to :class:`LoadSpectrum`.
    
            Returns
            -------
            :class:`LoadSpectrum`.
            """
    
    bug 
    opened by steven-murray 8
  • `darglint` overlaps with `flake8-pep3101` in some error codes

    `darglint` overlaps with `flake8-pep3101` in some error codes

    darglint overlaps with flake8-pep3101 in some error codes: https://github.com/gforcada/flake8-pep3101

    S001: Describes that something went wrong in parsing the docstring.
    S002: An argument/exception lacks a description.
    

    I suggest to use DAL, ARG, or any other three letter codes for issues. flake8 supports it and the overlap chance is minimal.

    bug 
    opened by sobolevn 8
  • [BUG] Broken flake8 integration in v1.5.0

    [BUG] Broken flake8 integration in v1.5.0

    After upgrading, flake8 started reporting a lot of violations that are not reported when running it directly. It seems that it no longer respects its own config location when used with flake8

    bug 
    opened by webknjaz 7
  • DAR401 false positive

    DAR401 false positive

    
    
    def false_positive() -> None:
        """summary
    
        :raises ValueError: description
        """
        try:
            raise ValueError("233")
        except ValueError as e:
            raise e from None
    
    
    DAR401 Missing exception(s) in Raises section: -r e
    
    bug 
    opened by trim21 7
  • Bump certifi from 2021.10.8 to 2022.12.7

    Bump certifi from 2021.10.8 to 2022.12.7

    Bumps certifi from 2021.10.8 to 2022.12.7.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Essential project URLs missing from packaging metadata

    Essential project URLs missing from packaging metadata

    It was not a please to have to google to find where the codebase of this python package is located at.

    https://pypi.org/project/darglint/ page does not list any links to project url, source code url, issue tracker url, while all of these are perfectly supported by packaging metadata.

    opened by ssbarnea 0
  • Set Python to >=3.6 Instead of ^3.6

    Set Python to >=3.6 Instead of ^3.6

    Since darglint has its python version set to ^3.6, all downstream projects that use poetry have to set their python versions to ^3.6/>=3.6,<4.0. While this doesn't necessarily cause any issues, it would be nice to be able to leave the version range open by using >=3.6.

    opened by rbebb 1
  • DAR202 throws false positive excess returns

    DAR202 throws false positive excess returns

    Sphinx Docstring Style:

    """Called when :py:meth:`~mymod.MyClass.my_method` raises an error.
    
    The scheduler uses the output of this method to determine
    whether the command should be immediately interrupted.
    
    :param exc_type: The type of exception raised.
    :type exc_type: :py:class:`Type`
    :param exc: The exception raised.
    :type exc: :py:class:`Exception`
    :param traceback: The frame traceback of the error.
    :type traceback: :py:class:`Traceback`
    
    :return: `True` to indicate the error is handled. All other
        returns to the scheduler will be interpreted as the command
        needing to be immediately interrupted.
    :rtype: bool
    """
    

    CLI Output: DAR202 Excess "Returns" in Docstring: + return

    I believe it is picking up on my "returns to the scheduler" statement.

    opened by JulianOrteil 0
Owner
Terrence Reilly
Terrence Reilly
The strictest and most opinionated python linter ever!

wemake-python-styleguide Welcome to the strictest and most opinionated python linter ever. wemake-python-styleguide is actually a flake8 plugin with s

wemake.services 2.1k Jan 1, 2023
It's not just a linter that annoys you!

README for Pylint - https://pylint.pycqa.org/ Professional support for pylint is available as part of the Tidelift Subscription. Tidelift gives softwa

Python Code Quality Authority 4.4k Jan 4, 2023
Mylint - My really simple rendition of how a linter works.

mylint My really simple rendition of how a linter works. This original version was written for my AST article. Since then I've added tests and turned

Tushar Sadhwani 2 Dec 29, 2021
A simple program which checks Python source files for errors

Pyflakes A simple program which checks Python source files for errors. Pyflakes analyzes programs and detects various errors. It works by parsing the

Python Code Quality Authority 1.2k Dec 30, 2022
Flake8 plugin that checks import order against various Python Style Guides

flake8-import-order A flake8 and Pylama plugin that checks the ordering of your imports. It does not check anything else about the imports. Merely tha

Python Code Quality Authority 270 Nov 24, 2022
OpenStack Hacking Style Checks. Mirror of code maintained at opendev.org.

Introduction hacking is a set of flake8 plugins that test and enforce the OpenStack StyleGuide Hacking pins its dependencies, as a new release of some

Mirrors of opendev.org/openstack 224 Jan 5, 2023
A plugin for Flake8 that checks pandas code

pandas-vet pandas-vet is a plugin for flake8 that provides opinionated linting for pandas code. It began as a project during the PyCascades 2019 sprin

Jacob Deppen 146 Dec 28, 2022
Simple Python style checker in one Python file

pycodestyle (formerly called pep8) - Python style guide checker pycodestyle is a tool to check your Python code against some of the style conventions

Python Code Quality Authority 4.7k Jan 1, 2023
Optional static typing for Python 3 and 2 (PEP 484)

Mypy: Optional Static Typing for Python Got a question? Join us on Gitter! We don't have a mailing list; but we are always happy to answer questions o

Python 14.4k Jan 8, 2023
A Python Parser

parso - A Python Parser Parso is a Python parser that supports error recovery and round-trip parsing for different Python versions (in multiple Python

Dave Halter 520 Dec 26, 2022
Performant type-checking for python.

Pyre is a performant type checker for Python compliant with PEP 484. Pyre can analyze codebases with millions of lines of code incrementally – providi

Facebook 6.2k Jan 4, 2023
A static type analyzer for Python code

pytype - ?? ✔ Pytype checks and infers types for your Python code - without requiring type annotations. Pytype can: Lint plain Python code, flagging c

Google 4k Dec 31, 2022
Static type checker for Python

Static type checker for Python Speed Pyright is a fast type checker meant for large Python source bases. It can run in a “watch” mode and performs fas

Microsoft 9.2k Jan 3, 2023
Tool to check the completeness of MANIFEST.in for Python packages

check-manifest Are you a Python developer? Have you uploaded packages to the Python Package Index? Have you accidentally uploaded broken packages with

Marius Gedminas 270 Dec 26, 2022
Flake8 extension for checking quotes in python

Flake8 Extension to lint for quotes. Major update in 2.0.0 We automatically encourage avoiding escaping quotes as per PEP 8. To disable this, use --no

Zachary Heller 157 Dec 13, 2022
Check for python builtins being used as variables or parameters

Flake8 Builtins plugin Check for python builtins being used as variables or parameters. Imagine some code like this: def max_values(list, list2):

Gil Forcada Codinachs 98 Jan 8, 2023
flake8 plugin to run black for checking Python coding style

flake8-black Introduction This is an MIT licensed flake8 plugin for validating Python code style with the command line code formatting tool black. It

Peter Cock 146 Dec 15, 2022
Custom Python linting through AST expressions

bellybutton bellybutton is a customizable, easy-to-configure linting engine for Python. What is this good for? Tools like pylint and flake8 provide, o

H. Chase Stevens 249 Dec 31, 2022
Unbearably fast O(1) runtime type-checking in pure Python.

Look for the bare necessities, the simple bare necessities. Forget about your worries and your strife. — The Jungle Book.

beartype 1.4k Jan 1, 2023