https://pantsbuild.org/ logo
#general
Title
# general
w

witty-crayon-22786

01/07/2019, 8:55 PM
...that might not be the best example. but the keywords are
provides=setup_py(..)
f

fierce-park-88503

01/14/2019, 10:24 PM
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

witty-crayon-22786

01/14/2019, 10:54 PM
the "is_third_party" method was replaced with approximately an
isinstanceof(..., PythonRequirements)
, iirc.
is that 3rdparty code actually 3rdparty?
f

fierce-park-88503

01/14/2019, 10:56 PM
ah! thank you. that target is an “alias” (really just a
python_library
with a single dependency) on the “actual” 3rdparty requirement
w

witty-crayon-22786

01/14/2019, 10:56 PM
oh. interesting.
f

fierce-park-88503

01/14/2019, 10:56 PM
depending on the actual requirement and not the alias seems to work
w

witty-crayon-22786

01/14/2019, 10:56 PM
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

fierce-park-88503

01/14/2019, 10:57 PM
it’s like:
Copy code
python_library(
  name='enum34',
  dependencies=['3rdparty/python/enum34'],
)
w

witty-crayon-22786

01/14/2019, 10:57 PM
i'm pretty sure
alias(..)
will work in this case, because it's rewritten in the build graph
f

fierce-park-88503

01/14/2019, 10:57 PM
so yeah, might be if we were using “real” aliases this would work
w

witty-crayon-22786

01/14/2019, 10:58 PM
it will. 99% sure.
alias(..)
in particular
f

fierce-park-88503

01/14/2019, 10:58 PM
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
2 Views