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

Make type checking mypy more straightforward for new contributors #11403

Open
pranavrajpal opened this issue Oct 29, 2021 · 2 comments
Open

Make type checking mypy more straightforward for new contributors #11403

pranavrajpal opened this issue Oct 29, 2021 · 2 comments
Labels
topic-developer Issues relevant to mypy developers topic-tests

Comments

@pranavrajpal
Copy link
Contributor

There are a couple pitfalls relating to type checking mypy itself that don't seem to be documented anywhere:

  1. Specifying files: Running mypy . and mypy mypy mypyc both result in duplicate module errors that prevent further type checking. The correct way to run mypy is mypy -p mypy -p mypyc, which doesn't appear to be documented anywhere (I only found this by looking at the tox.ini config file).
  2. Specifying the config file: Failing to specify mypy_self_check.ini as the config file results in an error in mypy/bogus_type.py and means that people aren't using mypy's stricter type checking options.

I think the solution to 2 would be to rename mypy_self_check.ini to mypy.ini, because self checking mypy is significantly more common than compiling mypy with mypyc, so making mypy_self_check.ini the default config file seems reasonable.

For 1, we should at the very least document the command to run mypy in CONTRIBUTING.md. I think the ideal solution would involve changing the configuration file so that either mypy . or mypy mypy mypyc just works correctly, the latter of which seems to be possible from my experiments by turning on namespace_packages and excluding mypyc/test-data.

hauntsaninja pushed a commit to hauntsaninja/mypy that referenced this issue Oct 31, 2021
This was prompted by python#11403

This includes at least the following changes:
- General streamlining of markdown
- Remove outdated references, e.g. to Python 2 / how to install Python 3
- Mention the "type school" discussions repo, typing-sig mailing list
- Remove roadmap, since there isn't really a mypy core team anymore
- More concretely link to "good first issue" page, etc. Hopefully this
  is a better experience than the several people who post on our gitter
  with a "I know Python, please help me contribute" message that doesn't
  really go anywhere
- Consolidate contributing information in CONTRIBUTING.md
hauntsaninja pushed a commit to hauntsaninja/mypy that referenced this issue Oct 31, 2021
This was prompted by python#11403

This includes at least the following changes:
- General streamlining of markdown
- Remove outdated references, e.g. to Python 2 / how to install Python 3
- Mention the "type school" discussions repo, typing-sig mailing list
- Remove roadmap, since there isn't really a mypy core team anymore
- More concretely link to "good first issue" page, etc. Hopefully this
  is a better experience than the several people who post on our gitter
  with a "I know Python, please help me contribute" message that doesn't
  really go anywhere
- Consolidate contributing information in CONTRIBUTING.md
hauntsaninja pushed a commit to hauntsaninja/mypy that referenced this issue Oct 31, 2021
This was prompted by python#11403

This includes at least the following changes:
- General streamlining of markdown
- Remove outdated references, e.g. to Python 2 / how to install Python 3
- Mention the "type school" discussions repo, typing-sig mailing list
- Remove roadmap, since there isn't really a mypy core team anymore
- More concretely link to "good first issue" page, etc. Hopefully this
  is a better experience than the somewhat common case of gitter posts
  like "I know Python, please help me contribute" that don't
  really go anywhere
- Consolidate contributing information in CONTRIBUTING.md
hauntsaninja pushed a commit to hauntsaninja/mypy that referenced this issue Oct 31, 2021
This was prompted by python#11403

Changes include:
- General streamlining of markdown
- Remove outdated references, e.g. to Python 2 / how to install Python 3
- Mention the "type school" discussions repo, typing-sig mailing list
- Remove roadmap, since there isn't really a mypy core team anymore
- More concretely link to "good first issue" page, etc. Hopefully this
  is a better experience than the somewhat common case of gitter posts
  like "I know Python, please help me contribute" that don't
  really go anywhere
- Consolidate contributing information in CONTRIBUTING.md
hauntsaninja pushed a commit to hauntsaninja/mypy that referenced this issue Oct 31, 2021
This was prompted by python#11403

Changes include:
- General streamlining of markdown
- Remove outdated references, e.g. to Python 2 / how to install Python 3
- Mention the "type school" discussions repo, typing-sig mailing list
- Remove roadmap, since there isn't really a mypy core team anymore
- More concretely link to "good first issue" page, etc. Hopefully this
  is a better experience than the somewhat common case of gitter posts
  like "I know Python, please help me contribute" that don't
  really go anywhere
- Consolidate contributing information in CONTRIBUTING.md
- Remove issue tracker conventions, since the template does a pretty
  good job and the rest is either common sense or never looked at
@hauntsaninja
Copy link
Collaborator

hauntsaninja commented Oct 31, 2021

Thanks, I agree this isn't intuitive. Note that knowing to specify the config file is the bigger issue, since mypy mypy mypyc --config-file mypy_self_check.ini works just fine.

I think renaming the file to mypy.ini might cause issues with tests or something. But at the very least, this should be more clearly documented, which I've attempted to do in #11413

hauntsaninja added a commit that referenced this issue Oct 31, 2021
This was prompted by #11403

Changes include:
- General streamlining of markdown
- Remove outdated references, e.g. to Python 2 / how to install Python 3
- Mention the "type school" discussions repo, typing-sig mailing list
- Remove roadmap, since there isn't really a mypy core team anymore
- More concretely link to "good first issue" page, etc. Hopefully this
    is a better experience than the somewhat common case of gitter posts
    like "I know Python, please help me contribute" that don't
    really go anywhere
- Consolidate contributing information in CONTRIBUTING.md
- Remove issue tracker conventions, since the template does a pretty
    good job and the rest is either common sense or never looked at
@pranavrajpal
Copy link
Contributor Author

mypy mypy mypyc --config-file mypy_self_check.ini works just fine.

Yeah, I didn't realize this when I created the issue. I wasn't using the latest master so I didn't see the effects of #11258.

I think renaming the file to mypy.ini might cause issues with tests or something.

I'm guessing you're referring to these test failures that occur when I rename mypy_self_check.ini to mypy.ini:

FAILED mypy/test/testargs.py::ArgSuite::test_coherence - AssertionError: {'build_type': 0, 'python_version': (3, 8), 'python_executable': '/usr/bin/python3', 'platform': 'linux', 'custo...
FAILED mypy/test/testargs.py::ArgSuite::test_executable_inference - AssertionError: assert (3, 6) == (3, 8)
FAILED mypy/test/testsamples.py::SamplesSuite::test_samples
FAILED mypy/test/testsamples.py::SamplesSuite::test_stdlibsamples

All of these seem fixable if we change the current working directory to some other folder when running these tests.

tushar-deepsource pushed a commit to DeepSourceCorp/mypy that referenced this issue Jan 20, 2022
This was prompted by python#11403

Changes include:
- General streamlining of markdown
- Remove outdated references, e.g. to Python 2 / how to install Python 3
- Mention the "type school" discussions repo, typing-sig mailing list
- Remove roadmap, since there isn't really a mypy core team anymore
- More concretely link to "good first issue" page, etc. Hopefully this
    is a better experience than the somewhat common case of gitter posts
    like "I know Python, please help me contribute" that don't
    really go anywhere
- Consolidate contributing information in CONTRIBUTING.md
- Remove issue tracker conventions, since the template does a pretty
    good job and the rest is either common sense or never looked at
@JelleZijlstra JelleZijlstra added the topic-developer Issues relevant to mypy developers label Mar 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic-developer Issues relevant to mypy developers topic-tests
Projects
None yet
Development

No branches or pull requests

4 participants