<div dir="ltr"><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">Hello,<br><br></div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">In the current incarnation Pathlib is missing some key features I need in my usecases. I want to contribute them but i'd like a bit of feedback on the new api before jumping to implementation.<br><br></div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">The four things I need are:<br><br></div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">#1. A context manager for temporary files and dirs (that cleans everything up on exit). Eg:<br><br></div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">with pathlib.TmpDir(suffix='', prefix='') as tmp:<br></div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">  assert isinstance(tmp, pathlib.Path)<br><br><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">with pathlib.TmpFile(suffix='', prefix='') as tmp:<br></div>  assert isinstance(tmp, pathlib.Path)<br><br></div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">#2. A context manager for changing working directory (that switches to the old cwd on exit). Eg:<br><br><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">with <a href="http://path.cd">path.cd</a>():<br></div> assert os.getcwd() == path<br></div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif"><br></div>#<div class="gmail_default" style="font-family:trebuchet ms,sans-serif;display:inline">​3​</div>. Shutil-like features:<br><div class="gmail_default" style="font-family:trebuchet ms,sans-serif"><br></div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">- copy_file<br></div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">- copy_dir (or copy_tree?)<br></div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">- copy (does copy_dir or copy_file depending on what the source is. How to handle symlinks?)<br></div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">- rm_dir (or rm_tree? Also, this would be required for the TmpDir path).<br><br></div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif"><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">#4.
 Zip files support. A specialised Path subclass that works inside a zip 
file. I'm ok having this as an external package but some discussion 
would be useful as I'd have to rely on pathlib internals.<br><br></div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">After
 some brief looking in the pathlib code it would appear the wise thing 
would be to have the zip path as the "drive" for the ZipPaths that refer
 to files inside the zip.<br><br></div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">I'm not sure where the best place is to store the internal zipfile object. Perhaps the accessor?<br></div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif"><br></div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">Ideally the ZipFiles would work with the shtuil-like api just fine (or at least the readonly operations).</div></div><div><div class="gmail_signature"><div dir="ltr"><span style="font-family:trebuchet ms,sans-serif"><span style="color:rgb(51,51,51)"><br><font><span style="color:rgb(51,51,51)">Thanks,</span><br><span style="color:rgb(153,153,153)">-- Ionel</span></font></span><font><font style="color:rgb(153,153,153)"> M.</font></font><br></span></div></div></div>
</div>