[issue25024] Allow passing "delete=False" to TemporaryDirectory

2021-11-02 Thread Maksim Beliaev
Maksim Beliaev added the comment: just want to correct code that Nils post in the last comment to really take args and kwargs ~~~ def mkdtemp_persistent(*args, persistent=True, **kwargs): if persistent: @contextmanager def normal_mkdtemp(): yield tempfile.mkdte

[issue25024] Allow passing "delete=False" to TemporaryDirectory

2021-05-26 Thread Nils Kattenbeck
Nils Kattenbeck added the comment: While the proposal linked by C.A.M. solves one of the use cases but it does not address the others. One use cases which is rather common for me it is e.g. to have scripts/programs which allow configuring whether temporary directories should get deleted or

[issue25024] Allow passing "delete=False" to TemporaryDirectory

2021-03-08 Thread C.A.M. Gerlach
Change by C.A.M. Gerlach : -- pull_requests: +23561 pull_request: https://github.com/python/cpython/pull/24793 ___ Python tracker ___ __

[issue25024] Allow passing "delete=False" to TemporaryDirectory

2021-03-06 Thread C.A.M. Gerlach
C.A.M. Gerlach added the comment: To note, the proposal on [BPO-29982](https://bugs.python.org/issue29982) should hopefully address one of the two use-cases described by Anthony Sotittle, `ignore_errors=True`, in a cleaner fashion that takes advantage of the existing higher-level functionali

[issue25024] Allow passing "delete=False" to TemporaryDirectory

2021-02-27 Thread Ashwin Ramaswami
Ashwin Ramaswami added the comment: I agree -- as a user, it wasn't clear to me from looking at the documentation that mkdtemp was the right way to go to not delete directories. I had expected that NamedTemporaryDirectory would also support delete=False, just like NamedTemporaryFile. Given

[issue25024] Allow passing "delete=False" to TemporaryDirectory

2020-12-06 Thread Richard
Richard added the comment: Sorry for reviving a 9 months old issue, but IMO there was no good reason to reject this especially when a patch was provided. Even if the context manager can be replaced with 3 lines of code, I still don't consider that very user-friendly. My use case would be pa

[issue25024] Allow passing "delete=False" to TemporaryDirectory

2020-03-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Well, then I think there is nothing to do this. Compatibility with context manager protocol is not a goal if it does nothing on exit. In any case you can easy to make it in three lines: @contextmanager def mymkdtemp(): yield mkdtemp() NamedTemporaryFi

[issue25024] Allow passing "delete=False" to TemporaryDirectory

2020-03-26 Thread Anthony Sottile
Anthony Sottile added the comment: you are right though, the effect is the same as just using mkdtemp -- ___ Python tracker ___ ___

[issue25024] Allow passing "delete=False" to TemporaryDirectory

2020-03-26 Thread Anthony Sottile
Anthony Sottile added the comment: the differences are api compatibility with context manager protocol and equivalence with NamedTemporaryFile NamedTemporaryFile(delete=False) is just `mkstemp` afaict and the api is there -- ___ Python tracker

[issue25024] Allow passing "delete=False" to TemporaryDirectory

2020-03-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Could you please explain the difference between hypothetical TemporaryDirectory(delete=False) and simple mkdtemp()? -- ___ Python tracker

[issue25024] Allow passing "delete=False" to TemporaryDirectory

2020-03-26 Thread Anthony Sottile
Anthony Sottile added the comment: Serhiy's comment provides workarounds but are still (imo) inferior to supporting this. I would really like for this api to match that of NamedTemporaryFile which has the same `delete=...` option -- ___ Python tr

[issue25024] Allow passing "delete=False" to TemporaryDirectory

2020-03-26 Thread Mauro S. M. Rodrigues
Mauro S. M. Rodrigues added the comment: So per Serhiy comment can I assume the patch is not necessary? If so I believe the issue should be closed as well. -- ___ Python tracker

[issue25024] Allow passing "delete=False" to TemporaryDirectory

2020-03-17 Thread Anthony Sottile
Anthony Sottile added the comment: oh! that's neat, yeah hadn't been following closely enough it seems, good to hear that the readonly thing is fixed! -- ___ Python tracker

[issue25024] Allow passing "delete=False" to TemporaryDirectory

2020-03-17 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: If you want the conditional cleanup, then TemporaryDirectory is obviously a wrong tool. mkdtemp looks more appropriate. If you remove directory in process of working with temporary directory, would it help if you create a subdirectory in the temporary dire

[issue25024] Allow passing "delete=False" to TemporaryDirectory

2020-03-17 Thread Anthony Sottile
Anthony Sottile added the comment: one example is here: https://github.com/pre-commit/pre-commit/blob/bb6f1efe63c168d9393d520bd60e16c991a57059/pre_commit/store.py#L137-L139 where I would want cleanup in the exceptional case another (related but different) closed-source use case involves crea

[issue25024] Allow passing "delete=False" to TemporaryDirectory

2020-03-17 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: What is your use case Anthony? -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsu

[issue25024] Allow passing "delete=False" to TemporaryDirectory

2020-03-17 Thread Antony Lee
Change by Antony Lee : -- nosy: -Antony.Lee ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyt

[issue25024] Allow passing "delete=False" to TemporaryDirectory

2020-03-17 Thread Mauro S. M. Rodrigues
Mauro S. M. Rodrigues added the comment: Hi Anthony, Thanks for asking, yeah I'm interested in push a new version. I'll do it later today and I'll post a link to the pr here. -- ___ Python tracker ___

[issue25024] Allow passing "delete=False" to TemporaryDirectory

2020-03-16 Thread Anthony Sottile
Anthony Sottile added the comment: I would certainly like to see this, it would eliminate my last few hand rolled temporary directory contexts Mauro would you be interested in re-posting this patch as a PR to github? (or allowing someone else to carry your patch forward?) -- nosy: +

[issue25024] Allow passing "delete=False" to TemporaryDirectory

2015-10-05 Thread Mauro S. M. Rodrigues
Mauro S. M. Rodrigues added the comment: Hi everybody! This is my second patch on the community, although the first one is not merged, so any feedback is appreciated. I've added tests to cover this new situation and docs to let people know about the possibility of keeping their temporary dire

[issue25024] Allow passing "delete=False" to TemporaryDirectory

2015-09-10 Thread Antoine Pitrou
Antoine Pitrou added the comment: The idea looks ok to me, but you'd have to provide a patch. -- ___ Python tracker ___ ___ Python-bug

[issue25024] Allow passing "delete=False" to TemporaryDirectory

2015-09-10 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I'm inclined to reject this idea too. -- nosy: +georg.brandl, ncoghlan, pitrou, serhiy.storchaka ___ Python tracker ___ __

[issue25024] Allow passing "delete=False" to TemporaryDirectory

2015-09-08 Thread R. David Murray
R. David Murray added the comment: The two cases are not parallel, in that NamedTemporaryFile closes the file at the end of the context manager, whereas the *only* thing the TemporaryDirectory does is delete the directory on cleanup. There is some value to the "parallel interface" argument, so

[issue25024] Allow passing "delete=False" to TemporaryDirectory

2015-09-07 Thread Antony Lee
New submission from Antony Lee: I would like to suggest allowing passing "delete=False" to the TemporaryDirectory constructor, with the effect that the directory is not deleted when the TemporaryDirectory context manager exits, or when the TemporaryDirectory object is deleted. I realize that