<div dir="ltr">On Fri, Mar 23, 2018 at 3:38 PM, Wes Turner <span dir="ltr"><<a href="mailto:wes.turner@gmail.com" target="_blank">wes.turner@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Here's a comparison table of os, os.path, shutil, pathlib, and path.py.</div></div></blockquote><div><br></div><div>Darn, that's a big list -- exactly what we want to avoid :-(<br><br></div><div dir="ltr">Though there are bunch of string methods in there that we can dump right off the bat.<br> <br><div>> ... trio wraps pathlib methods with async; which also might as well be done in pathlib?</div><div><br></div><div>hmm --that's s touch one -- a full set of async file operations would be great. But where to put them????<br><br></div><div>and most of what we are talking about doesn't need asnyc, does it? deleting/renaming a single, file, etc.<br><br></div><div>So my thought is that an asnyc lib should mirror / overwrite this file-operations-api. Which makes it a problem for the async lib(s) later on down the road.<br><br></div><div>BTW -- this is a nice argument for making this API in the first place -- then we have a single API to make an async version of!<br></div><div><br></div>- Does it make sense to copy the docstrings at import time every time?<div><br></div><div>copy from where? is this for the async version? or are you thinking that the new methods will simply be wrappers for the olds ones -- in which case, I think no -- this should be a new API with its own docs, whether or not a particular call is any different that the "old" one.<br></div><div><br></div>The big challenge is to identity what is "basic" or "normal" ratehr than advanced.<br></div><div dir="ltr"><br></div><div>here's a quick take on trimming down that whole table -- jsut my quick HO:<br></div><div dir="ltr"><div><font face="monospace, monospace"><br>attr table</font></div><div><font face="monospace, monospace">==========</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">================== == ======= ====== ======= =======</font></div><div><font face="monospace, monospace">attr os os.path shutil pathlib path.py</font></div><div><font face="monospace, monospace">================== == ======= ====== ======= =======</font></div><font face="monospace, monospace">`absolute`_ X</font><div><font face="monospace, monospace">`abspath`_ X X</font></div><div><font face="monospace, monospace">`access`_ X X</font></div><font face="monospace, monospace">`atime`_ X</font><div><font face="monospace, monospace">`basename`_ X X</font></div><font face="monospace, monospace"><br>`cd`_ X</font><br><br><div><font face="monospace, monospace">`commonpath`_ X</font></div><div><font face="monospace, monospace">`commonprefix`_ X</font></div><div><font face="monospace, monospace">`copy`_ X X</font></div><font face="monospace, monospace">`copytree`_ X X</font><br><font face="monospace, monospace"><br>`curdir`_ X X</font><div><font face="monospace, monospace">`dirname`_ X X</font></div><div><font face="monospace, monospace"><br>`drive`_ X X</font></div><div><font face="monospace, monospace"><br>`exists`_ X X X</font></div><font face="monospace, monospace"><br>`expanduser`_ X X X</font><div><font face="monospace, monospace">`expandvars`_ X X</font></div><div><font face="monospace, monospace">`ext`_ X</font></div><br><font face="monospace, monospace">`fnmatch`_ X X</font><br><br><font face="monospace, monospace">`get_owner`_ X</font><div><font face="monospace, monospace">`getatime`_ X X</font></div><div><font face="monospace, monospace">`getctime`_ X X</font></div><div><font face="monospace, monospace"><br>`getcwd`_ X X</font></div><div><font face="monospace, monospace">`getmtime`_ X X</font></div><div><font face="monospace, monospace"><br>`getsize`_ X X</font></div><div><font face="monospace, monospace"><br>`glob`_ X X</font></div><div><font face="monospace, monospace">`home`_ X</font></div><div><font face="monospace, monospace">`is_absolute`_ X</font></div><font face="monospace, monospace">`is_dir`_ X</font><br><br><font face="monospace, monospace">`is_symlink`_ X</font><div><font face="monospace, monospace">`isabs`_ X X</font></div><div><font face="monospace, monospace"><br>`isdir`_ X X</font></div><div><font face="monospace, monospace">`isfile`_ X X</font></div><div><font face="monospace, monospace">`islink`_ X X</font></div><br><font face="monospace, monospace">`iterdir`_ X</font><br><br><font face="monospace, monospace">`lchmod`_ X</font><br><br><font face="monospace, monospace">`link`_ X X</font><div><font face="monospace, monospace">`listdir`_ X X</font></div><div><font face="monospace, monospace"><br>`lstat`_ X X X</font></div><br><div><font face="monospace, monospace">`mkdir`_ X X X</font></div><font face="monospace, monospace">`makedirs`_ X X</font><br><br><font face="monospace, monospace">`match`_ X</font><div><font face="monospace, monospace">`merge_tree`_ X</font></div><br><font face="monospace, monospace">`move`_ X X</font><div><font face="monospace, monospace">`mtime`_ X</font></div><div><font face="monospace, monospace"><br>`normcase`_ X X</font></div><div><font face="monospace, monospace">`normpath`_ X X</font></div><div><font face="monospace, monospace"><br>`open`_ X X X</font></div><br><font face="monospace, monospace">`owner`_ X X</font><br><br><font face="monospace, monospace">`parent`_ X X</font><div><font face="monospace, monospace">`parents`_ X</font></div><br><font face="monospace, monospace">`relative_to`_ X</font><div><font face="monospace, monospace">`relpath`_ X X</font></div><div><font face="monospace, monospace">`relpathto`_ X</font></div><div><font face="monospace, monospace"><br>`remove`_ X X<br><br></font></div><font face="monospace, monospace">`removedirs`_ X X</font><font face="monospace, monospace"><br>`rename`_ X X X</font><br><font face="monospace, monospace">`replace`_ X X X</font><div><font face="monospace, monospace">`resolve`_ X</font></div><font face="monospace, monospace">`rglob`_ X</font><br><font face="monospace, monospace">`root`_ X</font><br><br><font face="monospace, monospace">`samefile`_ X X X</font><br><br><font face="monospace, monospace">`size`_ X</font><br><font face="monospace, monospace">`suffix`_ X</font><div><font face="monospace, monospace">`suffixes`_ X</font></div><font face="monospace, monospace">`symlink`_ X X</font><div><font face="monospace, monospace">`symlink_to`_ X</font></div><font face="monospace, monospace">`touch`_ X X</font><br><font face="monospace, monospace">`utime`_ X X</font><div><font face="monospace, monospace">`walk`_ X X</font></div><font face="monospace, monospace">`with_name`_ X</font><div><font face="monospace, monospace">`with_suffix`_ X X</font></div><div><font face="monospace, monospace">`write_bytes`_ X X</font></div><font face="monospace, monospace">`write_text`_ X X</font><br><font face="monospace, monospace"><br></font><br>These are about permissions -- challenging how to do that in a X-platform way...<br></div><div>And it would be good to group this sort of thing together.<br></div><div dir="ltr"><font face="monospace, monospace"><font face="monospace, monospace"><br>`chmod`_ X X X</font></font><div><font face="monospace, monospace">`chown`_ X X X</font></div><div><font face="monospace, monospace"><br></font></div><font face="monospace, monospace">================== == ======= ====== ======= =======</font><div class="gmail_extra"><br></div><div class="gmail_extra">Now that I've done that, I think it would be better to be systematic:<br><br></div><div class="gmail_extra">1) keep every method that pathlib.Path has<br></div><div class="gmail_extra">2) dump every method this is only a string method (and maybe everything that path has that nothign else has -- most of those are string methods<br></div><div class="gmail_extra">3) match the ones that are the same thing, but different names<br></div><div class="gmail_extra">4) match the ones that are almost the same thing:remove and removedir and removedirs<br></div><div class="gmail_extra"> - then we can hash out whether to join with flags, or keep separate<br></div><div class="gmail_extra">5) group by "class of functionality:<br></div><div class="gmail_extra"> - file nameing, etc<br></div><div class="gmail_extra"> - seraching (glob)<br></div><div class="gmail_extra"> - permission handling<br></div><div class="gmail_extra"> - etc.<br><br></div><div class="gmail_extra">That'll get it structured to capture the discussion.<br><br></div><div class="gmail_extra">-CHB<br><br></div>> Tinkered around at lunchtime with a module to bring them under one roof. Named it "f2" because "fs" was taken on PyPI and thought the name should be very short since it could potentially be used in every script, like os and sys are.<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
<a href="https://github.com/mixmastamyk/f2" rel="noreferrer" target="_blank">https://github.com/mixmastamyk<wbr>/f2</a><br></blockquote><div><br></div><div>This is a great idea to have a prototype of sorts, but I do'nt think we should take the approach of: make it, put it on pypi, and see if it gains traction -- this isn't adding anythign new, very few folks are going to want to crate a dependency to get a more discoverable api, and no one going to point newbies at it.<br><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Just poking around these questions came up about what to include:<br>
<br>
- Include file descriptors apis?<br>
</blockquote><div>no -- unless in an "advanced" api somewhere <br><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> - chroot?<br>
</blockquote><div>no <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> - l- functions to not follow links?<br>
</blockquote><div>maybe adanced, or optional flags <br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> - Unix dev files? obscure<br>
</blockquote><div><br></div><div>don't even know what this is, so no :-) <br><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> - pathconf?<br>
</blockquote><div><br></div><div>again, what is this? probabaly no.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> - supports_* api?<br>
</blockquote><div><br></div><div>no.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> - Only scandirs or walk too?<br></blockquote><div><br></div><div>walk is really useful and not trivial to write, so yes.<br></div><div><br> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
- Should unpack os.path functions into the root? Handy but many of them.<br>
</blockquote><div><br></div><div>no way.<br></div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
- Unpack file-related shutil functions? Or leave as submodule?<br></blockquote><div><br></div><div>make them methods on Path.<br></div><div><br></div><div>-CHB<br><br></div><br></div></div></div></div><br clear="all"><br>-- <br><div class="gmail_signature"><br>Christopher Barker, Ph.D.<br>Oceanographer<br><br>Emergency Response Division<br>NOAA/NOS/OR&R (206) 526-6959 voice<br>7600 Sand Point Way NE (206) 526-6329 fax<br>Seattle, WA 98115 (206) 526-6317 main reception<br><br><a href="mailto:Chris.Barker@noaa.gov" target="_blank">Chris.Barker@noaa.gov</a></div>
</div></div>