aloof-angle-91616
07/29/2018, 8:19 PMsetup.py
files for pants python_dist()
targets in a context that gives them access to pants code (in this case, so that the setup.py can import a pants module which extends distutils/setuptools classes. it is entirely possible to write the distutils/setuptools extensions as a completely separate pypi module, as they don't currently need to rely on other parts of pants, and could then just be accessed using setup_requires
in the python_dist()
target (and this is actually pretty reasonable). however, it seems like it should be possible to somehow expose the running pants environment to the setup.py invocation we do in BuildLocalPythonDistributions
and/or SetupPyRunner
, so the setup.py can just do: from setuptools import find_packages
from distutils.core import Extension
from pants.some.module import setup
setup(
# ...,
ext_modules=[Extension(...)],
packages=find_packages(),
I assume this would be done either by creating a pex with the pants requirement, or by adding something to PYTHONPATH
in the executing environment for the setup.py.
this probably isn't that hard when using pants in any other repo besides the pants repo because we can expect a pex with all the relevant pants code to be available, since that is how pants is released, but i can't figure out how to expose the python code from the running pants to a setup.py invocation (i may be trying to go about this all wrong). there's a very little more context in https://github.com/pantsbuild/pants/issues/5661enough-analyst-54434
07/29/2018, 8:30 PMenough-analyst-54434
07/29/2018, 8:30 PMaloof-angle-91616
07/29/2018, 9:21 PMpython_dist()
depend on a pants_requirement()
in the setup_requires
kwarg in the BUILD file which already works great thanks to chris -- my concern was how to make it reflect the running version of pants without having to write down the version string anywhere, mostlyenough-analyst-54434
07/29/2018, 9:42 PMaloof-angle-91616
07/29/2018, 9:43 PMpython_dist()
can't depend on python_library()
yetenough-analyst-54434
07/29/2018, 9:43 PMaloof-angle-91616
07/29/2018, 9:43 PMaloof-angle-91616
07/29/2018, 9:43 PMenough-analyst-54434
07/29/2018, 9:44 PMaloof-angle-91616
07/29/2018, 9:44 PMpython_library()
to have a provides=
? would we copy the sources over into the dist before building?)aloof-angle-91616
07/29/2018, 9:44 PMaloof-angle-91616
07/29/2018, 9:46 PMSetupPy
now and this is greatenough-analyst-54434
07/29/2018, 9:46 PMaloof-angle-91616
07/29/2018, 9:46 PMaloof-angle-91616
07/29/2018, 9:48 PMpython_library()
needed to have a provides=
to be setup.py-able. i'm not sure why i thought that, but the description you just gave sounds optimal to meenough-analyst-54434
07/29/2018, 9:49 PMaloof-angle-91616
07/29/2018, 9:50 PMaloof-angle-91616
07/30/2018, 1:30 AMsetup_requires
and then circle back around to this