pypa / pypa/setuptools

[Improvement] `License-File` is marked as dynamic even when it isn't

Open
#4,960 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement help wanted
Dominant language
Python
Stars
2.9k
Forks
1.4k
Avg merge
1d 1h
Merged PRs (30d)
1

Description

setuptools version

setuptools==79.0.1

Python version

Python 3.12.10

OS

Windows 11

Additional environment information

No response

Description

It seems that when setuptools generates distribution package metadata, it always adds Dynamic: license-file, even when the license file(s) are specified statically via pyproject.toml.

Expected behavior

Dynamic: license-file should only be added when the license files are configured via setup.py.

How to Reproduce

Create pyproject.toml:

[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[project]
name = "setuptools-repro"
version = "0"
license-files = ["LICENSE"]

Create LICENSE (any content will do).

Run pyproject-build and examine the PKG-INFO file in the sdist, and METADATA in the wheel.

Output
> pyproject-build
* Creating isolated environment: venv+pip...
* Installing packages in isolated environment:
  - setuptools
* Getting build dependencies for sdist...
running egg_info
writing setuptools_repro.egg-info\PKG-INFO
writing dependency_links to setuptools_repro.egg-info\dependency_links.txt
writing top-level names to setuptools_repro.egg-info\top_level.txt
reading manifest file 'setuptools_repro.egg-info\SOURCES.txt'
adding license file 'LICENSE'
writing manifest file 'setuptools_repro.egg-info\SOURCES.txt'
* Building sdist...
running sdist
running egg_info
writing setuptools_repro.egg-info\PKG-INFO
writing dependency_links to setuptools_repro.egg-info\dependency_links.txt
writing top-level names to setuptools_repro.egg-info\top_level.txt
reading manifest file 'setuptools_repro.egg-info\SOURCES.txt'
adding license file 'LICENSE'
writing manifest file 'setuptools_repro.egg-info\SOURCES.txt'
warning: sdist: standard file not found: should have one of README, README.rst, README.txt, README.md

running check
creating setuptools_repro-0
creating setuptools_repro-0\setuptools_repro.egg-info
copying files to setuptools_repro-0...
copying LICENSE -> setuptools_repro-0
copying pyproject.toml -> setuptools_repro-0
copying setuptools_repro.egg-info\PKG-INFO -> setuptools_repro-0\setuptools_repro.egg-info
copying setuptools_repro.egg-info\SOURCES.txt -> setuptools_repro-0\setuptools_repro.egg-info
copying setuptools_repro.egg-info\dependency_links.txt -> setuptools_repro-0\setuptools_repro.egg-info
copying setuptools_repro.egg-info\top_level.txt -> setuptools_repro-0\setuptools_repro.egg-info
copying setuptools_repro.egg-info\SOURCES.txt -> setuptools_repro-0\setuptools_repro.egg-info
Writing setuptools_repro-0\setup.cfg
Creating tar archive
removing 'setuptools_repro-0' (and everything under it)
* Building wheel from sdist
* Creating isolated environment: venv+pip...
* Installing packages in isolated environment:
  - setuptools
* Getting build dependencies for wheel...
running egg_info
writing setuptools_repro.egg-info\PKG-INFO
writing dependency_links to setuptools_repro.egg-info\dependency_links.txt
writing top-level names to setuptools_repro.egg-info\top_level.txt
reading manifest file 'setuptools_repro.egg-info\SOURCES.txt'
adding license file 'LICENSE'
writing manifest file 'setuptools_repro.egg-info\SOURCES.txt'
* Building wheel...
running bdist_wheel
running build
installing to build\bdist.win-amd64\wheel
running install
running install_egg_info
running egg_info
writing setuptools_repro.egg-info\PKG-INFO
writing dependency_links to setuptools_repro.egg-info\dependency_links.txt
writing top-level names to setuptools_repro.egg-info\top_level.txt
reading manifest file 'setuptools_repro.egg-info\SOURCES.txt'
adding license file 'LICENSE'
writing manifest file 'setuptools_repro.egg-info\SOURCES.txt'
Copying setuptools_repro.egg-info to build\bdist.win-amd64\wheel\.\setuptools_repro-0-py3.12.egg-info
running install_scripts
creating build\bdist.win-amd64\wheel\setuptools_repro-0.dist-info\WHEEL
creating '[redacted]\dist\.tmp-6in6k3ny\setuptools_repro-0-py3-none-any.whl' and adding 'build\bdist.win-amd64\wheel' to it
adding 'setuptools_repro-0.dist-info/licenses/LICENSE'
adding 'setuptools_repro-0.dist-info/METADATA'
adding 'setuptools_repro-0.dist-info/WHEEL'
adding 'setuptools_repro-0.dist-info/top_level.txt'
adding 'setuptools_repro-0.dist-info/RECORD'
removing build\bdist.win-amd64\wheel
Successfully built setuptools_repro-0.tar.gz and setuptools_repro-0-py3-none-any.whl
> tar -xOf .\dist\setuptools_repro-0.tar.gz setuptools_repro-0/PKG-INFO
Metadata-Version: 2.4
Name: setuptools-repro
Version: 0
License-File: LICENSE
Dynamic: license-file
> tar -xOf .\dist\setuptools_repro-0-py3-none-any.whl setuptools_repro-0.dist-info/METADATA
Metadata-Version: 2.4
Name: setuptools-repro
Version: 0
License-File: LICENSE
Dynamic: license-file

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the shown pyproject.toml and pyproject-build command, then inspect the generated PKG-INFO and wheel METADATA. Trace the setuptools metadata generation path to compare static license-files with setup.py configuration. Done means Dynamic: license-file is absent for the static configuration and retained when setup.py supplies the license files.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.