fresh-cat-90827
08/18/2022, 3:06 PMpython_distribution
target using a handwritten setup.py
file. The docs say that
If you use a handwritten setup.py ... Pants will bundle whatever the script tells it to.Running
python3 setup.py bdist_wheel
produces a wheel with expected contents, whereas ./pants package //:say-hello
produces a wheel with dist-info
metadata only. Have I misunderstood how Pants runs the existing setup.py
?BUILD
file:
python_sources(
name="setup-py",
sources=["setup.py"],
)
python_distribution(
name="say-hello",
dependencies=[":setup-py"],
provides=python_artifact(
name="say-hello",
),
generate_setup=False,
sdist=False,
)
enough-analyst-54434
08/18/2022, 3:07 PMfresh-cat-90827
08/18/2022, 3:08 PMsetup.py
, Pants will run the setup()
function -- which does find the packages etcenough-analyst-54434
08/18/2022, 3:08 PMfresh-cat-90827
08/18/2022, 3:10 PMsetup.py
functionality (to find all the packages etc), then I have to make sure I get the whole tree with me as a dependency of python_distribution
?enough-analyst-54434
08/18/2022, 3:11 PMdependencies=[
":setup-py",
"/target/containing/actual:code",
]
fresh-cat-90827
08/18/2022, 3:22 PMpython_distribution(
name="say-hello",
dependencies=[
":setup-py",
":MANIFEST",
"helloworld:lib",
"helloworld/greet:lib",
"helloworld/greet:translations",
"helloworld/translator:lib",
],
I wonder if there's a shortcut to refer to all targets located under a directory? I can't use `helloworld::`:
UnsupportedWildcard: The address😕included a wildcard (helloworld::
), which is not supported.::
enough-analyst-54434
08/18/2022, 3:23 PMhappy-kitchen-89482
08/18/2022, 3:23 PMenough-analyst-54434
08/18/2022, 3:23 PMfresh-cat-90827
08/18/2022, 3:27 PMpython_distribution(
name="say-hello",
dependencies=[
":setup-py",
":MANIFEST",
"helloworld:pex_binary"
is enough indeed.
Reading the docs, I thought using pex_binary
won't be enough because its transitive dependencies wouldn't be picked up:
Naively, you might think that a python_distribution publishes all the code of all the python_source targets it transitively depends on. But that could easily lead to trouble if you have multiple distributions that share common dependencies. You typically don't want the same code published in multiple distributions, as this can lead to all sorts of runtime import issues.
happy-kitchen-89482
08/18/2022, 4:03 PM