is there a way to include my `python_distribution`...
# general
is there a way to include my
as a first party dependency in other code? i have a repo that looks something like this:
Copy code
- src
   - internal_lib
       - internal_lib
           - (and other files)
   - other_app:
      python files that ideally do import internal_lib.asdf
internal_lib has a
in its
file, so i’d basically like to be able to just do
import internal_lib.module
in my other
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.
This should just work, as far as I can tell. If you
import 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.
You shouldn’t have to change the import path (
) based on how you consume the code
I suspect that you want
to be a source root, so that imports are always
import internal_lib.module
, and you want your
to respect that.
yeah the source root was the issue, thanks 🙂
hmm but now my package command is goofy
i’ll have to take a look