I'm trying to add `python_distribution` in the Sta...
# general
p
I'm trying to add
python_distribution
in the StackStorm repo... 😰 I've got the targets setup, a plugin to configure setup.py kwargs, and macros to reduce a bit more of the boilerplate. So far so good. But, I'm struggling with
dependencies
for the `python_distribution`s. In the old/manual setup.py (that I want to avoid because of so much copy paste, including copies of
dist_utils
functions... ick), it just used
packages=find_packages(exclude["setuptools", "tests"]),
to get the single package in that directory. Do people often have to add dependencies to all of the sub directories? I keep getting
NoOwnerError: No python_distribution target found to own
<some file or other that changes every time>. Is there a way to force pants to build incomplete wheels? I want to see what it has so far, but it seems I have to have all of the inter-dependent packages configured first.
c
Just guessing here now, but isn't there a no owners behavior option, like “ignore”?
p
Sounded plausible, but I couldn't find such an option.
c
Hmm.. you’re right. There doesn’t seem to be an escape hatch for this. I think this is the relevant docstring from the python backend rule `get_exporting_owner`:
“”"Find the exported target that owns the given target (and therefore exports it).
The owner of T (i.e., the exported target in whose artifact T’s code is published) is:
1. An exported target that depends on T (or is T itself).
2. Is T’s closest filesystem ancestor among those satisfying 1.
If there are multiple such exported targets at the same degree of ancestry, the ownership
is ambiguous and an error is raised. If there is no exported target that depends on T
and is its ancestor, then there is no owner and an error is raised.
“”"
Depending on where (in the python package namespace) this module is, perhaps you can “fake” the code be treated like a 3rdparty dep? (guessing that pulling the sources into the python dist in question is a no go)
By fake, I’m thinking about adding a python_requirement target for it, possibly with a module mapping to pick it up as such.
p
I just went through adding a bunch of directories to dependencies and finally got it to build. It feels so odd to do that though.
🙈 1
I shall force myself to go to bed now.
💯 1
c
Oh, I know that feeling. 🛏️
h
The python_distribution shouldn't typically need many dependencies. It does need explicit deps on its entry point(s), but all the transitive deps of those should be inferred.
So I'm curious as to why you needed to add many manual deps
p
These modules were not distributed as wheels before, so I have to figure out any missing metadata. The few entry points I have added should be injected into the python_distribution's setup kwargs by one of my plugins (the stevedore_extensions plugin) Then there are a series of scripts (not entry points) I need to register but I haven't looked up how to do that yet, or of pants even supports scripts (a top level kwarg for setup.py's setup -- each script is a file in the bin directory. Some are shell scripts and the rest are kebab-case python scripts.)
h
I see. Still, I think you should only have to manually add BUILD file deps on entry points, and everything else should be inferred.
(this is orthogonal to the setup kwargs)