question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for namespace packages (PEP 420)

See original GitHub issue

PEP 420 introduced implicit namespace packages, which are packages without __init__.py. Those packages, and the modules under them, don’t seem to appear in the dependency graph generated by pydeps.

Here’s an example. Given the following directory structure:

.
├── main.py
├── pkg1
│   └── foo.py
└── pkg2
    ├── bar.py
    └── __init__.py

And main.py:

import pkg1.foo
import pkg2.bar

pydeps main.py generates the following graph: image

I would have expected pkg1.foo to be included in the dependency graph. (On the other hand, I’m not sure there’s a point in having pkg1 there since it’s going to be empty.)

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:4
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
ssbarneacommented, Jul 21, 2020

That is a huge bug and --include-missing seems to avoid it but not without nasty side effects. Sadly I will not be able to adopt pydeps as part of the docs until is fixed.

0reactions
thebjorncommented, Jul 21, 2020

@ssbarnea I’m wondering if you’re using this feature to create namespace package, or if it’s simply to avoid having an __init__.py file? I’ve never found a reason to use namespace packages that outweigh the mess it causes. Regardless, pydeps is dependent on modulefinder (a python standard module - vendorized with some bug-fixes) supporting the feature first. I’ll happily merge a PR if you or anyone else wants to work on it though…

Read more comments on GitHub >

github_iconTop Results From Across the Web

PEP 420 – Implicit Namespace Packages
Namespace packages are designed to support being split across multiple directories (and hence found via multiple sys.path entries). In this ...
Read more >
Support PEP 420 -- Implicit Namespace Packages #13293
Support PEP 420 -- Implicit Namespace Packages #13293 ... Python resolves namespace packages by searching every sys.path entry for the name ...
Read more >
PEP 420 - implicit namespace packages - O'Reilly
If you use and target only Python 3, then there is good news for you. PEP 420 (Implicit Namespace Packages) introduced a new...
Read more >
pep 420 namespace_packages purpose in setup.py
What is the purpose of the namespace_packages argument in setup.py when working with PEP420 namespace packages (the ones without __init__.py)?.
Read more >
Support for implicit namespace packages PEP 420 : PY-7156
Support for implicit namespace packages PEP 420 ; Priority, Normal N ; Type, Feature ; State, Fixed F ; Assignee, Andrey Vlasovskikh ;...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found