Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mypy_path in the .ini file doesn't work as I expected when running checks on one file or module #118

Open
2 tasks done
rpeck opened this issue Dec 23, 2023 · 0 comments
Open
2 tasks done

Comments

@rpeck
Copy link

rpeck commented Dec 23, 2023

Step 1: Are you in the right place?

  • I have verified there are no duplicate active or recent bugs, questions, or requests
  • I have verified that I am using the latest version of the plugin.

Step 2: Describe your environment

  • Plugin version: 0.16.2
  • PyCharm/IDEA version: 2023.3
  • Mypy version: 1.7.1

Step 3: Describe the problem:

I understand that mypy has kind of funny behavior when it's run from somewhere other than the root directory of the project. However, I naively expected this plugin to always run mypy from where the .ini file is. Nope.

If you run checks on just one file, it seems to run mypy with cwd of that file. If you're as unfortunate as me and try to use mypy_path to point to local stubs or etc., with relative paths like is the norm in the mypy examples, then suddenly the plugin will be a no-op.

Steps to reproduce:

  1. Run failing checks on a single file a dir or two down, w/o using mypy_path. See the checks work.
  2. Set mypy = <my-code-dir> in your init file.
  3. Run it again on the single file and see your errors disappear.

Observed Results:

  • Error checks went away.

Expected Results:

  • Error checks should keep working. Essentially, I expected the plugin to always run mypy from the root dir of the project, or the location of the .ini file.

Workaround:

Prefix all the paths in your .ini file with mypy_path = "$MYPY_CONFIG_FILE_DIR", like this:

mypy_path = "$MYPY_CONFIG_FILE_DIR"/stubs,"$MYPY_CONFIG_FILE_DIR"/automl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant