<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Mar 12, 2019 at 2:55 PM Giampaolo Rodola' <<a href="mailto:g.rodola@gmail.com">g.rodola@gmail.com</a>> wrote:<br></div><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 dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Mar 12, 2019 at 3:01 AM Glenn Linderman <<a href="mailto:v%2Bpython@g.nevcal.com" target="_blank">v+python@g.nevcal.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF">
    <div class="gmail-m_-8907873751909921704m_8645204495914123895gmail-m_-2960273176817143015gmail-m_-8949223471585351216gmail-m_-2509012479412930728moz-cite-prefix">On 3/11/2019 4:35 PM, Giampaolo Rodola'
      wrote:<br>
    </div>
    <blockquote type="cite">
      
      <div dir="ltr">
        <div dir="ltr">
          <div>
            <div>Hello,</div>
            <div>some time ago I contributed a couple of patches to
              speedup shutil.copy*() functions:<br>
            </div>
            <a href="https://bugs.python.org/issue33671" target="_blank">https://bugs.python.org/issue33671</a></div>
          <div>
            <div><a href="https://bugs.python.org/issue33695" target="_blank">https://bugs.python.org/issue33695</a></div>
            <div>I would like to backport both functionalities so that
              they can be used on Python 2.7 and <3.8 and put it on
              PYPI. In order to do so I will basically have to copy some
              parts of shutil module (copytree() function + the
              unit-tests I added in BPO-33671 and a couple of other
              things). Are there constraints regarding this in terms of
              license? Am I supposed to use GPL? (I was thinking about
              using MIT)<br>
            </div>
            <div><br>
            </div>
            <div>Note: in this package called "zerocopy" I will probably
              want to expose other functionalities such as tee(),
              splice() and CopyFileEx and TransmitFile on Windows, so
              it's probably gonna be half a backport and half a brand
              new project.</div>
            <div><br>
            </div>
            <div>Thanks.<br>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    Thanks for the contributions. I don't know about the licensing.<br>
    <br>
    I wonder if you should make two packages, though... one just exactly
    a backport of the shutil speedups, and the second containing the new
    functionalities.<br>
  </div></blockquote></div><div><br></div><div></div><div>That was my initial thought as well (a "backports.shutil_copy" module targeting copy* functions only), but (especially after playing with this today) I think I have something a bit more ambitious in mind. I'm currently experimenting with different things which could be baked in a third-party lib and possibly contributed back to Python later on:<br></div></div></div></div></div></div></div></div></blockquote><div><br></div><div>If you might want some of this contributed back to Python later on, you should not use the GPL.</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"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>1) on OSX we could use f/copyfile() syscall to copy file attrs/metadata; that may be useful to speedup shutil.copystat() and shutil.copymode()</div><div></div><div>2) copytree() on OSX could take advantage of f/copyfile() + COPYFILE_RECURSIVE (which is probably too platform-specific for inclusion)<br></div><div></div><div>3) on Linux we could use copy_file_range() as a replacement for os.sendfile() in shutil.copyfile() (it's supposed to be faster)</div><div>4) on Linux ioctl() + FICLONE could be used to implement CoW (copy on write) instantaneous copies, and could be added as shutil.cow_copyfile() (haven't look into Windows yet)<br></div>5) I was thinking about backporting socket.socket.sendfile() as well, which uses os.sendfile() on POSIX but not TransmitFile on Windows (asyncio does though)<br></div><div></div><div dir="ltr"><div dir="ltr"><div>6)  another idea (but I'm not sure if it's possible, as I still 
have to dig into that) is a new socket recvfile() function boosted up by
 tee() / splice() on Linux, which maybe could be contributed 
back as socket.socket.recvfile() <br></div><div><br></div><div>-- </div><div dir="ltr" class="gmail-m_-8907873751909921704m_8645204495914123895gmail-m_-2960273176817143015gmail-m_-8949223471585351216gmail_signature"><div dir="ltr"><div>Giampaolo - <a href="http://grodola.blogspot.com" target="_blank">http://grodola.blogspot.com</a></div><div><br></div></div></div></div></div></div></div></div></div></div></div>
_______________________________________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org" target="_blank">Python-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-dev" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-dev</a><br>
Unsubscribe: <a href="https://mail.python.org/mailman/options/python-dev/greg%40krypto.org" rel="noreferrer" target="_blank">https://mail.python.org/mailman/options/python-dev/greg%40krypto.org</a><br>
</blockquote></div></div>