Skip to content

Improving the presentation of exceptions within in-process runs #156

@pradyunsg

Description

@pradyunsg

One of the things I'm thinking of (but haven't actioned on in any way, so far) is adopting something similar to pip's setuptools shim in this project. With that, we'd basically be passing the runner-code as a string and calling it within an exec() call within a runner shim.

Basically, that changes the tracebacks from...

Traceback (most recent call last):
  File "/Users/pradyunsg/Developer/github/pip/src/pip/_vendor/pep517/in_process/_in_process.py", line 351, in <module>
    main()
  File "/Users/pradyunsg/Developer/github/pip/src/pip/_vendor/pep517/in_process/_in_process.py", line 333, in main
    json_out['return_val'] = hook(**hook_input['kwargs'])
  File "/Users/pradyunsg/Developer/github/pip/src/pip/_vendor/pep517/in_process/_in_process.py", line 118, in get_requires_for_build_wheel
    return hook(config_settings)
  File "/private/var/folders/y1/j465wvf92vs938kmgqh63bj80000gn/T/pip-build-env-g800knhv/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 338, in get_requires_for_build_wheel
    return self._get_build_requires(config_settings, requirements=['wheel'])
[blah blah]

to:

Traceback (most recent call last):
  File "<string>", line 2, in <module>
  File "<pyproject-hooks-runner>", line 351, in <module>
    main()
  File "<pyproject-hooks-runner>", line 333, in main
    json_out['return_val'] = hook(**hook_input['kwargs'])
  File "<pyproject-hooks-runner>", line 118, in get_requires_for_build_wheel
    return hook(config_settings)
  File "/private/var/folders/y1/j465wvf92vs938kmgqh63bj80000gn/T/pip-build-env-g800knhv/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 338, in get_requires_for_build_wheel
    return self._get_build_requires(config_settings, requirements=['wheel'])
[blah blah]

This might also help with #148, assuming we treat the current in_process code as "data" within the package (which is a reasonable thing to do).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions