Add redirect_stdout(..., per_thread: bool = False)#167
Add redirect_stdout(..., per_thread: bool = False)#167Liam-DeVoe wants to merge 3 commits intoQuansight-Labs:mainfrom
redirect_stdout(..., per_thread: bool = False)#167Conversation
| .claude/settings.local.json | ||
|
|
There was a problem hiding this comment.
(I used claude to iterate on this design, but I stand by every line in this PR myself!)
There was a problem hiding this comment.
That's cool, but please don't add personal files to project .gitignores. That's what .git/info/exclude is for.
- Patterns which are specific to a particular repository but which do not need to be shared with other related repositories (e.g., auxiliary files that live inside the repository but are specific to one user’s workflow) should go into the
$GIT_DIR/info/excludefile.
There was a problem hiding this comment.
(To be clear, when I say "that's cool", it's a completely meaningless phrase because I'm not a committer here, and I have no idea what the project policy is on AI contributions. It may be cool, or it may be very not cool.) ¯\_(ツ)_/¯
There was a problem hiding this comment.
While I agree in principle, in practice, if one expects a tool to be used by multiple developers, it's pragmatic to add that tool's ignorable files to the project's .gitignore.
For example, projects generally gitignore editor config files like .vscode/, even though the project is not related to any specific editor.
There was a problem hiding this comment.
Agreed, this is perfectly fine to add
|
lysnikolaou
left a comment
There was a problem hiding this comment.
Really amazing work @Liam-DeVoe! Great set of tests as well!
|
@Liam-DeVoe I'm planning to go over this with you a little bit during our meeting later today. |
|
Yup sounds like a great use of time 👍 |
Closes #29.
This design takes inspiration from the design sketched by @colesbury in python/cpython#130148 (comment), with some changes required to support interleaving
per_thread=Falseandper_thread=True.If a
per_thread=Falsecontext manager is entered (from any thread) while aper_thread=Truecontext manager is active in some thread A, output from A will go to theper_thread=Falsestream. IMO this matches the expectation thatredirect_stdoutcaptures all output from all threads; if you don't want this behavior, passper_thread=True.This test illustrates the new thread–isolation capabilities: