Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-95649: Document that asyncio contains uvloop code #107536

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

aloisklink
Copy link

@aloisklink aloisklink commented Aug 1, 2023

Some of the asyncio SSL changes in GH-31275 were taken from v0.16.0 of the uvloop project. In order to comply with the MIT license, we need to just need to document the copyright information.

Design decisions

How did I pick the files to add licensing info to?

I went through commit 13c10bf and added the # SPDX-FileCopyrightText: ... for changes to any file that has substantial code taken from https://github.com/MagicStack/uvloop/tree/v0.16.0.

The uvloop MIT license copyright text is Copyright (c) 2015-present MagicStack Inc. http://magic.io, so I changed it to Copyright (c) 2015-2021 MagicStack Inc. http://magic.io, as when 13c10bf was committed, the uvloop code was last modified in 2021.

Why did I use the # SPDX-... comment format?

Since there isn't yet a standard way to document licensing/copyright info (see python/devguide#928 for the issue tracking this), I've used the # SPDX-FileCopyrightText/# SPDX-License-Identifier format since that's the SPDX spec, which is the most common method of doing copyright/licensing information, used by Linux.

Normally, we should also add a # SPDX-FileCopyrightText: Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Python Software Foundation; All Rights Reserved line, but then we'd have to update the line every year, and I think the LICENSE file already covers this.

Why is there no # Licensed to PSF under a Contributor Agreement. comment?

As raised in #95649, there's no information about whether the contributor actually had the rights to relicense this code under the PSF.

Personally, the changes in Lib/asyncio seem to come from uvloop code authored by either @asvetlov, or @MagicStack employees, so it should be pretty easy to relicense these files under the PSF, assuming @MagicStack approves. See https://github.com/MagicStack/uvloop/commits/v0.16.0/uvloop/sslproto.pyx (MagicStack/uvloop@ef29dab is by an author that isn't @MagicStack or @asvetlov, but that change is pretty trivial, so it should still be okay to relicense).

However, Lib/test/test_asyncio/test_ssl.py seems to have a bunch of different authors from uvloop. And since there doesn't seem to be a uvloop CLA, even if @MagicStack approves, I don't think we can relicense this file under the PSF.


📚 Documentation preview 📚: https://cpython-previews--107536.org.readthedocs.build/

Some of the asyncio SSL changes in pythonGH-31275 were taken from
[v0.16.0 of the uvloop project][1]. In order to comply with the MIT
license, we need to just need to document the copyright information.

[1]: https://github.com/MagicStack/uvloop/tree/v0.16.0
@cpython-cla-bot
Copy link

cpython-cla-bot bot commented Aug 1, 2023

All commit authors signed the Contributor License Agreement.
CLA signed

@AA-Turner
Copy link
Member

As prior art (just looking through Lib):

  • http.cookies, logging, profile, pstats, sqlite3, tarfile include the full licence text in comments
  • optparse and platform use a __copyright__ variable.

Given that code was incorporated here, perhaps the best route is instead to add the full uvloop licence to Doc/licence.rst with a note in that file about which modules use the uvloop code?

A

@AA-Turner AA-Turner added docs Documentation in the Doc dir topic-asyncio needs backport to 3.11 bug and security fixes needs backport to 3.12 bug and security fixes labels Aug 1, 2023
@AA-Turner
Copy link
Member

(Adding the backport labels as whatever the end result is, the correct licence notices should exist in Python 3.11, where the change first appeared.)

@gvanrossum gvanrossum removed their request for review August 1, 2023 15:14
@aloisklink
Copy link
Author

Given that code was incorporated here, perhaps the best route is instead to add the full uvloop licence to Doc/licence.rst with a note in that file about which modules use the uvloop code?

Already done! Although, I've just linked to the asyncio module in general, instead of the specific asyncio.xxxx modules. See

cpython/Doc/license.rst

Lines 1045 to 1069 in efa45b0

asyncio
----------
The :mod:`asyncio` module contains the following notice::
Copyright (c) 2015-2021 MagicStack Inc. http://magic.io
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

As prior art [other modules] include the full licence text in comments

We still need some information in each individual file, since CPython's LICENSE file says "Some software incorporated into Python is under different licenses. The licenses are listed with code falling under that license." (and it's best practice to put licensing info in each file, especially when it's different from the rest of licenses).

But sticking the full license text in every file is very verbose and difficult to summarize. It's why the Linux kernel and lots of other OSS projects have switched to using the SPDX standard, so people can just write SPDX-License-Identifier: xxxx instead of having the full license text in the comments (see https://lwn.net/Articles/739183/). We still should have the full text of the license somewhere, but that's covered by the Doc/license.rst file.


FYI, I'm not a lawyer, so I'm just following what other projects do, like the Linux kernel.

I'm going to ping @tiran, since as the author of #95649 and python/devguide#928, they probably care the most about this subject.

@kumaraditya303 kumaraditya303 removed their request for review August 2, 2023 06:23
Copy link
Member

@AA-Turner AA-Turner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update -- I realise I was unclear, I had intended to ask why we don't only include the notice in Doc/license.rst, but you've addressed my concerns. One suggestion on wording for the text in license:

Thanks!
Adam

Doc/license.rst Outdated
asyncio
----------

The :mod:`asyncio` module contains the following notice::
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The :mod:`asyncio` module contains the following notice::
Parts of the :mod:`asyncio` module are incorporated from uvloop 0.16,
which is distributed under the MIT license::

Copy link
Author

@aloisklink aloisklink Aug 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea! Changed in aloisklink@d5aee03 (I've also made the uvloop 0.16 text a hyperlink to https://github.com/MagicStack/uvloop/tree/v0.16.0)

Reword `Doc/license.rst` file, as suggested in
python#107536 (comment)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting core review docs Documentation in the Doc dir needs backport to 3.11 bug and security fixes needs backport to 3.12 bug and security fixes topic-asyncio
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants