Skip to content

pyproject.toml: use non-deprecated license specification #1687

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Bastian-Krause
Copy link
Member

@Bastian-Krause Bastian-Krause commented Jul 8, 2025

Description
Fixes these deprecation warnings during python -m build:

env/lib/python3.11/site-packages/setuptools/config/_apply_pyprojecttoml.py:82: SetuptoolsDeprecationWarning: `project.license` as a TOML table is deprecated
!!
        ********************************************************************************
        Please use a simple string containing a SPDX expression for `project.license`. You can also use `project.license-files`. (Both options available on setuptools>=77.0.0).
        By 2026-Feb-18, you need to update your project and remove deprecated calls
        or your builds will no longer be supported.
        See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
        ********************************************************************************
!!
env/lib/python3.11/site-packages/setuptools/config/_apply_pyprojecttoml.py:61: SetuptoolsDeprecationWarning: License classifiers are deprecated.
!!
        ********************************************************************************
        Please consider removing the following classifiers in favor of a SPDX license expression:
        License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)
        See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
        ********************************************************************************
!!

Checklist

  • PR has been tested

Fixes these deprecation warnings during `python -m build`:

  env/lib/python3.11/site-packages/setuptools/config/_apply_pyprojecttoml.py:82: SetuptoolsDeprecationWarning: `project.license` as a TOML table is deprecated
  !!
          ********************************************************************************
          Please use a simple string containing a SPDX expression for `project.license`. You can also use `project.license-files`. (Both options available on setuptools>=77.0.0).
          By 2026-Feb-18, you need to update your project and remove deprecated calls
          or your builds will no longer be supported.
          See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
          ********************************************************************************
  !!

  env/lib/python3.11/site-packages/setuptools/config/_apply_pyprojecttoml.py:61: SetuptoolsDeprecationWarning: License classifiers are deprecated.
  !!
          ********************************************************************************
          Please consider removing the following classifiers in favor of a SPDX license expression:
          License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)
          See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
          ********************************************************************************
  !!

Signed-off-by: Bastian Krause <[email protected]>
@Bastian-Krause Bastian-Krause force-pushed the bst/pyproject-license branch from e2128eb to e97065f Compare July 8, 2025 08:01
Copy link

codecov bot commented Jul 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 55.6%. Comparing base (e43d093) to head (e97065f).

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@          Coverage Diff           @@
##           master   #1687   +/-   ##
======================================
  Coverage    55.6%   55.6%           
======================================
  Files         172     172           
  Lines       13466   13466           
======================================
  Hits         7492    7492           
  Misses       5974    5974           
Flag Coverage Δ
3.10 55.6% <ø> (ø)
3.11 55.6% <ø> (ø)
3.12 55.6% <ø> (ø)
3.13 55.6% <ø> (ø)
3.9 55.6% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -1,7 +1,7 @@
[build-system]
# Minimum requirements for the build system to execute.
requires = [
"setuptools>=47.2.0",
"setuptools>=77.0.0",
Copy link
Member

Choose a reason for hiding this comment

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

Can we avoid this? For example, Debian stable only has 66.1.1 (77.0 was released in March 2025).

Copy link
Member Author

Choose a reason for hiding this comment

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

I have no idea how. On 2026-Feb-18 we won't be able to prepare builds with the setuptools version released then (see deprecation warning above). The migration phase is pretty short. Maybe we should postpone merging this PR until beginning of 2026?

There's also discussion here pypa/setuptools#4903, including comments pointing to distro versions of setuptools pypa/setuptools#4903 (comment).

Copy link
Member

Choose a reason for hiding this comment

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

Lets postpone this a bit and see how this evolves.

Copy link
Member Author

Choose a reason for hiding this comment

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

Okay, I've converted this into a draft, so it won't be merged yet.

Copy link
Contributor

Choose a reason for hiding this comment

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

Would switching build systems be an option?

Copy link
Member

Choose a reason for hiding this comment

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

Are there alternatives that are widely available in binary distributions?

Copy link
Contributor

@threexc threexc Jul 16, 2025

Choose a reason for hiding this comment

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

I am fond of hatch/hatchling, which it seems is available at least for Debian 12 and Fedora 42, although the versions differ significantly:

Debian 12:

(labgrid-venv) tgamblin@ecogrid:~/labgrid$ apt info python3-hatchling
Package: python3-hatchling
Version: 1.12.2-1
Priority: optional
Section: python
Source: hatchling
Maintainer: Debian Python Team <[email protected]>
Installed-Size: 401 kB
Depends: python3-importlib-metadata | python3 (>> 3.8), python3-packaging, python3-pathspec (>= 0.10), python3-pluggy, python3-tomli | python3 (>> 3.11), python3:any
Homepage: https://hatch.pypa.io/
Download-Size: 53.6 kB
APT-Sources: http://deb.debian.org/debian bookworm/main amd64 Packages
Description: Python package build backend used by Hatch
 This is the extensible, standards compliant build backend used by Hatch.
 .
 It may be required to build a Python module from source.

Fedora 42:

tgamblin@megalith ~ $ dnf info python3-hatchling
Updating and loading repositories:
Repositories loaded.
Available packages
Name           : python3-hatchling
Epoch          : 0
Version        : 1.27.0
Release        : 2.fc42
Architecture   : noarch
Download size  : 220.8 KiB
Installed size : 604.2 KiB
Source         : python-hatchling-1.27.0-2.fc42.src.rpm
Repository     : fedora
Summary        : The build backend used by Hatch
URL            : https://pypi.org/project/hatchling
License        : MIT
Description    : This is the extensible, standards compliant build backend used by Hatch.
Vendor         : Fedora Project

They also have a page comparing against setuptools. I can see flit in the package repositories as well, but I'd have to do a bit more research on it and other backends.

Copy link
Contributor

Choose a reason for hiding this comment

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

I have no idea how. On 2026-Feb-18 we won't be able to prepare builds with the setuptools version released then (see deprecation warning above). The migration phase is pretty short. Maybe we should postpone merging this PR until beginning of 2026?

There's also discussion here pypa/setuptools#4903, including comments pointing to distro versions of setuptools pypa/setuptools#4903 (comment).

Why is the version bump actually needed?

@Bastian-Krause Bastian-Krause marked this pull request as draft July 8, 2025 09:42
@@ -15,7 +15,8 @@ authors = [
]
description = "embedded systems control library for development, testing and installation"
readme = "README.rst"
license = { file="LICENSE" }
license = "LGPL-2.0-or-later"
license-files = ["LICENSE"]
Copy link
Contributor

Choose a reason for hiding this comment

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

These two lines look good

@@ -1,7 +1,7 @@
[build-system]
# Minimum requirements for the build system to execute.
requires = [
"setuptools>=47.2.0",
"setuptools>=77.0.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

I have no idea how. On 2026-Feb-18 we won't be able to prepare builds with the setuptools version released then (see deprecation warning above). The migration phase is pretty short. Maybe we should postpone merging this PR until beginning of 2026?

There's also discussion here pypa/setuptools#4903, including comments pointing to distro versions of setuptools pypa/setuptools#4903 (comment).

Why is the version bump actually needed?

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.

4 participants