Skip to content

Improve licensing support#602

Closed
ngie-eign wants to merge 3 commits into
pre-commit:mainfrom
ngie-eign:improve-licensing-support
Closed

Improve licensing support#602
ngie-eign wants to merge 3 commits into
pre-commit:mainfrom
ngie-eign:improve-licensing-support

Conversation

@ngie-eign

@ngie-eign ngie-eign commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

This change does 3 main things:

  • Modifies the identify.license_id(..)'s API contract to match the identify.tags_from_path(..) and identify.tags_from_filename(..) APIs.
  • Adds support for identifying SPDX license by IDs instead of just full license text.
  • Adds CLI support for identifying license information with identify-cli.

This change makes it easier to identify licenses in source files without having to invoke the API manually.

Prior to this change, the `license_id` API would return a license or `None` in
the event that the file had an identifiable license or does not have a license
that could be identified.

This change modifies the `license_id` API to better match the other
identify APIs: after this change a set of 0 or more licenses should be returned.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
A lot of source code uses SPDX IDs instead of full license text for
brevity. Support the shorter ID format with the license_id* API.

This change renames the `license_id` API to `license_ids` for clarity.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
@ngie-eign ngie-eign force-pushed the improve-licensing-support branch from e0b56d4 to 570e535 Compare July 16, 2026 05:34
This change adds a new option, `--tag-type`, which allows one to
identify by either file type or license type.

This exposes the `identify.license_ids(..)` API for public consumption
on the CLI.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
@ngie-eign ngie-eign force-pushed the improve-licensing-support branch from 718e6d4 to d0f15b7 Compare July 16, 2026 05:37
@asottile

Copy link
Copy Markdown
Member

please discuss features before wasting time on them

@asottile asottile closed this Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants