0

I want to create a clean package namespace so when user types pkg.mod they only see left and right in autocomplete. However I cannot figure out how to avoid autocomplete showing thing package name. I am using VSCode. How can I correct this?

Problem:

enter image description here

Directory structure

pkg/
   mod/
      __init__.py
      thing.py
   __init__.py

/mod/thing.py

left = 5
right = 5

/mod/__init__.py

__all__ = ['left','right']
from .thing import left, right

/__init__.py

__all__ =['mod']

from . import mod
sinoroc
  • 18,409
  • 2
  • 39
  • 70
Stevie
  • 326
  • 3
  • 16
  • Maybe it is a VSCode issue. -- Your Python code seems correct enough to me, although I can not say I ever deeply investigated this. You also have to be aware of what exactly `__all__` does, which is not much. And of course you need to remember that in Python everything is public (for some definition of "public"). – sinoroc May 17 '23 at 20:38

0 Answers0