pipreqs was failing to include the root Django package, depending on what subdirectory I ran it over. This was due to the existence of a logs/django directory. I added a check for __init__.py and the total packages found jump by 8, up to 76. It turned out that node_modules directory was obscuring a bunch more (I should have --ignored it, of course).
The fix was a simple change to get_all_imports():
for root, dirs, files in walk:
dirs[:] = [d for d in dirs if d not in ignore_dirs]
candidate = os.path.basename(root)
initfile = os.path.join(candidate, '__init__.py')
if os.path.exists(initfile):
candidates.append(candidate)
I'm not sure if this is a universal improvement, so didn't make a PR for it yet. Certainly, more thought needs to be given to submodules and, more broadly, relative imports.
pipreqs was failing to include the root
Django
package, depending on what subdirectory I ran it over. This was due to the existence of alogs/django
directory. I added a check for__init__.py
and the total packages found jump by 8, up to 76. It turned out thatnode_modules
directory was obscuring a bunch more (I should have --ignored it, of course).The fix was a simple change to
get_all_imports()
:I'm not sure if this is a universal improvement, so didn't make a PR for it yet. Certainly, more thought needs to be given to submodules and, more broadly, relative imports.