intel / ad-rss-lib

Library implementing the Responsibility Sensitive Safety model (RSS) for Autonomous Vehicles
https://intel.github.io/ad-rss-lib/
GNU Lesser General Public License v2.1
338 stars 138 forks source link

Create a clean python setup for subpackages #258

Open Daraan opened 1 month ago

Daraan commented 1 month ago

When importing the library all subpackages are added to sys.modules as top-hierarchy packages/modules which creates ambigious imports. If I would have my own module/package named like any of the supackages the import order becomes important.

# file 1
import world  # imports my module, or the expected one from sys.path
import ad_rss
# file 2
import ad_rss
import world  # This is ad_rss.rss.world which is unexpected

sys.modules["core"], sys.modules["world"], sys.modules["unstructured"], ... these all should be appropriate subpackages of ad_rss and not their own package, e.g. sys.modules[ad_rss.rss.core]`