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

Remove bundled lib-typing #3337

Merged
merged 7 commits into from
May 29, 2017
Merged

Conversation

JelleZijlstra
Copy link
Member

This gets rid of code duplication and makes sure mypy works with the released version of typing. This doesn't fix any immediate issue, but I saw some comments in the bug tracker saying that we should be able to get rid of lib-typing eventually.

There is a major downside: To run mypy tests locally, you will now have to have a Python 2.7 installed that has typing available. If that's not acceptable, we're probably better off just keeping lib-typing as is.

@JelleZijlstra
Copy link
Member Author

Travis is failing because when running with Python 3, there is a python2 binary available but we don't have permissions to install new packages for it. I can't currently think of a clean way to fix that. I'll keep this PR open for a few more days in case I think of something and otherwise close this.

@emmatyping
Copy link
Collaborator

Travis uses virtualenvs for each Python version. Since you call raw python2 it uses the system install. The simplest fix in my mind is to make a local Python2 install via another virtualenv eg:

virtualenv -p /usr/bin/python2 py2
alias python2=$PWD"/py2/bin/python2"
python2 -m pip install -U typing

I checked this process and I believe it should work if mypy can deal with the slightly strange python2 install. My main concern with this process is that it is a bit of a hack, and the added overhead of starting a new virtualenv. I also have not tested this on travis itself.

@MasterOdin
Copy link

Another option would be to use the --user flag on pip install which does not require sudo access, and will still have typing available on the path. Seems to work fine and leads to a green travis build: https://travis-ci.org/MasterOdin/mypy/builds/231940206

@emmatyping
Copy link
Collaborator

I just read through everything, LGTM. 👍

@JelleZijlstra JelleZijlstra changed the title [WIP] Remove bundled lib-typing Remove bundled lib-typing May 18, 2017
@JelleZijlstra
Copy link
Member Author

Looks like this change doesn't slow down Travis: run time for this PR is about the same as for other recent PRs.

@gvanrossum gvanrossum merged commit d238ab5 into python:master May 29, 2017
@gvanrossum
Copy link
Member

W00t! This has been on my list for a long time. Thanks for figuring out how to make it work and documenting it.

@JelleZijlstra JelleZijlstra deleted the nolibtyping branch May 29, 2017 03:21
JelleZijlstra pushed a commit to python/typeshed that referenced this pull request May 29, 2017
carljm added a commit to carljm/mypy that referenced this pull request May 30, 2017
* master: (23 commits)
  Make return type of open() more precise (python#3477)
  Add test cases that delete a file during incremental checking (python#3461)
  Parse each format-string component separately (python#3390)
  Don't warn about returning Any if it is a proper subtype of the return type (python#3473)
  Add __setattr__ support (python#3451)
  Remove bundled lib-typing (python#3337)
  Move version of extensions to post-release (python#3348)
  Fix None slice bounds with strict-optional (python#3445)
  Allow NewType subclassing NewType. (python#3465)
  Add console scripts (python#3074)
  Fix 'variance' label.
  Change label for variance section to just 'variance' (python#3429)
  Better error message for invalid package names passed to mypy (python#3447)
  Fix last character cut in html-report if file does not end with newline (python#3466)
  Print pytest output as it happens (python#3463)
  Add mypy roadmap (python#3460)
  Add flag to avoid interpreting arguments with a default of None as Optional (python#3248)
  Add type checking plugin support for functions (python#3299)
  Mismatch of inferred type and return type note (python#3428)
  Sync typeshed (python#3449)
  ...
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

Successfully merging this pull request may close these issues.

4 participants