-
Notifications
You must be signed in to change notification settings - Fork 437
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
Question: Undefined import [21] on typed dependency #167
Comments
I forgot to mention that I've noticed that
The code on those lines looks like this: Repo.clone_from(url, repo_dir, branch=branch, depth=depth)
repo = Repo(repo_dir) It is imported like this: from git import Repo |
|
Hi @grievejia, thank you for the support. How do you suggest I specify the Regarding the parsing errors, they do stop
Nothing else happens after that, ant the |
Thanks for the feedback! You are right that we don't have a good story to tell when it comes to specifying those configurations in a platform-specific way, which is not good. But I could definitely make it better. Is it reasonable to say that the search paths you want to programmatically get are all related to the site package directory of the virtual environment? If this is the case, I could, for example, allow some special placeholders like As to Please let me know if you have more thoughts on this issue. |
Hi @grievejia, you are correct. The paths are all related to the virtual environment site-packages directory. Having a way to interpolate that in the config file will help finding the code for the dependencies that are typed. Thanks! |
Hi @adrianbn , Here's the approach I ended up arriving at: In addition to absolute path, the Let me know if it works for you. |
Hi @grievejia, was away for a while. I'll test it this week and let you know, but it should do what we need. Thanks! |
Hi @grievejia, I've been creating the updates to our project implementing the new "site-package" element to our .pyre_configuration. Happy to report this fixes our issue with our in-house library, however we are seeing an issue when attempting to run pyre-check within our pipenv. When interacting with the project within our pipenv shell, we are now seeing the following error:
I did some research, and appears to be an issue with virtualenv not having access to the function (pypa/virtualenv#737). Any ideas on a workaround or solution is greatly appreciated, thanks! |
In addition, we are seeing new errors when using site-package for certain libraries, for example, GitPython and jsonobject:
And in cases where we import from jsonobject like:
We get the following:
It appears to be having issues finding some submodules. |
Hey @grievejia, is there any suggestion you have to work around this issue? Thank you! |
Hi @grievejia , @MaggieMoss , this issue has been around for a while but it is still a problem in our infrastructure. We use Pipenv and have multiple Python projects that we've typed, but pyre still fails to find those and their types, generating a lot of error [21]. The fix @grievejia proposed goes in the right direction, but when using it we come across the error @hellasecure described above. This is our configuration:
Running pyre with the above generates the following error:
We'd really appreciate some advice with this. Thank you! |
Hi,
I'm using Pipenv and pyre 0.0.26 on OSX. I have two in-house libraries, A and B, both with type hints. B imports A and makes use of some of its classes like this:
Those imports generate a pyre error:
I'm sure there's something I'm not understanding correctly about Pyre, since I expected it to be able to go over
B
's code and find the type hints. I saw issue #64, but that is about an untyped 3rd party library whereas I control the dependency and is typed.Additionally, if I tried to run pyre with
--preserve-pythonpath
, I run into a bunch of parsing errors from third party dependencies:Do I need some special annotation on
A
's__init__.py
? Something on the constructors? Are stubs the only way forward even thoughA
is typed?Thanks for the help and sorry if this is not the right place to ask these questions.
The text was updated successfully, but these errors were encountered: