Skip to content

Use BSD-2-Clause license identifier #16

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

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

Conversation

mschoettle
Copy link

BSD is ambiguous. Since the license is BSD 2 Clause, the SPDX identifier for this license can be used here.

@merwok
Copy link

merwok commented Sep 26, 2024

The license field is actually free text, there is an ongoing PEP to use SPDX identifiers.
But the current official way to specify license is to use classifiers.

@mschoettle
Copy link
Author

True. PEP 639 will improve the current situation. The disadvantage of only classifiers is that in the case of BSD it is ambiguous since it maps to multiple possible licenses.

@j4mie
Copy link
Member

j4mie commented Sep 30, 2024

Thanks for the PR. Does this actually matter if the full and correct license is in the repo? I'm happy to merge this if it's the right thing to do, but I'm not familiar with the situation regarding PyPI and licenses at all.

@merwok
Copy link

merwok commented Sep 30, 2024

It matters in that PyPI artifacts are independent from this github repo!

This doesn’t change anything functionally: when you upload to PyPI, you are granting it a license to distribute your files.

The impact is on people reviewing their dependencies’ metadata, possibly not by manual inspection but using scanning tools, so there is value in having consistent and correct information. These could be individual developers or OS packagers (downstream in Debian, Fedora, Conda, etc).

@mschoettle
Copy link
Author

That's basically where this occurred for us. We run dependency scanning in the pipeline (the one from GitLab on GitLab). Besides checking for vulnerable packages/package versions it can also detect the license.

I was told by GitLab's support that they rely on the license field returned by the PyPI API (e.g., https://pypi.org/pypi/django-forms-dynamic/json, and see Django: https://pypi.org/pypi/django/json) although there are still some that show up as unknown on GitLab. The assumption it seems is that it is a valid SPDX identifier.

At the same time, that field gets shown on PyPI on the left-hand side under Meta -> License. I noticed that if it is a valid identifier PyPI shows the name with the identifier in parentheses. (compare Django and django-forms-dynamic).

@mschoettle
Copy link
Author

setuptools has support for PEP 639 now (pypa/setuptools#4629). I don't see a pinned setuptools version in this repo so it would use the the latest version the next time it is built. I haven't tested building this with the latest version. But in theory it should be good to merge now (unless there are any other requirements with the new format).

@merwok
Copy link

merwok commented Apr 11, 2025

Here is a guide on current best practices: https://hugovk.dev/blog/2025/improving-licence-metadata/

@mschoettle
Copy link
Author

Thanks! While it looks right, I don't think it works as is:

$ pip show django-forms-dynamic
Name: django-forms-dynamic
Version: 1.0.1
Summary: Resolve form field arguments dynamically when a form is instantiated, not when it's declared.
Home-page: https://github.com/dabapps/django-forms-dynamic
Author: DabApps
Author-email: [email protected]
License: BSD-2-Clause
Location: /usr/local/python/3.12.1/lib/python3.12/site-packages
Requires: 
Required-by:

Built using setuptools==78.1.0. Based on the shared article it should show License-Expression.

I suspect because the use of setup.py is deprecated.

@merwok
Copy link

merwok commented Apr 14, 2025

No, running commands like python setup.py sdist directly is deprecated.

setup.py and setup.cfg are still perfectly usable configuration files for the setuptools build backend.

Do you have pip 25.0 or newer? ref: pypa/pip@41c807c

@@ -13,7 +13,7 @@
url = "https://github.com/dabapps/django-forms-dynamic"
author = "DabApps"
author_email = "[email protected]"
license = "BSD"
license = "BSD-2-Clause"
Copy link

Choose a reason for hiding this comment

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

This is the old free-form license field, not the recent SPDX licence-expression field

Copy link
Author

Choose a reason for hiding this comment

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

Ah, right. Good catch! It still passed the license to the license argument in setup. pip show shows License-Expression after changing the argument to license_expression.

@mschoettle
Copy link
Author

No, running commands like python setup.py sdist directly is deprecated.

That's what the pypi workflow in this repo uses. Eventually it would be good to convert to pyproject.toml.

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

Successfully merging this pull request may close these issues.

3 participants