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

pyls not working with star '*' imports #914

Open
atticusmatticus opened this issue Feb 24, 2021 · 0 comments
Open

pyls not working with star '*' imports #914

atticusmatticus opened this issue Feb 24, 2021 · 0 comments

Comments

@atticusmatticus
Copy link

I am using Neovim 0.5.0-dev+nightly with pyls which works well and quickly for most packages like numpy for example. However when used with the fastai library the LSP just returns:

Diagnostics:
1. 'from fastai.vision.all import *' used; unable to detect undefined names

The fastai library is designed to be imported this way so changing this line isn't really a viable option.

To reproduce my issue you can install fastai via miniconda3:
conda install -c fastai -c pytorch fastai
and then install python-language-server:
conda install python-language-server

Then open a file in neovim with the conda-env enabled and pyls enabled, here is a short example file:

from fastai.vision.all import *

path = untar_data(URLs.PETS)/'images'

def is_cat(x): return x[0].isupper()
dls = ImageDataLoaders.from_name_func(
        path, get_image_files(path), valid_pct=0.2, seed=42,
        label_func=is_cat, item_tfms=Resize(224))

learn = cnn_learner(dls, resnet34, metrics = error_rate)

all of these functions show as having warnings, for example for the path= line:
'untar_data' may be undefined, or defined from star imports: fastai.vision.all

And the hover help for example doesn't work for these functions. Is there something that can be done to make wildcard imports like this work correctly with the language server?

If there is anymore information I can give you please let me know. Thanks

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

No branches or pull requests

1 participant