Skip to content

Inconsistent behavior in python-mypy (invalid errors shown) #1711

@vikigenius

Description

@vikigenius

Checklist

  • I have checked existing issues for potential duplicates before creating this one.
  • I have read the Troubleshooting guide.

Bug description

flycheck python-mypy produces errors that are not valid/not observed when I manually run it from the command line

Steps to reproduce

Here is a sample code snippet that is pretty common in sqlalchemy

from sqlalchemy import Column, Integer, String
from sqlalchemy.ext.declarative import declarative_base

Base = declarative_base()


class User(Base):
    """The user model."""

    __tablename__ = 'user'
    uid = Column(Integer, primary_key=True)
    name = Column(String)

Steps to reproduce the behavior:

  1. Errors are shown for the line User(Base):
  2. run flycheck-compile python-mypy on the buffer
mypy --show-column-numbers /home/void/Projects/redorg/redorg/user.py
user.py:9:12: error: Variable "redorg.user.Base" is not valid as a type
user.py:9:12: error: Invalid base class "Base"
Found 2 errors in 1 file (checked 1 source file)
  1. Run the same command in the command line, and it doesn't produce any errors.

Expected behavior

flycheck should not show any errors

Screenshots

If applicable, add screenshots to help explain your problem.

System configuration

Syntax checkers for buffer user.py in python-mode:

First checker to run:

  python-flake8
    - may enable:         yes
    - executable:         Found at /home/void/.miniconda3/envs/redorg/bin/flake8
    - configuration file: Not found
    - next checkers:      python-pylint, python-mypy

Checkers that may run as part of the first checker's chain:

  python-mypy
    - may enable:         yes
    - predicate:          t
    - executable:         Found at /home/void/.miniconda3/envs/redorg/bin/mypy
    - configuration file: Not found

Checkers that could run if selected:

  python-pycompile  select
    - may enable:    yes
    - executable:    Found at /home/void/.miniconda3/envs/redorg/bin/python3
    - next checkers: python-mypy

Checkers that are compatible with this mode, but will not run until properly configured:

  python-pylint (disabled)
    - may enable:         Automatically disabled!
    - executable:         Not found
    - configuration file: Not found
    - next checkers:      python-mypy

Flycheck Mode is enabled. Use SPC u C-c ! x to enable disabled checkers.

--------------------

Flycheck version: 32snapshot
Emacs version:    26.3
System:           x86_64-unknown-linux-gnu
Window system:    x

Emacs configuration:

  • Doom Emacs

Additional notes

Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions