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

Is there a way to find all imports in a folder? #5

Open
skjerns opened this issue Apr 6, 2018 · 4 comments
Open

Is there a way to find all imports in a folder? #5

skjerns opened this issue Apr 6, 2018 · 4 comments
Labels

Comments

@skjerns
Copy link

skjerns commented Apr 6, 2018

I want to display all dependencies of scripts in one folder, including subfolders.

How can I display them, without having them listed per file?

@mgedmin
Copy link
Owner

mgedmin commented Apr 6, 2018

Do the scripts end with .py? If so, findimports /path/to/your/folder will work. If not, a shell one-liner might help, like find /path/to/folder -type f | xargs -r findimports

@skjerns
Copy link
Author

skjerns commented Apr 6, 2018

Yes, but my problem is that they are listed for each script separately.
What I would need is a list of imports that are done overall, not per script (kind like a dependency list)

@mgedmin
Copy link
Owner

mgedmin commented Apr 6, 2018

Then I'm not sure findimports can help you...

@jimklo
Copy link

jimklo commented Apr 12, 2020

it seems like with a little shell magic you could do this...

Wouldn't something like this work do what you're looking for?

findimports ./ | grep -v ":" | sed 's/\..*$//g' | sort | uniq

The above can be augmented to work with find as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants