I split my answers up to address different issues in different threads.
On 31.12.20 15:32, Todd wrote:
Hi Sven,
Thanks for your support and feedback.
On Thu, Dec 31, 2020, 07:23 Sven R. Kunze <srku...@mail.de
<mailto:srku...@mail.de>> wrote:
Hi Todd,
my comments below. Also would offer my time for reviewing/testing
if wanted.
On 22.11.20 20:53, Todd wrote:
I know enhancements to pathlib gets brought up occasionally, but
it doesn't look like anyone has been willing to take the
initiative and see things through to completion. I am willing to
keep the ball rolling here and even implement these myself. I
have some suggestions and I would like to discuss them. I don't
think any of them are significant enough to require a pep. These
can be split it into independent threads if anyone prefers.
1. copy
The big one people keep bringing up that I strongly agree on is a
"copy" method. This is really the only common file manipulation
task that currently isn't possible. You can make files, read
them, move them, delete them, create directories, even do less
common operations like change owners or create symlinks or hard
links.
I really would appreciate that one. If I could through in another
detail which we needed a lot:
- atomic_copy or copy(atomic=True) whatever form you prefer
It is not as easy to achieve as it may look on the first sight.
Especially when it comes to tempfiles and permissions. The use
cases of atomic copy included scenarios for multiple parallel
access of files like caches in web development.
Is there already support for atomic writes in the standard library? I
am not planning on implementing anything new, only exposing existing
functionality. Adding atomic operations to the stslib would likely
require a pep and substantial discussion of API and implementation. I
don't really have the background to do that.
So far I didn't find any of this implemented in the stdlib but please
correct me if I am wrong.
As far as I know, one working pattern would be
1. creating a file or the directory structure using tempfile
2. then setting permissions from the original directory object
3. and finally moving it to its final destination (path and name)
The last part is done atomically at least in Linux (rename) and Windows
(ReplaceFile).
Especially setting permission an easy oversight which can cause issues
e.g. with xsendfile.
What would be the steps to do get it done?
Best
Sven
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/python-ideas@python.org/message/CKYIXT6XIR4IVYENNW2UBC6SP3PDYAGX/
Code of Conduct: http://python.org/psf/codeofconduct/