-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Implement PEP 561 searching #4403
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
105 commits
Select commit
Hold shift + click to select a range
e4b5274
Simplify find_module cache and document PEP 561
emmatyping 6b6a97d
More work on PEP 561 impl
emmatyping 2c936e1
Scaffold testing and fix bugs.
emmatyping 8f64f81
Add python arg for find_module
emmatyping ddc526f
Get packages from Python executables
emmatyping 329dc68
Add support for non-running Python, fix bug in impl
emmatyping eba98d4
Merge branch 'master' of https://github.com/python/mypy into pep561-impl
emmatyping 5576629
Fix mypy self check
emmatyping 2397763
Fix weird subprocess bug that works in pydevd, but not otherwise
emmatyping fda2a2c
Add docs for PEP561 impl
emmatyping 59f0c49
Add initial tests for PEP 561 checking
emmatyping c976008
Clean up tests a bit
emmatyping 8df8b8d
Get tests passing
emmatyping 4ca6939
Add note about tests
emmatyping a96601c
Clear site-packages from cache.
emmatyping 336fb6b
Show sample package layout, change help text
emmatyping 8492d8b
Merge branch 'master' into pep561-impl
emmatyping c41eef2
Merge branch 'master' into pep561-impl
emmatyping 1f005d7
Fix deletion of site-packages from cache
emmatyping 45afe58
Simplify testcase file creation/deletion
emmatyping e7f23bb
Don't use common path and fix lint errors
emmatyping d74eae8
Merge branch 'master' into pep561-impl
emmatyping 5822884
Update PEP561 implementation, docs
emmatyping c734bc2
Clarify python-executable purpose
emmatyping 1d7cc7e
Document --python-executable
emmatyping 1ac4253
Assure dir cache is always set for a key
emmatyping f681bf9
Fix indentation of code and command line
emmatyping 85f233c
Fix silly indentation mistake (again)
emmatyping 3726f18
Add check for Python packages if executable given
emmatyping 59a2004
Finish implementation and tests for alternate executable
emmatyping 77b3b66
Add note about advanced import methods
emmatyping 1da6e58
Remove undocumented flag
emmatyping e54025f
Maintain source information in traceback
emmatyping 056dc8f
Clean up testpackages docstrings
emmatyping 297fac6
Even better tracebacks for package tests
emmatyping e35e7aa
User install on Python not executing tests
emmatyping ecb702e
Better debug info on failed typecheck
emmatyping 1a41262
Check if package was installed user
emmatyping 31dab8d
Check if user site exits
emmatyping ff15057
Parentheses have haunted me since Scheme
emmatyping 9442765
Don't unconditionally set python
emmatyping a34e7e8
Cleanup tests
emmatyping 0fd592a
Fix for mypy check
emmatyping 4cbe21a
Remove debugging info
emmatyping f566ed0
Try to delete simple.py after all tests in case have run
emmatyping 206f70b
Make tearDownClass a classmethod
emmatyping 2dbff97
Don't clean up twice, as it can break stubgen tests
emmatyping e33ceb7
Set python version from executable
emmatyping 644e9a5
Fix mypy self check and doc indentation
emmatyping af38a12
Dedent docs
emmatyping b7f0788
Add missed flag back
emmatyping 0564a5c
Remove silencing of errors in installed packages
emmatyping d17582b
Clean up get_package_dirs
emmatyping 085d002
Make assert a user facing error
emmatyping 8958dc7
Refactor get_package_dirs
emmatyping 84fd527
Make test package typesafe to avoid error
emmatyping 4c0ff1b
Clarify docs of unsupported import features
emmatyping a917ff5
Reverse equality order
emmatyping 83ab973
Correct to more sensible key type for package_dir_cache
emmatyping cfac326
python -> python_executable
emmatyping aefcb96
Set python_executable based on python_version
emmatyping 380e301
Fix weird indentation
emmatyping 47d8e0d
Refactor and clarify checks for package information
emmatyping 5c19e8c
Simplify check
emmatyping 56dfcd4
Last python -> python_executable
emmatyping 4293dad
Use lru_cache on get_package_dirs
emmatyping b810d3e
Fix lint
emmatyping 17488ad
Refactor version setting from executable
emmatyping e348471
Handle python executable with spaces
emmatyping 8184937
Return early in get_package_dirs
emmatyping 97f29cc
Refactor and clean up testpackages
emmatyping 928683a
Fix executable flag and version inference
emmatyping ae65564
Clean up Python version/executable inference
emmatyping f6c4327
Make typedpkg python2 compatible
emmatyping d475d4b
Overwrite default Python version if python_executable set
emmatyping 03cd378
Move returns into try blocks
emmatyping 3a8ca60
Refactor python-version/executable inference
emmatyping e1f9494
Clarify searching for packages and mixed packages
emmatyping b5cbd09
Clarify default behaviour of python-executable flag
emmatyping fc58e4c
Comment and refactor getsitepackage usage
emmatyping 96e2f55
Make python_executable mandatory for find_packages
emmatyping 80f4a35
Remove py.typed file from -stubs test package
emmatyping dc29e51
Write testpackages to test folder
emmatyping be733c5
Refactor tests to not be run with package check
emmatyping c1264a0
Disable pep561 searching with --no-site-packages
emmatyping ceacbff
Fix return type to be non-optional
emmatyping f389f64
Set python_executable to None if not inferred
emmatyping 1bd9f66
Set flags for tests needing 3.6
emmatyping 806fbef
Document no-site-packages
emmatyping c9e3361
Fix bugs with running mypy on 3.4
emmatyping 7be3555
Merge branch 'master' of https://github.com/python/mypy into pep561-impl
emmatyping 5fc9d52
Disable PEP561 searching if --no-site-packages is passed
emmatyping ae86abd
Clean up tests
emmatyping 0bf024f
Move no-site-packages to special-opts
emmatyping c9c35c1
Remove duplicate exit and error message
emmatyping dca9c54
Refactor name, add missing paren
emmatyping a929b46
Fix test import
emmatyping e56ffe3
Fix silly name mistake
emmatyping 72d7b0a
Link to PEP 561 and add note about inference
emmatyping c9f6bc2
Fixup docs
emmatyping 4698d23
Refactor find_module and clarify comment
emmatyping db0680a
Refactor find_module to not be monolithic
emmatyping 8367e57
Key find_module_dir_cache with lib_path as well
emmatyping 24b6742
Don't mutate dir cache with site packages
emmatyping afb80ea
Refactor stub package searching
emmatyping File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Set flags for tests needing 3.6
- Loading branch information
commit 1bd9f6604a1ca04ccd8519a4cabfdc76f0572c63
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -581,7 +581,7 @@ m.py:6: error: Explicit "Any" is not allowed | |
| m.py:9: error: Explicit "Any" is not allowed | ||
|
|
||
| [case testDisallowAnyExplicitVarDeclaration] | ||
| # cmd: mypy m.py | ||
| # cmd: mypy --python-version=3.6 m.py | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar for the Python version here. Maybe all these tests should be run with 3.6 unless they override it? |
||
|
|
||
| [file mypy.ini] | ||
| [[mypy] | ||
|
|
@@ -601,7 +601,7 @@ m.py:3: error: Explicit "Any" is not allowed | |
| m.py:5: error: Explicit "Any" is not allowed | ||
|
|
||
| [case testDisallowAnyExplicitGenericVarDeclaration] | ||
| # cmd: mypy m.py | ||
| # cmd: mypy --python-version=3.6 m.py | ||
|
|
||
| [file mypy.ini] | ||
| [[mypy] | ||
|
|
@@ -785,7 +785,7 @@ N = TypedDict('N', {'x': str, 'y': List}) # no error | |
| m.py:4: error: Explicit "Any" is not allowed | ||
|
|
||
| [case testDisallowAnyGenericsTupleNoTypeParams] | ||
| # cmd: mypy m.py | ||
| # cmd: mypy --python-version=3.6 m.py | ||
| [file mypy.ini] | ||
| [[mypy] | ||
| [[mypy-m] | ||
|
|
@@ -821,7 +821,7 @@ def g(s: List[Tuple[str, str]]) -> None: pass # no error | |
| m.py:3: error: Missing type parameters for generic type | ||
|
|
||
| [case testDisallowAnyGenericsTypeType] | ||
| # cmd: mypy m.py | ||
| # cmd: mypy --python-version=3.6 m.py | ||
| [file mypy.ini] | ||
| [[mypy] | ||
| [[mypy-m] | ||
|
|
@@ -858,7 +858,7 @@ def g(l: L[str]) -> None: pass # no error | |
| m.py:5: error: Missing type parameters for generic type | ||
|
|
||
| [case testDisallowAnyGenericsGenericAlias] | ||
| # cmd: mypy m.py | ||
| # cmd: mypy --python-version=3.6 m.py | ||
| [file mypy.ini] | ||
| [[mypy] | ||
| [[mypy-m] | ||
|
|
@@ -882,7 +882,7 @@ m.py:7: error: Missing type parameters for generic type | |
| m.py:11: error: Missing type parameters for generic type | ||
|
|
||
| [case testDisallowAnyGenericsPlainList] | ||
| # cmd: mypy m.py | ||
| # cmd: mypy --python-version=3.6 m.py | ||
| [file mypy.ini] | ||
| [[mypy] | ||
| [[mypy-m] | ||
|
|
@@ -906,7 +906,7 @@ m.py:8: error: Need type annotation for 'x' | |
| m.py:9: error: Missing type parameters for generic type | ||
|
|
||
| [case testDisallowAnyGenericsCustomGenericClass] | ||
| # cmd: mypy m.py | ||
| # cmd: mypy --python-version=3.6 m.py | ||
| [file mypy.ini] | ||
| [[mypy] | ||
| [[mypy-m] | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That seems a bit arbitrary. Why not
mypy.defaults.PYTHON3_VERSION? Orsys.version_info[:2]? (Then again I realize this is very far from your code -- the feature that this tests isn't even announced yet. :-)Ditto for testmerge.py, and half-ditto for testsemanal.py.