cold-sugar-54376
08/25/2022, 12:21 AMpython_distribution as a first party dependency in other code? i have a repo that looks something like this:
- src
- internal_lib
- setup.py
- internal_lib
- __init__.py (and other files)
- other_app:
python files that ideally do import internal_lib.asdf
internal_lib has a python_distribution in its BUILD file, so i’d basically like to be able to just do import internal_lib.module in my other src code instead of having to do import internal_lib.internal_lib. The reason I need it to be an actual distribution is so I can distribute that code elsewhere as well.happy-kitchen-89482
08/25/2022, 4:57 AMimport internal_lib.asdf pants should infer the dependency on that module. There is no logic that says “since this is in a distribution, don’t depend on it. If that dep isn’t being inferred, it may be because source roots aren’t set up correctly in this case. In fact, since you mentioned that there would be a different import path depending on whether you consumed the code as first party or as a published artifact, that leads me to believe that there is a source roots issue.happy-kitchen-89482
08/25/2022, 4:58 AMinternal_lib.internal_lib.module vs internal_lib.module) based on how you consume the codehappy-kitchen-89482
08/25/2022, 4:58 AMsrc/internal_lib to be a source root, so that imports are always import internal_lib.module, and you want your setup.py to respect that.cold-sugar-54376
08/25/2022, 5:02 PMcold-sugar-54376
08/25/2022, 5:03 PMcold-sugar-54376
08/25/2022, 5:03 PM