acceptable-football-32760
03/23/2022, 3:30 PMpackage_a/
a.py
BUILD -> python_distribution(name = "package_a")
package_b/
b.py -> imports package_a.a
BUILD -> python_distribution(name = "package_b")
My previous understanding was that when building wheels for package_b
, it would detect automatically the dependency on package_a
(via the respective file a.py
) and I don't need to list this dependency explicityly in python_distribution
i.e. package_b
will just include the sources and transitive deps of the package_a
However, some recent experiments show it is not true, so I must include //package_a
as a dep
of package_b
. Is that correct? Doesn't this defeat the idea of pants taking over dep management, so that if later the actual import of a.py
is removed, there's not dangling dependency on package_a
remaining?
Thanks! I hope I explained my issue clearly, LMK if I can refine.fast-nail-55400
03/23/2022, 3:34 PMfast-nail-55400
03/23/2022, 3:34 PM./pants dependencies
or ./pants dependees
output)fast-nail-55400
03/23/2022, 3:35 PMacceptable-football-32760
03/23/2022, 4:02 PM〉./pants dependencies --dependencies-transitive package_b/src/b.py
(prints nothing)
〉./pants dependencies --dependencies-transitive package_b/src
package_b/src/b.py
〉./pants dependencies --dependencies-transitive package_b
package_b/src/b.py
For completeness, the zip attached and the structure is (in the same repo)
package_a
├── src
│ ├── a.py
│ └── BUILD
└── BUILD
package_b
├── src
│ ├── b.py
│ └── BUILD
└── BUILD
happy-kitchen-89482
03/23/2022, 9:02 PMhappy-kitchen-89482
03/23/2022, 9:03 PMhappy-kitchen-89482
03/23/2022, 9:04 PMhappy-kitchen-89482
03/23/2022, 9:05 PMhappy-kitchen-89482
03/23/2022, 9:05 PMacceptable-football-32760
03/23/2022, 10:01 PMa.py
owned by some package producing a wheel. This makes sense.
P.S. Yes (to your initial question), somehow I was thinking that even in presense of another owning wheel-creating package package_a
, the individual sources like a.py
shall be included directly into anyone who wants them, like package_b
.
P.P.S. Docs are amazinghappy-kitchen-89482
03/24/2022, 3:02 PMhappy-kitchen-89482
03/24/2022, 3:03 PMRequires
metadata appropriatelyhappy-kitchen-89482
03/24/2022, 3:04 PMrequires
keyword in the setup.py it generates, and then it builds a wheel from that setup.pyacceptable-football-32760
03/30/2022, 12:07 PMpackage_b
with pex_b
(i.e. pex depends on a file a.py
owned by a distribution package_a
) - is this expected that pex includes the whole of package_a
? From what I see, when building pex_b
I need no special dependencies = [...]
clause in pex_binary
.
Actually it makes sense - just means that pex will contain the wheel of package_b
inside and run normally.happy-kitchen-89482
03/30/2022, 9:28 PMhappy-kitchen-89482
03/30/2022, 9:28 PMhappy-kitchen-89482
03/30/2022, 9:29 PMhappy-kitchen-89482
03/30/2022, 9:29 PMacceptable-football-32760
03/31/2022, 1:55 PM