Hello, is there an easy way to inspect the setup.p...
# general
b
Hello, is there an easy way to inspect the setup.py that is auto-generated from a python_distribution target?
āœ… 1
b
I think it is probably consider generated code, so running
pants export-codegen path/to:distribution
may output it into a subfolder of
dist/
. (I’m not sure though, so I may be giving you bad advice šŸ˜… )
l
One way to do it is to look at the sandbox. For example if you run:
Copy code
pants --keep-sandboxes=always --no-local-cache package helloworld:py_dist
(in this case I added a python_distribution to example-python and called it
helloworld:py_dist
). then you'll see something like:
Copy code
15:51:01.51 [INFO] Preserving local process execution dir /private/var/folders/z4/dvm2try15dg7gl1vcc_6pv140000gn/T/pants-sandbox-WBRGRi for Run setuptools.build_meta:__legacy__ for helloworld:py_dist
15:51:01.79 [INFO] Wrote dist/helloworlddist-1.0.0-py3-none-any.whl
15:51:01.79 [INFO] Wrote dist/helloworlddist-1.0.0.tar.gz
get logged at the end. Then you can look in the sandbox and you will find the generated setup.py.
Copy code
$ cat /private/var/folders/z4/dvm2try15dg7gl1vcc_6pv140000gn/T/pants-sandbox-WBRGRi/chroot/setup.py

# DO NOT EDIT THIS FILE -- AUTOGENERATED BY PANTS
# Target: helloworld:py_dist

from setuptools import setup

setup(**{
    'install_requires': (
        'helloworld.translator==0.0.1',
        'setuptools<57,>=56.2.0',
        'types-setuptools<58,>=56.2.0',
    ),
    'name': 'helloworlddist',
    'namespace_packages': (
    ),
    'package_data': {
        'helloworld.greet': (
            'translations.json',
        ),
    },
    'packages': (
        'helloworld',
        'helloworld.greet',
    ),
    'python_requires': '==3.9.*',
    'version': '1.0.0',
})
šŸ’Æ 1
Huon, I tried export-codegen and it won't do it. I guess it isn't considered codegen in the same way that .proto => .py is considered codegen.
Copy code
$ pants export-codegen helloworld:py_dist

15:57:08.40 [WARN] No codegen files/targets matched. All codegen target types: experimental_wrap_as_python_sources, experimental_wrap_as_resources, file, resource
šŸ‘ 1
h
Yeah, it's not codegen in that sense
Poking in the sandbox seems to be the way to go