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

Fix autoimport not scanning packages recursively #688

Merged
merged 3 commits into from Apr 18, 2023

Conversation

lieryan
Copy link
Member

@lieryan lieryan commented Apr 18, 2023

Description

Change glob pattern in get_files() to scan site-packages recursively.

Fixes #687

Checklist (delete if not relevant):

  • I have added tests that prove my fix is effective or that my feature works
  • I have updated CHANGELOG.md

@lieryan lieryan self-assigned this Apr 18, 2023
@lieryan lieryan added bug Unexpected or incorrect user-visible behavior autoimport labels Apr 18, 2023
@lieryan
Copy link
Member Author

lieryan commented Apr 18, 2023

cc: @bagel897 FYI, this is an issue raised by rstcruzo in #685. I hope I didn't missing anything obvious with this fix here.

@lieryan lieryan merged commit b9580da into master Apr 18, 2023
34 checks passed
@lieryan lieryan deleted the lieryan-missing-symbols branch April 18, 2023 04:56
@bagel897
Copy link
Contributor

Shouldn't it be **.py? That way it'll glob root directory files.

@lieryan
Copy link
Member Author

lieryan commented Apr 18, 2023

Yeah, that's what I initially thought as well, but apparently, the glob.glob() and the pathlib glob doesn't really work the same.

Doing **.py is an error with pathlib's glob:

In [5]: list(Path(".").glob("**.py"))
ValueError: Invalid pattern: '**' can only be an entire path component

**/*.py looks unintuitive, but it does actually include the root directory files:

In [12]: list(Path(".").glob("**/*.py"))
Out[12]: 
[PosixPath('setup.py'),
...
]

OTOH, for glob.glob() stdlib module, **.py is basically identical to *.py:

In [10]: glob.glob("**.py", recursive=True)
Out[10]: ['setup.py']

and **/*.py works the same as pathlib's glob.

@bagel897
Copy link
Contributor

Weird

@lieryan lieryan added this to the 1.8.0 milestone May 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autoimport bug Unexpected or incorrect user-visible behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing symbols in autoimport.db
2 participants