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
Flake8 plugin to find commented out or dead code

flake8-eradicate flake8 plugin to find commented out (or so called "dead") code. This is quite important for the project in a long run. Based on eradi

wemake.services 277 Dec 27, 2022
Static Typing for Python

Python static typing home. Contains the source for typing_extensions and the documentation. Also hosts a user help forum.

Python 1.3k Jan 06, 2023
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 03, 2023
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
Type stubs for the lxml package

lxml-stubs About This repository contains external type annotations (see PEP 484) for the lxml package. Installation To use these stubs with mypy, you

25 Dec 26, 2022
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 04, 2023
Tool for automatically reordering python imports. Similar to isort but uses static analysis more.

reorder_python_imports Tool for automatically reordering python imports. Similar to isort but uses static analysis more. Installation pip install reor

Anthony Sottile 589 Dec 26, 2022
An enhanced version of the Python typing library.

typingplus An enhanced version of the Python typing library that always uses the latest version of typing available, regardless of which version of Py

Contains 6 Mar 26, 2021
flake8 plugin to catch useless `assert` statements

flake8-useless-assert flake8 plugin to catch useless assert statements Download or install on the PyPI page Violations Code Description Example ULA001

1 Feb 12, 2022
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 08, 2023
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 08, 2023
Code audit tool for python.

Pylama Code audit tool for Python and JavaScript. Pylama wraps these tools: pycodestyle (formerly pep8) © 2012-2013, Florent Xicluna; pydocstyle (form

Kirill Klenov 967 Jan 07, 2023
Flashcards - A flash card application with 2 optional command line arguments

Flashcards A flash card application with 2 optional command line arguments impor

Özgür Yildirim 2 Jul 15, 2022
docstring style checker

pydocstyle - docstring style checker pydocstyle is a static analysis tool for checking compliance with Python docstring conventions. pydocstyle suppor

Python Code Quality Authority 982 Jan 03, 2023
Convert relative imports to absolute

absolufy-imports A tool and pre-commit hook to automatically convert relative imports to absolute. Installation $ pip install absolufy-imports Usage a

Marco Gorelli 130 Dec 30, 2022
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
Type annotations builder for boto3 compatible with VSCode, PyCharm, Emacs, Sublime Text, pyright and mypy.

mypy_boto3_builder Type annotations builder for boto3-stubs project. Compatible with VSCode, PyCharm, Emacs, Sublime Text, mypy, pyright and other too

Vlad Emelianov 2 Dec 05, 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
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
👻 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