How to publicly expose package interface cleanly? Relative imports are polluting the namespace

31 Views Asked by At

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
0

There are 0 best solutions below