...that might not be the best example. but the key...
# general
w
...that might not be the best example. but the keywords are
provides=setup_py(..)
f
reviving this… how does this work w/ 3rdparty deps? trying the naive thing, I’m getting errors like:
FAILURE: No exported target owner found for PythonLibrary(BuildFileAddress(3rdparty/python/BUILD.pants, enum34))
w/ a BUILD file that looks something like:
Copy code
python_library(
  sources=['the_thing.py'],
  dependencies=[
    '3rdparty/python:enum34',
    '3rdparty/python:numpy',
  ],
  provides=setup_py(
    name='name-of-package',
    version='0.0.1',
  )
)
and building w/
./pants setup-py --setup-py-run="bdist_wheel" src/python/the/thing
looking at the code: https://github.com/pantsbuild/pants/blob/f30c612f7b9c70e0b1f4cf234d8c9155a8b27508/src/python/pants/backend/python/tasks/setup_py.py#L276 makes it sound like those 3rdparty deps should be somehow marked as
is_third_party
, which seems like it would resolve this issue
but in fact, that comment seems to be the only reference to
is_third_party
I can find in the repo…
w
the "is_third_party" method was replaced with approximately an
isinstanceof(..., PythonRequirements)
, iirc.
is that 3rdparty code actually 3rdparty?
f
ah! thank you. that target is an “alias” (really just a
python_library
with a single dependency) on the “actual” 3rdparty requirement
w
oh. interesting.
f
depending on the actual requirement and not the alias seems to work
w
i think that might be bug... we should walk through the alias
oh. but to make an alias, you should either use
target(..)
or
alias(..)
f
it’s like:
Copy code
python_library(
  name='enum34',
  dependencies=['3rdparty/python/enum34'],
)
w
i'm pretty sure
alias(..)
will work in this case, because it's rewritten in the build graph
f
so yeah, might be if we were using “real” aliases this would work
w
it will. 99% sure.
alias(..)
in particular
f
but anyway, in this case the alias is just to gradually move off of 3rdparty/python:enum34 style targets to 3rdparty/python/enum34:enum34 targets. so it’s easy enough to use the “actual” target