`py2dep` crash with `--externals`
Closed this issue · 3 comments
To reproduce, use the test_relative_imports.py
and try following code
def test_relative_imports():
files = """
relimp:
- __init__.py
- a.py: |
from . import b
- b.py
"""
with create_files(files) as workdir:
simpledeps('relimp', '--externals')
Observe error
> self.skiplist += [re.compile('^%s$' % fnmatch.translate(arg)) for arg in args['exclude_exact']]
E KeyError: 'exclude_exact'
../pydeps/depgraph.py:246: KeyError
Hi @dsun-cp , and thank you for your interest in pydeps.
The simpledeps(..)
function is an internal shortcut to create the dependency graph and extract it to a set of a->b
strings. I created it to make testing easier.
The --externals
flag returns a json list, so simpledeps is never going to work with --externals
. See the similar test in test_externals.py for how the externals flag is tested (and the numerous flags the externals function in pydeps/pydeps.py overrides).
I can't reproduce the problem by calling pydeps from the command line...
Thanks @thebjorn for the quick response.
Your pointing me to the test_externals.py
actually helped me to get what I want.
Just a caveat - the cli.verbose wasn't setup correctly if I call external
directly, see example below.
inp = Target("my_module")
actual = externals(inp, externals=True, isdir=True)
the reason it worked in test_externals.py
is because simpledeps | empty
set it up.
thanks again, feel free to close this issue
A fix for verbose is released in v1.10.18.