Skip to content

Fix license metadata for compliance tools like GitHub Licensed#65

Open
devclinton wants to merge 1 commit intoanderskm:masterfrom
devclinton:fix/license-metadata-for-licensed-tool
Open

Fix license metadata for compliance tools like GitHub Licensed#65
devclinton wants to merge 1 commit intoanderskm:masterfrom
devclinton:fix/license-metadata-for-licensed-tool

Conversation

@devclinton
Copy link
Copy Markdown

@devclinton devclinton commented Mar 27, 2026

Summary

  • Switch distutils.core to setuptoolsdistutils does not generate .dist-info/METADATA when a package is installed via pip, which is the primary mechanism that license-compliance tools use to discover package license information.
  • Add license_files = ['LICENSE.txt'] — explicitly includes the license file in the built distribution metadata, ensuring it is present in .dist-info/.
  • Add License :: OSI Approved :: MIT License classifier — provides a standardized, machine-readable license identifier that tools like GitHub Licensed use as a fallback when scanning dependencies.

Motivation

When GPUtil is installed as a dependency in another project and that project runs GitHub Licensed to audit/cache dependency licenses, Licensed fails to detect GPUtil's MIT license. This is because distutils-based installs don't produce the .dist-info/METADATA file that Licensed (and pip itself) rely on for license discovery. These changes are the minimal set needed to make the license correctly discoverable by automated compliance tooling.

Test plan

  • Install the updated package with pip install . and verify .dist-info/METADATA contains License: MIT and Classifier: License :: OSI Approved :: MIT License
  • Run licensed cache / licensed status in a consuming project and confirm GPUtil's license is detected

Switch from distutils to setuptools and add license classifier so that
license-compliance tools (e.g. GitHub Licensed) can detect the MIT
license from installed package metadata (.dist-info/METADATA).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@anderskm
Copy link
Copy Markdown
Owner

anderskm commented Apr 3, 2026

I have verified the content of .dist-info/METADATA, but I am having trouble with licensed cache / licensed status.
Here's my approach:
I have created a new venv ,where I have installed GPUtil from a local copy of your PR, and created a new folder for a consuming project. In the consuming project, I have created the .licenses.yaml, as well as a requirements.txt with GPUtil as the only requirement. But when I call licensed cache, no dependencies are detected.
Can you provide a minimum working example for you test with licensed?

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.

2 participants