Skip to content

Mention pip in Quick start. #492

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

Merged
merged 4 commits into from
Nov 24, 2014
Merged

Mention pip in Quick start. #492

merged 4 commits into from
Nov 24, 2014

Conversation

lrem
Copy link
Contributor

@lrem lrem commented Nov 4, 2014

It would be beneficial to mention ease of installation in the README.

@lrem
Copy link
Contributor Author

lrem commented Nov 4, 2014

Yay, I managed to mix 2 changes, but I hope they can be merged together.
I introduced the flag to search in Python's sys.path.
It shouldn't cause trouble and works as expected:

$ mypy mypy
mypy, line 14: No module named 'mypy'
mypy, line 15: No module named 'mypy.errors'
$ mypy --python-path mypy
$

Feel free to shout at me for no tests.

@JukkaL
Copy link
Collaborator

JukkaL commented Nov 5, 2014

Looks pretty good! Thanks for creating this PR!

I'm going to play around with installing using pip and using --python-path in a VM later this week.

I'm drawn towards changing the name of the option to something like --use-python-path or --enable-python-path to make it more explicit.

@lrem
Copy link
Contributor Author

lrem commented Nov 22, 2014

I've changed the flag name to --use-python-path.

JukkaL added a commit that referenced this pull request Nov 24, 2014
Mention pip in Quick start and support --use-python-path
@JukkaL JukkaL merged commit 7c3fafc into python:master Nov 24, 2014
@ghost
Copy link

ghost commented Apr 19, 2015

This does not work correctly if the imported file in turn imports another. Here is a test program:

import numpy as np
print("Hello")

Runs fine with python, fails with numpy as follows:

In module imported in foo.py, line 1:
/.../lib/python3.4/site-packages/numpy/__init__.py, line 202: No module named '__builtin__'

Would love to start using this on my code ...

@spkersten
Copy link
Contributor

@dedoig I've looked into the error you've found. In numpy/__init__.py there is Python 2 specific code behind a check on the Python version. mypy only works on Python 3 code and doesn't recognise that the code guarded by not sys.version_info[0] >= 3 is Python 2 specific.

@ghost
Copy link

ghost commented Apr 29, 2015

Thanks, @spkersten. Is there a way to skip mypy type-checking (or whatever processing it is trying to do and when it dies) of the numpy import (transitively) and still type check my remaining code?

Also, is there a standard place to search for mypy stub files for numpy and others common libs?

@gvanrossum
Copy link
Member

Maybe # type: ignore on the import line?

On Tuesday, April 28, 2015, Dedoig [email protected] wrote:

Thanks, @spkersten https://github.com/spkersten. Is there a way to skip
mypy type-checking (or whatever processing it is trying to do and when it
dies) of the numpy import (transitively) and still type check my remaining
code?


Reply to this email directly or view it on GitHub
#492 (comment).

--Guido van Rossum (on iPad)

@ghost
Copy link

ghost commented Apr 29, 2015

import numpy as np # type: ignore ## seemed to help. But then I get this (regardless of # type: ignore):

from functools import partial

==> check-mypy.py, line 2: Module has no attribute 'partial'

@spkersten
Copy link
Contributor

@Dedoig I think that your last message is because the stub that mypy uses for functools is really limited at the moment (it contains just two functions). You can try adding partial to it yourself. The stub is in mypy/stubs/3.2/functools.py.

Edit: for me adding # type: ignore does suppress the message, so maybe I wasn't able to exactly reproduce the situation in which you get this error.

@msullivan msullivan mentioned this pull request Nov 16, 2018
7 tasks
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