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

license in setup() #41

Open
daenney opened this issue Jan 21, 2014 · 14 comments
Open

license in setup() #41

daenney opened this issue Jan 21, 2014 · 14 comments

Comments

@daenney
Copy link

daenney commented Jan 21, 2014

There's quite a few way to add a license:

  • Read in a license file and put its content into setup(license=)
  • Add a license classifier
  • Add a string representing the license like GPLv3 to setup(license=)

What method should be used and are any of them mutually exclusive. For example, if you have a license classifier, do you still need the license key?

@brainwane
Copy link
Contributor

We ran into a related issue in pypi/warehouse#3225.

@merwok
Copy link

merwok commented Mar 13, 2018

I haven’t seen a whole license file in the license keyword, and haven’t seen anything documenting or recommending that.

The classifier has a list of valid values and is documented (in PEPs at least) as the recommended option.

The license field is documented as optional and free form. It is redundant with a classifier but not exclusive (i.e. does not make the metadata invalid or cause tools to error out).

@di
Copy link
Member

di commented Mar 13, 2018

I haven’t seen a whole license file in the license keyword, and haven’t seen anything documenting or recommending that.

But, it's possible, which means users have done it (There's packages on PyPI for which this is true).

What method should be used and are any of them mutually exclusive. For example, if you have a license classifier, do you still need the license key?

I think the metadata specification describes this best:

Text indicating the license covering the distribution where the license is not a selection from the “License” Trove classifiers. See “Classifier” below. This field may also be used to specify a particular version of a licencse which is named via the Classifier field, or to indicate a variation or exception to such a license.

@njsmith
Copy link
Member

njsmith commented Mar 13, 2018

But, it's possible, which means users have done it (There's packages on PyPI for which this is true).

Curiously, this is actually a good idea in some sense... because most OSS licenses require that you include the text of the license when you redistribute. (E.g. MIT says: "Permission is hereby granted [to do anything you want with this code] 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.", emphasis mine.)

Currently there's no mechanism for including license files in wheels, so I think those weird packages that got confused about the license= kwarg might be the only wheels on PyPI that are technically legal to redistribute. In practice no-one really enforces this but it'd still be good to fix eventually.

The current approaches to handling license metadata are also pretty limited – for example, there's no way to express licenses like pyca/cryptography's dual MIT/Apache2. It made sense at the time, but is probably overdue for an overhaul.

A further wrinkle is that when tools like auditwheel get involved, we may need to algorithmically transform the license metadata to record information about vendored packages.

So at some point I think we should:

  • Add some standard place to store actual license text, perhaps $PKG.dist-info/license-text/, with corresponding changes to setuptools/bdist_wheel to fill this in

  • For metadata, switch from the current trove classifiers approach to the SPDX license metadata standard.

@pombredanne
Copy link

pombredanne commented Mar 27, 2018

Just chiming in quick:

I am involved in SPDX quite a bit and I maintain a decent Python-based license scanner (scancode-toolkit). I started extremely slowly working on a draft of a draft of a PEP idea related to this in pombredanne/spdx-pypi-pep#1 about a year ago...

@njsmith re

Currently there's no mechanism for including license files in wheels, so I think those weird packages that got confused about the license= kwarg might be the only wheels on PyPI that are technically legal to redistribute. In practice no-one really enforces this but it'd still be good to fix eventually.

Actually there is a little known way to include one single license file in a wheel using setup.cfg

[metadata]
license_file = NOTICE

This would include a NOTICE file from the root in your wheel *.dist-info dir as a file named LICENSE.txt

See for example: https://github.com/nexB/scancode-toolkit/blob/fd2e483e346a38ee9634538a0f05ca4dd96fb622/setup.cfg#L2
It is not well known or documented and license file are amiss more often than not

@encukou
Copy link

encukou commented Aug 15, 2019

There's a related issue that might be good to tackle here: ensuring that packages can actually be distributed according to the specified licence.
For example, if I want to start a project that rebuilds all of PyPI for a new architecture or distro, there's nothing legally protecting me from a packager that puts packages on PyPI with a misleading Licence tag. I am worried that from a legal perspective, the tag is just an arbitrary piece of free-form text: a place where you can put the license if you want.

Perhaps we need a checkbox on PyPI that says the License-Expression field of packages I upload identifies the licences under which the package can be distributed, according to SPDX, and block packages that have License-Expression from being uploaded to PyPI if the uploader didn't sign that. Or something like that.

I am not a lawyer (and I probably should consult one before downloading something from PyPI).

@pombredanne
Copy link

@encukou my 2 cents: you may be over worried here IMHO. Beside the metadata, there is nothing that would prevent a bad actor to act badly wrt. licensing in some ways other ways, so I am not sure that an extra checkbox would bring something of value.

@ncoghlan
Copy link
Member

@pombredanne We actually have wording in the PyPI ToS that serves to protect both the PSF and mirror operators when it comes to duplication and distribution of the uploaded packages.

However, the Terms of Service don't cover actually executing any of the code in the uploaded artifacts, not even the build scripts - that's all handled via the open source licenses that are applied to projects.

So I think it would be well worth asking @VanL (as the PSF's general counsel and an experienced open source IP lawyer) whether there's a potential opportunity here along the lines of what @encukou mentions.

@pombredanne
Copy link

@ncoghlan Thank you for taking the time to chime in! and this make sense (FWIW I met @VanL at the last FOSDEM/CopyleftConf and he mentioned even using some of my tools: yummy) ... @VanL what's your take here? Specifically on this item: #41 (comment)

Perhaps we need a checkbox on PyPI that says the License-Expression field of packages I upload identifies the licences under which the package can be distributed, according to SPDX, and block packages that have License-Expression from being uploaded to PyPI if the uploader didn't sign that. Or something like that.

@ncoghlan
Copy link
Member

@pombredanne I've used scancode-toolkit as well - it just didn't click why your name was familiar until you mentioned it. Thank you for that project!

@pombredanne
Copy link

@ncoghlan thank you for using scancode-toolkit 🙇‍♂️ ... if there is anything that is not detected right, it's a bug so send it my way and you will get prime expedited delivery treatment :)
It would not exist without Python and pypa!

@encukou
Copy link

encukou commented Aug 20, 2019

Yes, PSF has very nice wording, but just for PyPI.
It seems that nowadays the answer to “How to best support an exotic architecture/platform?” is “Rebuild all wheels from the sources and host them on your own”. That's not fantasy, it is how packages for Raspberry Pi are built and distributed today.
Imagine if if you run such a project, someone uploads copyright-protected content but puts an open-source licence in the licence field. It would be nice if that project could say “but the uploader said here that this is OK to distribute under this licence! Of course I'll take the stuff down, but don't sue me.”

@pombredanne
Copy link

@encukou you wrote:

Imagine if if you run such a project, someone uploads copyright-protected content but puts an open-source licence in the licence field. It would be nice if that project could say “but the uploader said here that this is OK to distribute under this licence! Of course I'll take the stuff down, but don't sue me.”

This would be what linux distros do too, and the main ones such as Debian and Fedora do typically review and vet the license of the packages they build/package/distribute.
In the case of PyPI there is no such: the authors or packagers uploaded something and PyPI is merely the distribution mechanism. For a project that would actively rebuild and repackage packages I think that would be up to them to provide any such CYA statement, what do you think?

@pradyunsg
Copy link
Member

FTR -- there's discussion happening related to this at https://discuss.python.org/t/improving-license-clarity-with-better-package-metadata/2154/.

pombredanne added a commit to pombredanne/spdx-pypi-pep that referenced this issue Sep 27, 2020
pypa/packaging-problems#41

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
pombredanne added a commit to pombredanne/spdx-pypi-pep that referenced this issue Sep 27, 2020
pypa/packaging-problems#41

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
Rosuav pushed a commit to python/peps that referenced this issue Sep 28, 2020
* Add PEP draft for SPDX license expressions

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Add reference to another license-related ticket

pypa/packaging-problems#41

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Add proper Draft status

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Direct PEP discussions to discuss.python.org

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Adopt latest PEP copyright conventions

Reported-by: Aliaksei Urbanski @Jamim
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Add @pf_moore as BDFL delegate.

And fix minor typo

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Add Paul Moore as a PEP sponsor

CC: @pfmoore
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Reuse License Field. Add License-File.

Do not deprecate the License field with a new field. Instead reuse
License and provide backward compatibility.

Also add License-File field already in use in wheel and setuptools.

Integrates latest feedback

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Add packaging license metadata survey sections

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Add poetry and flit references

CC: @takluyver and @sdispater
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Fix typo

Reported-by: Pradyun Gedam @pradyunsg
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

Co-Authored-By: Pradyun Gedam <pradyunsg@gmail.com>

* Fix typo and improve subtitle

Reported-by: Pradyun Gedam <pradyunsg@gmail.com>
Co-Authored-By: Pradyun Gedam <pradyunsg@gmail.com>
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Fix typo

Reported-by: Pradyun Gedam <pradyunsg@gmail.com>
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

Co-Authored-By: Pradyun Gedam <pradyunsg@gmail.com>

* Fix typo

Reported-by: Pradyun Gedam <pradyunsg@gmail.com>
Co-Authored-By: Pradyun Gedam <pradyunsg@gmail.com>
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Use appendix and use footnotes for links

Also improve formatting

Reported-by: Pradyun Gedam @pradyunsg
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Add new sections and improve existing sections

- Refactor intro with new and improved abstract, scope, non-scope,
motivation and rationale sections
- Add new Backwards Compatibility, Security and How to Teach sections
- Move Reference Implementation out of appendix as its own section
- Add new Rejected ideas section
- Add new License Expression example using setuptools in Appendix

Reported-by: Chris Jerdonek @cjerdonek
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Fix typo

Reported-By: Pradyun Gedam <pradyunsg@gmail.com>
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

Co-Authored-By: Pradyun Gedam <pradyunsg@gmail.com>

* Fix typo

Reported-By: Pradyun Gedam <pradyunsg@gmail.com>
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

Co-Authored-By: Pradyun Gedam <pradyunsg@gmail.com>

* Improve presentation

Reported-By: Pradyun Gedam <pradyunsg@gmail.com>
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

Co-Authored-By: Pradyun Gedam <pradyunsg@gmail.com>

* Improve style

Reported-By: Pradyun Gedam <pradyunsg@gmail.com>
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

Co-Authored-By: Pradyun Gedam <pradyunsg@gmail.com>

* Move setuptools and wheel notes on license-file out

Reported-by: Nick Coghlan @ncoghlan
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Clarify and discourage use of public domain

Reported-by: Nick Coghlan @ncoghlan
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Fix typo

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Fix typos and clarify multi classifiers migrations

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Report warning for expression case

The case does nt matter, but there is a canonical case: if the case
is the not the standard canonical case, tools should issue a warning.

Reported-by: Oleg Grenrus @phadej
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Use deprecated not obsolete per SPDX

Reported-by: Oleg Grenrus @phadej
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Correct Cabal that uses SPDX expressions

Cabal uses both expressions and license files as proposed in this PEP

Reported-by: Oleg Grenrus @phadej
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Fix typo

Reported-by: Oleg Grenrus @phadej
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Use LicenseRef- prefix for non-standard SPDX ids

This help endsure that the expressions is fully parseable by a
conforming license expression processor

Reported-by: Oleg Grenrus @phadej
Reported-by: Nick Coghlan @ncoghlan
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Fix typos.

Reporte-by: Cyril Roelandt <tipecaml@gmail.com>
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Fix typo and add BSD* distributions reference


Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Fix typo and improve grammar


Reported-by: Nick Coghlan @ncoghlan
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Copy Edits for initial sections

* Reword a paragraph

* Update pep-9999.rst

* Fix typo


Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Remove erroneous leading spaces

Reported-by: Pradyun Gedam @pradyunsg
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

Co-authored-by: Pradyun Gedam <pradyunsg@gmail.com>

* Update SPDX license list and spec versions

Use latest SPDX spec 2.2 and SPDX license list 3.10

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Fix typos and formatting

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Clarify License file path definition

Reported-by: Miro Hrončok @hroncok
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Use permalink for discussion link

Reported-by: Tzu-ping Chung @uranusjr
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Assign number as PEP-0639

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

Co-authored-by: Pradyun Gedam <pradyunsg@gmail.com>
mnm678 pushed a commit to mnm678/peps that referenced this issue Oct 22, 2020
…n#1625)

* Add PEP draft for SPDX license expressions

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Add reference to another license-related ticket

pypa/packaging-problems#41

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Add proper Draft status

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Direct PEP discussions to discuss.python.org

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Adopt latest PEP copyright conventions

Reported-by: Aliaksei Urbanski @Jamim
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Add @pf_moore as BDFL delegate.

And fix minor typo

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Add Paul Moore as a PEP sponsor

CC: @pfmoore
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Reuse License Field. Add License-File.

Do not deprecate the License field with a new field. Instead reuse
License and provide backward compatibility.

Also add License-File field already in use in wheel and setuptools.

Integrates latest feedback

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Add packaging license metadata survey sections

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Add poetry and flit references

CC: @takluyver and @sdispater
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Fix typo

Reported-by: Pradyun Gedam @pradyunsg
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

Co-Authored-By: Pradyun Gedam <pradyunsg@gmail.com>

* Fix typo and improve subtitle

Reported-by: Pradyun Gedam <pradyunsg@gmail.com>
Co-Authored-By: Pradyun Gedam <pradyunsg@gmail.com>
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Fix typo

Reported-by: Pradyun Gedam <pradyunsg@gmail.com>
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

Co-Authored-By: Pradyun Gedam <pradyunsg@gmail.com>

* Fix typo

Reported-by: Pradyun Gedam <pradyunsg@gmail.com>
Co-Authored-By: Pradyun Gedam <pradyunsg@gmail.com>
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Use appendix and use footnotes for links

Also improve formatting

Reported-by: Pradyun Gedam @pradyunsg
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Add new sections and improve existing sections

- Refactor intro with new and improved abstract, scope, non-scope,
motivation and rationale sections
- Add new Backwards Compatibility, Security and How to Teach sections
- Move Reference Implementation out of appendix as its own section
- Add new Rejected ideas section
- Add new License Expression example using setuptools in Appendix

Reported-by: Chris Jerdonek @cjerdonek
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Fix typo

Reported-By: Pradyun Gedam <pradyunsg@gmail.com>
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

Co-Authored-By: Pradyun Gedam <pradyunsg@gmail.com>

* Fix typo

Reported-By: Pradyun Gedam <pradyunsg@gmail.com>
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

Co-Authored-By: Pradyun Gedam <pradyunsg@gmail.com>

* Improve presentation

Reported-By: Pradyun Gedam <pradyunsg@gmail.com>
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

Co-Authored-By: Pradyun Gedam <pradyunsg@gmail.com>

* Improve style

Reported-By: Pradyun Gedam <pradyunsg@gmail.com>
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

Co-Authored-By: Pradyun Gedam <pradyunsg@gmail.com>

* Move setuptools and wheel notes on license-file out

Reported-by: Nick Coghlan @ncoghlan
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Clarify and discourage use of public domain

Reported-by: Nick Coghlan @ncoghlan
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Fix typo

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Fix typos and clarify multi classifiers migrations

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Report warning for expression case

The case does nt matter, but there is a canonical case: if the case
is the not the standard canonical case, tools should issue a warning.

Reported-by: Oleg Grenrus @phadej
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Use deprecated not obsolete per SPDX

Reported-by: Oleg Grenrus @phadej
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Correct Cabal that uses SPDX expressions

Cabal uses both expressions and license files as proposed in this PEP

Reported-by: Oleg Grenrus @phadej
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Fix typo

Reported-by: Oleg Grenrus @phadej
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Use LicenseRef- prefix for non-standard SPDX ids

This help endsure that the expressions is fully parseable by a
conforming license expression processor

Reported-by: Oleg Grenrus @phadej
Reported-by: Nick Coghlan @ncoghlan
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Fix typos.

Reporte-by: Cyril Roelandt <tipecaml@gmail.com>
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Fix typo and add BSD* distributions reference


Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Fix typo and improve grammar


Reported-by: Nick Coghlan @ncoghlan
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Copy Edits for initial sections

* Reword a paragraph

* Update pep-9999.rst

* Fix typo


Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Remove erroneous leading spaces

Reported-by: Pradyun Gedam @pradyunsg
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

Co-authored-by: Pradyun Gedam <pradyunsg@gmail.com>

* Update SPDX license list and spec versions

Use latest SPDX spec 2.2 and SPDX license list 3.10

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Fix typos and formatting

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Clarify License file path definition

Reported-by: Miro Hrončok @hroncok
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Use permalink for discussion link

Reported-by: Tzu-ping Chung @uranusjr
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

* Assign number as PEP-0639

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>

Co-authored-by: Pradyun Gedam <pradyunsg@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants