MT009: ValidLicenseIdentifier
Overview
| Property | Value |
|---|---|
| ID | MT009 |
| Name | ValidLicenseIdentifier |
| Group | metadata |
| Severity | WARNING |
Description
Checks that the [project].license field uses a valid SPDX license identifier.
Using standardized SPDX identifiers:
- Ensures license recognition across tools and platforms
- Required by some package indexes and compliance tools
- Enables automated license compatibility checking
What it checks
The check verifies that pyproject.toml contains a valid SPDX identifier:
[project]
license = {text = "MIT"}Or references a license file:
[project]
license = {file = "LICENSE"}The check validates that the license text matches a known SPDX identifier.
How to fix
Use a valid SPDX license identifier in your pyproject.toml:
[project]
license = {text = "MIT"}Common SPDX identifiers
| Identifier | License name |
|---|---|
MIT |
MIT License |
Apache-2.0 |
Apache License 2.0 |
BSD-3-Clause |
BSD 3-Clause “New” License |
BSD-2-Clause |
BSD 2-Clause “Simplified” License |
GPL-3.0-only |
GNU General Public License v3.0 only |
GPL-3.0-or-later |
GNU GPL v3.0 or later |
LGPL-3.0-only |
GNU Lesser General Public License v3.0 |
MPL-2.0 |
Mozilla Public License 2.0 |
ISC |
ISC License |
Unlicense |
The Unlicense |
SPDX expressions
For multiple licenses or license exceptions, use SPDX expressions:
# Dual licensing
license = {text = "MIT OR Apache-2.0"}
# License with exception
license = {text = "GPL-2.0-only WITH Classpath-exception-2.0"}Finding SPDX identifiers
The full list of SPDX license identifiers is available at: https://spdx.org/licenses/
Common mistakes
| Incorrect | Correct |
|---|---|
MIT License |
MIT |
Apache 2.0 |
Apache-2.0 |
BSD |
BSD-3-Clause or BSD-2-Clause |
GPLv3 |
GPL-3.0-only |
GPL-3.0 |
GPL-3.0-only or GPL-3.0-or-later |
Configuration
Skip this check
[tool.pycmdcheck]
skip = ["MT009"]CLI
pycmdcheck --skip MT009