Skip to content

Commit 93a3f71

Browse files
authored
python: migrate to PEP 639 license-files (#456)
* python: migrate to PEP 639 license-files - Change license from deprecated table form to SPDX expression string - Remove deprecated License :: trove classifier - Update build-wheels.mjs to set license-files with both SDK LICENSE and CLI-LICENSE.md for bundled wheels - Update SPDX expression to 'MIT AND LicenseRef-Copilot-CLI' for bundled CLI wheels * python: collapse two-step license replacement into one Address review feedback: combine the SPDX expression and license-files replacements into a single atomic operation to avoid fragile coupling.
1 parent c263dfc commit 93a3f71

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

python/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ version = "0.1.0"
88
description = "Python SDK for GitHub Copilot CLI"
99
readme = "README.md"
1010
requires-python = ">=3.9"
11-
license = {text = "MIT"}
11+
license = "MIT"
12+
# license-files is set by scripts/build-wheels.mjs for bundled CLI wheels
1213
authors = [
1314
{name = "GitHub", email = "opensource@github.com"}
1415
]
1516
classifiers = [
1617
"Development Status :: 3 - Alpha",
1718
"Intended Audience :: Developers",
18-
"License :: OSI Approved :: MIT License",
1919
"Programming Language :: Python :: 3",
2020
"Programming Language :: Python :: 3.9",
2121
"Programming Language :: Python :: 3.10",

python/scripts/build-wheels.mjs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,13 +180,13 @@ async function buildWheel(platform, pkgVersion, cliVersion, outputDir, licensePa
180180
// Create __init__.py
181181
writeFileSync(join(binDir, "__init__.py"), '"""Bundled Copilot CLI binary."""\n');
182182

183-
// Copy and modify pyproject.toml - replace license reference with file
183+
// Copy and modify pyproject.toml for bundled CLI wheel
184184
let pyprojectContent = readFileSync(join(pythonDir, "pyproject.toml"), "utf-8");
185185

186-
// Replace the license specification with file reference
186+
// Update SPDX expression and add license-files for both SDK and bundled CLI licenses
187187
pyprojectContent = pyprojectContent.replace(
188-
'license = {text = "MIT"}',
189-
'license = {file = "CLI-LICENSE.md"}'
188+
'license = "MIT"',
189+
'license = "MIT AND LicenseRef-Copilot-CLI"\nlicense-files = ["LICENSE", "CLI-LICENSE.md"]'
190190
);
191191

192192
// Add package-data configuration
@@ -202,6 +202,9 @@ async function buildWheel(platform, pkgVersion, cliVersion, outputDir, licensePa
202202
cpSync(join(pythonDir, "README.md"), join(buildDir, "README.md"));
203203
}
204204

205+
// Copy SDK LICENSE
206+
cpSync(join(repoRoot, "LICENSE"), join(buildDir, "LICENSE"));
207+
205208
// Copy CLI LICENSE
206209
cpSync(licensePath, join(buildDir, "CLI-LICENSE.md"));
207210

0 commit comments

Comments
 (0)