* Mark stdlib modules with upper version bounds
* Add minus to all versions and enforce in check_consistent
* Fix check_consistent and mypy_test to work with new VERSIONS format
As requested by https://github.com/python/typeshed/issues/1526.
This addition takes mypy configuration from each distribution metadata file and constructs a single mypy.ini to run with. It assumes there is no mypy.ini but in case we ever need one, it would be simple to add these on top of an existing configuration file.
Might be relevant for #2852
As the issue did not really specify how the configuration would look, I added the following:
- You may add a mypy-tests section to the metadata file.
It looks like this:
[mypy-tests]
[mypy-tests.yaml]
module_name = "yaml"
[mypy-tests.yaml.values]
disallow_incomplete_defs = true
disallow_untyped_defs = true
- module_name can be of the form "a.*" like in mypy.ini.
- You can add several module sections for complex distributions with several modules.
- I added the '--warn-incomplete-stub' option since it is made specifically for typeshed runs. See docs.
This replaces all uses of ‘blacklist’ with ‘exclude list’. Benefits:
- It is racially neutral terminology; see e.g. [1]
- It makes the meaning more clear. In fact, with the popular Python
autoformatter called ‘black’, also used by this project, files can be
‘blackened’ which is something completely different from them being on
a blacklist.
[1] https://chromium.googlesource.com/chromium/src/+/master/styleguide/inclusive_code.md#racially-neutral
* travis: run stubtest on py39, allowing failures
* travis: run mypy with python version 3.9
* boto.compat, base64: fix version handling of (en|de)codebytes
* venv: fix#4010
Co-authored-by: hauntsaninja <>
This runs mypy both with Python 3.7 and 3.8. In Python 3.8,
mypy switched from using typed-ast to using Python's built-in ast.
This patch ensures that both are tested.
This was already the configuration in Travis and it's been working fine. It's
confusing that Travis was using a different configuration than the default
when you run tests/mypy_test.py yourself.
* Add flags to pass on --warn-unused-ignores and --no-implicit-optional to mypy
* Make implicit Optional explicit in arg types (2and3 part)
* Convert {stdlib,third_party}/2 to explicit Optional
This simplifies running flake8 tests and reduces the amount of F821 errors
reported (flake8-pyi enables support for forward references in *.pyi files).
The error code is left disabled until I clean up the remaining issues.