Skip to content

Expose --no-site-packages to configuration file. #7768

Closed

Description

@alanhdu

mypy 0.730 currently supports a --no-site-packages flag, which disables searching for PEP561 compliant packages. Unfortunately, it does not seem to be exposed via a configuration file (I did not find it in https://mypy.readthedocs.io/en/latest/config_file.html and several variations in my config file raised an unused config error).

Would it be possible this option configurable via the config file?

Activity

  1. msullivan commented on Oct 21, 2019

    @msullivan
    Collaborator

    Yeah that is a good idea.

    mypy's main.py tracks no-site-packages outside of the main Options object and uses the value to adjust some other options. But it would be simple to make it part of Options and manage it like most of the other options.

    Would you like to submit a PR?

  2. vemel commented on Oct 31, 2019

    @vemel

    As I can see, you can define python_executable in config. So if we change https://github.com/python/mypy/blob/master/mypy/modulefinder.py#L411 to if python_executable:, the following config would work

    [mypy]
    python_executable=
    

    I do not fully understand the idea behind special-opts as code could easily be rewritten to have just Options namespae, and then every option could be set in mypy.ini

  3. davidzwa commented on Mar 7, 2020

    @davidzwa
    Contributor

    @msullivan Me and a colleague are currently involved in finding out how to solve this small issue, as it is marked good-first-issue. It is expected to submit a PR next week.

    Currently we found that options.py as well as the config_parser.py have to be adjusted. Is there anything more? Secondly, would you recommend adding a test of some sorts to test our code changes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions