mypy plugin for loguru

Overview

loguru-mypy

A fancy plugin to boost up your logging with loguru

GitHub Workflow Status (branch) Open Source Helpers PyPI PyPI - Downloads time tracker Checked with mypy

mypy compatibility

logoru-mypy should be compatible with mypy>=0.770. Currently there is no limit as far as the compatibility can go. If you are interested to see how far loguru_mypy goes you can visit CI/CD action and check its matrix.

Installation

Simply execute:

pip install loguru-mypy

And later on modify your mypy.ini configuration file with

[mypy]
plugins = loguru_mypy

That is all, your code is now ready to be linted.

What is included?

loguru-mypy is obviously a mypy plugin that allows to avoid some of those little runtime trickeries :). Here is a short attempt to list some of those:

Lazy loggers

logger.opt(lazy=True) in facts returns a logger that we call lazy. Lazy loggers accept only typing.Callable[[], t.Any] in place of positional or named arguments. Passing a callable that accepts even a single argument thus results in runtime error. loguru-mypy detects that fact and lets you know before your runtime reaches that portion of a code.

Comments
  • Support attribute references of positional/keyword arguments with string formatting

    Support attribute references of positional/keyword arguments with string formatting

    from loguru import logger
    
    class Foo:
      bar = "baz"
    
    foo = Foo()
    
    # Both the following are valid syntax, but mypy flags them
    logger.debug('The bar is "{0.bar}"', foo)  # note: Expected 0 but found 1 positional arguments for log message
    logger.debug('The bar is "{my_foo.bar}"', my_foo=foo)  # error: my_foo.bar keyword argument is missing
    
    ❯ pip freeze | grep loguru
    loguru==0.5.2
    loguru-mypy==0.0.2
    
    bug 
    opened by ThibaultLemaire 14
  • Leverage mypy to check str.format expressions

    Leverage mypy to check str.format expressions

    from loguru import logger
    
    class Foo:
    bar = "baz"
    
    foo = Foo()
    
    logger.debug('The bar is "{my_foo.bar}"', my_foo=foo)  # ✓
    logger.debug('The bar is "{my_foo.bar}"', my_foo="not foo")  # error: "str" has no attribute "bar"
    

    For the record, this has been developed and tested against mypy==0.782.

    Closes #42

    size/L 
    opened by ThibaultLemaire 12
  • Accept Any Single Argument

    Accept Any Single Argument

    Raising an exception turns into an internal error for mypy which is not very user-friendly and is not visible in my IDE. Also and more importantly an error cannot be ignored via # type: ignore which is sure to break any CI pipeline. By sending a note instead, the user is warned and is free to ignore the error for now and maybe contribute a fix later ;)

    size/M 
    opened by ThibaultLemaire 10
  • Cannot import loguru.Writable

    Cannot import loguru.Writable

    I'm trying to write a simplified type hint for what defines a sink like this:

    LoguruSink = Union[TextIO, loguru.Writable, Callable[[loguru.Message], None], logging.Handler]
    

    When I do this, I get the following error:

      File "...myproj/config/logging.py", line 109, in <module>
        LoguruSink = Union[TextIO, loguru.Writable, Callable[[loguru.Message], None], logging.Handler]
    AttributeError: module 'loguru' has no attribute 'Writable'
    

    I am doing this because I have a dynamic expression like this to define a sink:

    def some_other_sink(message: loguru.Message) -> None:
        ...
    
    default_sink = sys.stdout if settings.is_local_dev else some_other_sink
    
    logger.add(
        default_sink, level=settings.log_level.upper(), format=log_fmt
    )
    

    When I lint this with Mypy though, it does not quite see the correct type of default_sink, admittedly a bit of a mypy limitation IMO:

    myproj/config/logging.py:129: error: No overload variant of "add" of "Logger"
    matches argument types "object", "str", "str", "Dict[str, str]"  [call-overload]
            logger.add(
            ^
    myproj/config/logging.py:129: note: Possible overload variants:
    myproj/config/logging.py:129: note:     def add(self, sink: Union[TextIO, Writable, Callable[[Message], None], Handler], *, level: Union[str, int] = ..., format: Union[str, Callable[[Record], str]] = ..., filter: Union[str, Callable[[Record], bool], Dict[Optional[str], Union[str, int, bool]], None] = ..., colorize: Optional[bool] = ..., serialize: bool = ..., backtrace: bool = ..., diagnose: bool = ..., enqueue: bool = ..., catch: bool = ...) -> int
    myproj/config/logging.py:129: note:     def add(self, sink: Callable[[Message], Awaitable[None]], *, level: Union[str, int] = ..., format: Union[str, Callable[[Record], str]] = ..., filter: Union[str, Callable[[Record], bool], Dict[Optional[str], Union[str, int, bool]], None] = ..., colorize: Optional[bool] = ..., serialize: bool = ..., backtrace: bool = ..., diagnose: bool = ..., enqueue: bool = ..., catch: bool = ..., loop: Optional[AbstractEventLoop] = ...) -> int
    myproj/config/logging.py:129: note:     def add(self, sink: Union[str, _PathLike[str]], *, level: Union[str, int] = ..., format: Union[str, Callable[[Record], str]] = ..., filter: Union[str, Callable[[Record], bool], Dict[Optional[str], Union[str, int, bool]], None] = ..., colorize: Optional[bool] = ..., serialize: bool = ..., backtrace: bool = ..., diagnose: bool = ..., enqueue: bool = ..., catch: bool = ..., rotation: Union[str, int, time, timedelta, Callable[[Message, TextIO], bool], None] = ..., retention: Union[str, int, timedelta, Callable[[List[str]], None], None] = ..., compression: Union[str, Callable[[str], None], None] = ..., delay: bool = ..., mode: str = ..., buffering: int = ..., encoding: str = ..., **kwargs: Any) -> int
    Found 1 error in 1 file (checked 122 source files)
    make: *** [lint] Error 1
    

    But if I type hint default_sink like this, mypy is happy with no errors:

    def some_other_sink(message: loguru.Message) -> None:
        ...
    
    default_sink: default_sink: Union[TextIO, Callable[[loguru.Message], None]] = sys.stdout if settings.is_local_dev else some_other_sink
    
    logger.add(
        default_sink, level=settings.log_level.upper(), format=log_fmt
    )
    

    Buuuut.... my completionist brain is not happy. So 2 questions:

    1. Is there a reason that loguru.Writable is not exposed?
    2. If you want to keep loguru.Writable un-importable, would you consider exposing a new Sink type that I could use like loguru.Sink?

    FWIW I am already using loguru-mypy.

    Thanks for the great library! I have dug in pretty deep to it and appreciate the very intentional design decisions that have been made.

    opened by phillipuniverse 6
  • "Internal error" while logging non-string messages

    Hi! :)

    It seems that some expressions are not recognized and generate an internal error in the plugin. It happens due to the assert here: https://github.com/kornicameister/loguru-mypy/blob/74d4af6331f20f2e4a727c911420526d813cc020/loguru_mypy/init.py#L57

    Actually, the argument does not necessarily needs to be string. Here are some examples that generate an error.

    from loguru import logger
    
    logger.info(123)
    
    from loguru import logger
    
    logger.info("foo" + "bar")
    
    from loguru import logger
    
    foo = "bar"
    logger.info(foo)
    
    from loguru import logger
    
    logger.info(f"{foobar}")
    

    Which results in:

    a.py:3: error: INTERNAL ERROR -- Please try using mypy master on Github:
    https://mypy.rtfd.io/en/latest/common_issues.html#using-a-development-mypy-build
    Please report a bug at https://github.com/python/mypy/issues
    version: 0.790
    Traceback (most recent call last):
      File "mypy/checkexpr.py", line 3766, in accept
      File "mypy/checkexpr.py", line 263, in visit_call_expr
      File "mypy/checkexpr.py", line 340, in visit_call_expr_inner
      File "mypy/checkexpr.py", line 817, in check_call_expr_with_callee_type
      File "mypy/checkexpr.py", line 880, in check_call
      File "mypy/checkexpr.py", line 1532, in check_overload_call
      File "mypy/checkexpr.py", line 1675, in infer_overload_return_type
      File "mypy/checkexpr.py", line 876, in check_call
      File "mypy/checkexpr.py", line 988, in check_callable_call
      File "mypy/checkexpr.py", line 725, in apply_function_plugin
      File "/home/delgan/Programmation/loguru-mypy/loguru_mypy/__init__.py", line 99, in _loguru_logger_call_handler
        assert isinstance(log_msg_expr, StrExpr), type(log_msg_expr)
    AssertionError: <class 'mypy.nodes.IntExpr'>
    a.py:3: : note: use --pdb to drop into pdb
    
    bug 
    opened by Delgan 4
  • Bump heinrichreimer/action-github-changelog-generator from v2.1.1 to v2.2

    Bump heinrichreimer/action-github-changelog-generator from v2.1.1 to v2.2

    Bumps heinrichreimer/action-github-changelog-generator from v2.1.1 to v2.2.

    Release notes

    Sourced from heinrichreimer/action-github-changelog-generator's releases.

    Release v2.2

    Fixed bugs:

    • Output only contains first line #7
    Commits
    • 854576b Update self
    • a1e2bd6 Escape multiline string before setting output
    • b5a9892 Merge pull request #8 from muuki88/patch-1
    • 7846b87 Merge pull request #1 from browniebroke/patch-1
    • a5e64e3 Merge pull request #2 from browniebroke/patch-2
    • c20f599 Update from 1.5.0 to 1.5.2
    • 4acbb1a Fix missing action meta data for compareLink input
    • 9825404 Remove verbose bash logging
    • 84251d6 Implement similar fix for other options likely to have a space
    • 2ac4512 Replace quotes by a more robust implementation
    • Additional commits viewable in compare view

    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)
    test-requirements size/XS 
    opened by dependabot[bot] 2
  • Bump actions/upload-artifact from v1 to v2.2.1

    Bump actions/upload-artifact from v1 to v2.2.1

    Bumps actions/upload-artifact from v1 to v2.2.1.

    Release notes

    Sourced from actions/upload-artifact's releases.

    v2.2.1

    • Update used actions/core package to the latest version
    Commits
    • 726a6dc Adding example of retention-days option. (#131)
    • 3db166e Merge pull request #145 from actions/joshmgross/update-actions-core
    • d86048c Update @actions/core license
    • 328d690 Update @actions/core to 1.2.6
    • 27bce4e Merge pull request #112 from thboop/main
    • f8b42f7 update licensed files
    • 2106e8c update contributing.md
    • db66798 Ignore Generated Files in Git PR's
    • d359fd0 Manual Verification of licenses
    • 350822c Add Licensed Workflow and config
    • Additional commits viewable in compare view

    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)
    size/XS automerge 
    opened by dependabot[bot] 2
  • Test against 3 latest releases of mypy + hard pin in plugin hook na latest

    Test against 3 latest releases of mypy + hard pin in plugin hook na latest

    ]Ref: #43

    • [x] run CI with several mypy versions [ #59 ]
    • [x] pin the version (lowest) in plugin configuration [ #60 ]
    • [x] update the documentation [ #61 ]
    feature_request 
    opened by kornicameister 2
  • Track if logger was lazy or not

    Track if logger was lazy or not

    Adds tracking mechanism for logger's opt method. Thanks to that it is now possible to detect bad calls to logger that are lazy and are expecting t.Callable[[], t.Any]

    Closes: #6

    size/L 
    opened by kornicameister 2
  • Bump lxml from 4.6.3 to 4.6.5 in /requirements/dev

    Bump lxml from 4.6.3 to 4.6.5 in /requirements/dev

    Bumps lxml from 4.6.3 to 4.6.5.

    Changelog

    Sourced from lxml's changelog.

    4.6.5 (2021-12-12)

    Bugs fixed

    • A vulnerability (GHSL-2021-1038) in the HTML cleaner allowed sneaking script content through SVG images.

    • A vulnerability (GHSL-2021-1037) in the HTML cleaner allowed sneaking script content through CSS imports and other crafted constructs.

    4.6.4 (2021-11-01)

    Features added

    • GH#317: A new property system_url was added to DTD entities. Patch by Thirdegree.

    • GH#314: The STATIC_* variables in setup.py can now be passed via env vars. Patch by Isaac Jurado.

    Commits
    • a9611ba Fix a test in Py2.
    • a3eacbc Prepare release of 4.6.5.
    • b7ea687 Update changelog.
    • 69a7473 Cleaner: cover some more cases where scripts could sneak through in specially...
    • 54d2985 Fix condition in test decorator.
    • 4b220b5 Use the non-depcrecated TextTestResult instead of _TextTestResult (GH-333)
    • d85c6de Exclude a test when using the macOS system libraries because it fails with li...
    • cd4bec9 Add macOS-M1 as wheel build platform.
    • fd0d471 Install automake and libtool in macOS build to be able to install the latest ...
    • f233023 Cleaner: Remove SVG image data URLs since they can embed script content.
    • Additional commits viewable in compare view

    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) You can disable automated security fix PRs for this repo from the Security Alerts page.
    dependabot test-requirements size/XS automerge 
    opened by dependabot[bot] 1
  • Bump actions/setup-python from 2.2.2 to 2.3.0

    Bump actions/setup-python from 2.2.2 to 2.3.0

    Bumps actions/setup-python from 2.2.2 to 2.3.0.

    Release notes

    Sourced from actions/setup-python's releases.

    Support caching dependencies

    This release introduces dependency caching support (actions/setup-python#266)

    Caching dependencies.

    The action has a built-in functionality for caching and restoring pip/pipenv dependencies. The cache input is optional, and caching is turned off by default.

    Besides, this release introduces dependency caching support for mono repos and repositories with complex structure.

    By default, the action searches for the dependency file (requirements.txt for pip or Pipfile.lock for pipenv) in the whole repository. Use the cache-dependency-path input for cases when you want to override current behaviour and use different file for hash generation (for example requirements-dev.txt). This input supports wildcards or a list of file names for caching multiple dependencies.

    Caching pip dependencies:

    steps:
    - uses: actions/[email protected]
    - uses: actions/[email protected]
      with:
        python-version: '3.9'
        cache: 'pip'
    - run: pip install -r requirements.txt
    - run: pip test
    

    Caching pipenv dependencies:

    steps:
    - uses: actions/[email protected]
    - name: Install pipenv
      run: pipx install pipenv
    - uses: actions/[email protected]
      with:
        python-version: '3.9'
        cache: 'pipenv'
    - run: pipenv install
    - run: pipenv test
    

    Change dependency file:

    steps:
    - uses: actions/[email protected]
    - uses: actions/[email protected]
      with:
        python-version: '3.9'
        cache: 'pip'
        cache-dependency-path: '**/requirements-dev.txt'
    - run: pip install -r subdirectory/requirements-dev.txt
    - run: pip test
    
    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 size/S automerge 
    opened by dependabot[bot] 1
  • Bump flake8-bugbear from 21.3.2 to 21.11.29 in /requirements/dev

    Bump flake8-bugbear from 21.3.2 to 21.11.29 in /requirements/dev

    Bumps flake8-bugbear from 21.3.2 to 21.11.29.

    Release notes

    Sourced from flake8-bugbear's releases.

    21.11.29

    • B018: Disable strings from check for now (#209)

    21.11.28

    • B904: ensure the raise is in the same context with the except (#191)
    • Add Option to extend the list of immutable calls (#204)
    • Update B014: binascii.Error is now treated as a subclass of ValueError (#206)
    • add simple pre-commit config (#205)
    • Test with 3.10 official
    • Add B018 check to find useless declarations (#196, #202)

    21.9.2

    • Fix crash on call in except statement in _to_name_str (#187)
    • Update B006: list, dictionary, and set comprehensions are now also disallowed (#186)

    21.9.1

    • Update B008: Whitelist more immutable function calls (#173)
    • Remove Python Compatibility Warnings (#182)
    • Add B904: check for raise without from in an except clause (#181)
    • Add Python 3.10 tests to ensure we pass (#183)

    21.4.3

    Verify the element in item_context.args is of type ast.Name for b017

    21.4.2

    • Add another hasattr() check to b017 visit for .func

    21.4.1

    Happy April Fools! This is no joke, it's a real release.

    • Add B017: check for gotta-catch-em-all assertRaises(Exception)

    Catching them all is bad!

    Commits
    • 49aec18 Update version + Change Log for 21.11.29 release (#210)
    • 225f4e6 Remove detection of strings in B018 (#209)
    • 9e311d5 Fix 904 tests to expect on correct raise line
    • 987e539 Update CHANGES.md, black format, update to version 21.11.28 for release
    • 9e14a8c B904: ensure the raise is in the same context with the except (#191)
    • c452048 Add Option to extend the list of immutable calls (#204)
    • c90fa65 B014: catch binascii.Error and ValueError redundancy + cleanup (#206)
    • 71091f9 add simple pre-commit config (#205)
    • 98829c3 Improve B018 further (#202)
    • 2ca8d79 B018: Find more constants w/o assign (#201)
    • Additional commits viewable in compare view

    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)
    size/XS 
    opened by dependabot[bot] 0
  • False positive on `extra` kwargs

    False positive on `extra` kwargs

    Consider following piece of code:

    logger.info(
        'Booting up worker',
        extra={'queue': queue_name},
    )
    

    It is obviously flagged as:

    [mypy] Not all arguments converted during string formatting  [str-format] [E] 
    
    question 
    opened by kornicameister 3
  • Implement handling of `CallExpr`

    Implement handling of `CallExpr`

    Taken from: #49

    Code examples:

        logger.debug(f'This is a test')           # 1
        logger.trace(f'Call from {__file__}')   # 2
    

    Expected result: If loguru-mypy detects that it is dealing with CallExpr we should try and figure a final value, i.e. after applying f-string machinery.

    feature_request 
    opened by kornicameister 0
  • Implement handling of `OpExpr`

    Implement handling of `OpExpr`

    Taken from: #49

    Code example:

    from loguru import logger
    logger.info("foo" + "bar")
    

    Expected result:

    loguru-mypy correctly detect what will be that final result of said operation and is able to say that this log call is valid.

    feature_request 
    opened by kornicameister 0
  • Using `mypy` to verify `check_str_format_call`?

    Using `mypy` to verify `check_str_format_call`?

    @ThibaultLemaire Recently I found mypy.checkexpr.ExpressionChecker.check_str_format_call method. I think that is basically what you did as part of #43, right? If that's exactly same thing would you mind replacing your code with the one referenced.

    question 
    opened by kornicameister 2
Owner
Tomasz Trębski
Just the developer happy to code. Enthusiastic about coding and World Of Tanks/WarThunder. If you want to support me consider GH sponsors or PayPal ;)
Tomasz Trębski
Pylint plugin for improving code analysis for when using Django

pylint-django About pylint-django is a Pylint plugin for improving code analysis when analysing code using Django. It is also used by the Prospector t

Python Code Quality Authority 544 Jan 06, 2023
Naming Convention checker for Python

PEP 8 Naming Conventions Check your code against PEP 8 naming conventions. This module provides a plugin for flake8, the Python code checker. (It repl

Python Code Quality Authority 411 Dec 23, 2022
Mypy stubs for the PyQt5 framework

Mypy stubs for the PyQt5 framework This repository holds the stubs of the PyQt5 framework. It uses the stub files that are produced during compilation

62 Nov 22, 2022
Flake8 extension to provide force-check option

flake8-force Flake8 extension to provide force-check option. When this option is enabled, flake8 performs all checks even if the target file cannot be

Kenichi Maehashi 9 Oct 29, 2022
Flake8 wrapper to make it nice, legacy-friendly, configurable.

THE PROJECT IS ARCHIVED Forks: https://github.com/orsinium/forks It's a Flake8 wrapper to make it cool. Lint md, rst, ipynb, and more. Shareable and r

Life4 232 Dec 16, 2022
Utilities for refactoring imports in python-like syntax.

aspy.refactor_imports Utilities for refactoring imports in python-like syntax. Installation pip install aspy.refactor_imports Examples aspy.refactor_i

Anthony Sottile 20 Nov 01, 2022
Rust like Option and Result types in Python

Option Rust-like Option and Result types in Python, slotted and fully typed. An Option type represents an optional value, every Option is either Some

45 Dec 13, 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 05, 2023
A python documentation linter which checks that the docstring description matches the definition.

Darglint A functional docstring linter which checks whether a docstring's description matches the actual function/method implementation. Darglint expe

Terrence Reilly 463 Dec 31, 2022
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
🦆 Better duck-typing with mypy-compatible extensions to Protocol

🦆 Quacks If it walks like a duck and it quacks like a duck, then it must be a duck Thanks to PEP544, Python now has protocols: a way to define duck t

Arie Bovenberg 9 Nov 14, 2022
A plugin for flake8 integrating Mypy.

flake8-mypy NOTE: THIS PROJECT IS DEAD It was created in early 2017 when Mypy performance was often insufficient for in-editor linting. The Flake8 plu

Łukasz Langa 103 Jun 23, 2022
MonkeyType as a pytest plugin.

MonkeyType as a pytest plugin.

Marius van Niekerk 36 Nov 24, 2022
Flake8 plugin for managing type-checking imports & forward references

flake8-type-checking Lets you know which imports to put in type-checking blocks. For the imports you've already defined inside type-checking blocks, i

snok 67 Dec 16, 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
👻 Phantom types for Python

phantom-types Phantom types for Python will help you make illegal states unrepresentable and avoid shotgun parsing by enabling you to practice "Parse,

Anton Agestam 118 Dec 22, 2022
Tool for pinpointing circular imports in Python. Find cyclic imports in any project

Pycycle: Find and fix circular imports in python projects Pycycle is an experimental project that aims to help python developers fix their circular de

Vadim Kravcenko 311 Dec 15, 2022
Pylint plugin to enforce some secure coding standards for Python.

Pylint Secure Coding Standard Plugin pylint plugin that enforces some secure coding standards. Installation pip install pylint-secure-coding-standard

Nguyen Damien 2 Jan 04, 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 04, 2023
Plugin for mypy to support zope.interface

Plugin for mypy to support zope.interface The goal is to be able to make zope interfaces to be treated as types in mypy sense. Usage Install both mypy

Shoobx 36 Oct 29, 2022