Bjorn

Results 160 comments of Bjorn

Hi @greenled , I can't reproduce this with py3.10.2, pydeps 1.10.22 and graphviz 2.50.0 on windows 11, running pydeps on pydeps source. Do you have a testcase?

@andreapesare The problem is as follows... given the code above, the following graph is produced: ![image](https://user-images.githubusercontent.com/1193143/201093855-202001ea-7ffc-458d-ac43-eb8d349e8a10.png) and the output of `--show-deps` is: ``` (dev37) go|c:\srv\tmp\issue57> pydeps test_services.py --show-deps { "__main__":...

Well... In both cases `services` is the only name that is directly imported: ``` def tst(): import services import services.services_wrapper import dis dis.dis(tst) ``` outputs: ``` 2 0 LOAD_CONST 1...

@gsakkis I suppose an ast-based approach could work, based on very limited data: ``` node = ast.parse(""" import services import services.services_wrapper """) imports = [n for n in node.body if...

A more robust finder might be: ``` def find_imports(fname): names = set() with open(fname) as fp: txt = fp.read() body = ast.parse(txt).body for node in body: if isinstance(node, ast.Import): for...

@gsakkis pydeps already knows which imports are "files", so that particular issue is solvable. pydeps is pretty fast(*) because it uses modulefinder. An ast-based approach would have to build tree-structures...

The next version of pydeps will have a `call_pydeps(file_or_dir, **kwargs)` function where you only have to specify the options you want to override.

v1.12.5 is now available on PyPI.

@skroth pydeps (and Python's modulefinder) doesn't do any semantic analysis, i.e. it only scans the .pyc files for opcodes related to imports, so unfortunately there is no way to check...

modulegraph seems to be built on the same foundational technology and does some work to support namespace packages (https://github.com/ronaldoussoren/modulegraph/blob/master/modulegraph/modulegraph.py#L63)