Skip to content

Conversation

@giograno
Copy link
Member

@giograno giograno commented Oct 15, 2025

Motivation

This PR attempts to simplify the logic of the new_tmp_dir utility functions.
The original implementation uses tempfile.mkstemp and first closes the file descriptor of the created file, then removes the created directory, and finally, re-creates it.

The new implementation relies on tempfile.mkdtemp. It also preserves the original behavior by changing the permissions (tempfile.mkdtemp would come with 0o700 while mkdir has 0o777).

Changes

  • Rewrite the new_tmp_dir function with tempfile.mkdtemp, as explained above.

@giograno giograno added this to the Playground milestone Oct 15, 2025
@giograno giograno self-assigned this Oct 15, 2025
@giograno giograno added semver: patch Non-breaking changes which can be included in patch releases docs: skip Pull request does not require documentation changes notes: skip Pull request does not have to be mentioned in the release notes labels Oct 15, 2025
@github-actions
Copy link

github-actions bot commented Oct 15, 2025

Test Results - Preflight, Unit

22 337 tests  ±0   20 587 ✅ ±0   15m 57s ⏱️ - 1m 5s
     1 suites ±0    1 750 💤 ±0 
     1 files   ±0        0 ❌ ±0 

Results for commit bd7961a. ± Comparison against base commit 5c97be4.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Oct 15, 2025

LocalStack Community integration with Pro

    2 files  ±0      2 suites  ±0   2h 1m 1s ⏱️ - 1m 28s
4 871 tests ±0  4 516 ✅ ±0  355 💤 ±0  0 ❌ ±0 
4 873 runs  ±0  4 516 ✅ ±0  357 💤 ±0  0 ❌ ±0 

Results for commit bd7961a. ± Comparison against base commit 5c97be4.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

Test Results (amd64) - Acceptance

7 tests  ±0   5 ✅ ±0   3m 22s ⏱️ -3s
1 suites ±0   2 💤 ±0 
1 files   ±0   0 ❌ ±0 

Results for commit bd7961a. ± Comparison against base commit 5c97be4.

@github-actions
Copy link

Test Results (amd64) - Integration, Bootstrap

    5 files  ±0      5 suites  ±0   2h 39m 53s ⏱️ +11s
5 245 tests ±0  4 730 ✅ ±0  515 💤 ±0  0 ❌ ±0 
5 251 runs  ±0  4 730 ✅ ±0  521 💤 ±0  0 ❌ ±0 

Results for commit bd7961a. ± Comparison against base commit 5c97be4.

@giograno giograno requested a review from dfangl October 16, 2025 07:32
@giograno giograno marked this pull request as ready for review October 16, 2025 07:35
Copy link
Member

@dfangl dfangl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for adding proper typing as well!

folder = new_tmp_file(dir=dir)
rm_rf(folder)
mkdir(folder)
def new_tmp_dir(dir: str | None = None, mode: int = 0o777) -> str:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: a docstring explaining some of the behavior here would be nice as well. Totally optional though!

@giograno giograno merged commit 1913637 into main Oct 16, 2025
12 checks passed
@giograno giograno deleted the new-tmp-dir branch October 16, 2025 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs: skip Pull request does not require documentation changes notes: skip Pull request does not have to be mentioned in the release notes semver: patch Non-breaking changes which can be included in patch releases

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants