✨ Add support for standard tracebacks via the env TYPER_STANDARD_TRACEBACK#1299
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
TYPER_STANDARD_TRACEBACKTYPER_STANDARD_TRACEBACK
There was a problem hiding this comment.
As discussed, this PR adds the option to set an env var TYPER_STANDARD_TRACEBACK while still supporting the old var _TYPER_STANDARD_TRACEBACK too. We need to support both because we don't want to break existing workflows, but that does complicate the code slightly. I think that's an acceptable trade-off to ensure this variable can be properly set in AWS Lambda etc.
|
I will leave this PR for a final review by Tiangolo 🙏 |
|
It seems that I can't push to your branch |
b77ece1 to
0a41362
Compare
This comment was marked as outdated.
This comment was marked as outdated.
|
@tiangolo I've updated and tests are now passing. |
|
Thanks @colin-nolan! I've moved this back to Tiangolo's internal review queue 😉 |
|
Waiting on @tiangolo |
This comment was marked as resolved.
This comment was marked as resolved.
|
@colin-nolan: can you please turn on the option that maintainers can edit this PR? |
Keeps support fo `_TYPER_STANDARD_TRACEBACK` but notes as deprecated because: - It is non-standard for an advertised env to start with an underscore. - Environment variables that start with an underscore have been observed as causing issues in some execution environments (e.g. with AWS Lambda). See: fastapi#1284
0a41362 to
a75d349
Compare
|
@svlandeg I've resolved the merge conflict. I've tried to enable maintainers PR edits but, for some reason, the option to do this doesn't exist(?) (https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork) Edit: On reading the docs from GH again, I note (emphasis mine):
The fork is from a company account. Its ambiguous as to whether permission can be added post creation but that could well the be issue. |
|
Ok, thanks @colin-nolan! As Tiangolo had already approved earlier, and nothing changed since then other than merging in |

This PR allows standard tracebacks to be enabled using the environment variable:
TYPER_STANDARD_TRACEBACK.The work is a follow up to the discussion with @svlandeg: #1284.
The existing environment variable
_TYPER_STANDARD_TRACEBACKis retained but referred to as "deprecated" because:Manual testing with:
Produces expected results: