Skip to content

Commit

Permalink
feat(bindgen): Customize Python package keywords
Browse files Browse the repository at this point in the history
  • Loading branch information
thewtex committed Apr 22, 2023
1 parent f5ac4d9 commit e3b1df4
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,26 @@ readme = "README.md"
license = "Apache-2.0"
dynamic = ["version", "description"]
classifiers = [
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
"Programming Language :: C++",
"Environment :: WebAssembly",
"Environment :: WebAssembly :: Emscripten",
"Environment :: WebAssembly :: WASI",
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
"Programming Language :: C++",
"Environment :: WebAssembly",
"Environment :: WebAssembly :: Emscripten",
"Environment :: WebAssembly :: WASI",
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
]
keywords = [
"itkwasm",
"webassembly",
"emscripten",
"wasi",
"itkwasm",
"webassembly",
"wasi",
]

requires-python = ">=3.7"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,27 @@ readme = "README.md"
license = "Apache-2.0"
dynamic = ["version", "description"]
classifiers = [
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
"Programming Language :: C++",
"Environment :: WebAssembly",
"Environment :: WebAssembly :: Emscripten",
"Environment :: WebAssembly :: WASI",
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
"Programming Language :: C++",
"Environment :: WebAssembly",
"Environment :: WebAssembly :: Emscripten",
"Environment :: WebAssembly :: WASI",
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
]
keywords = [
"itkwasm",
"webassembly",
"emscripten",
"wasi",
"itkwasm",
"webassembly",
"wasi",
"emscripten",
]

requires-python = ">=3.7"
Expand Down
36 changes: 17 additions & 19 deletions src/bindgen/python-resources/template.pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,25 @@ readme = "README.md"
license = "Apache-2.0"
dynamic = ["version", "description"]
classifiers = [
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
"Programming Language :: C++",
"Environment :: WebAssembly",
"Environment :: WebAssembly :: Emscripten",
"Environment :: WebAssembly :: WASI",
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
"Programming Language :: C++",
"Environment :: WebAssembly",
"Environment :: WebAssembly :: Emscripten",
"Environment :: WebAssembly :: WASI",
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
]
keywords = [
"itkwasm",
"webassembly",
"emscripten",
"wasi",
"itkwasm",
"webassembly",@bindgenKeywords@
]

requires-python = ">=3.7"
Expand Down
5 changes: 5 additions & 0 deletions src/bindgen/python.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ function packagePyProjectToml(packageName, packageDir, bindgenPyPackage, options
let pyProjectToml = fs.readFileSync(bindgenResource('template.pyproject.toml'), {encoding:'utf8', flag:'r'})
pyProjectToml = pyProjectToml.replaceAll('@bindgenPackageName@', packageName)
const repository = options.repository ?? 'https://github.com/InsightSoftwareConsortium/itk-wasm'
let bindgenKeywords = ''
let bindgenDependencies = ''
let bindgenHatchEnvDependencies = ''
let bindgenHatchEnvScripts = `
Expand All @@ -106,7 +107,9 @@ test = "pytest"
`
if (packageName.endsWith('wasi')) {
bindgenDependencies += '\n "importlib_resources",\n'
bindgenKeywords = '\n "wasi",'
} else if (packageName.endsWith('emscripten')) {
bindgenKeywords = '\n "emscripten",'
bindgenHatchEnvDependencies = '\n "pytest-pyodide",'
bindgenHatchEnvScripts = `
[tool.hatch.envs.default.scripts]
Expand All @@ -128,8 +131,10 @@ serve = [
`

} else {
bindgenKeywords = '\n "wasi",\n "emscripten",'
bindgenDependencies += `\n "${packageName}-wasi; sys_platform != \\"emscripten\\"",\n "${packageName}-emscripten; sys_platform == \\"emscripten\\"",\n`
}
pyProjectToml = pyProjectToml.replaceAll('@bindgenKeywords@', bindgenKeywords)
pyProjectToml = pyProjectToml.replaceAll('@bindgenDependencies@', bindgenDependencies)
pyProjectToml = pyProjectToml.replaceAll('@bindgenHatchEnvDependencies@', bindgenHatchEnvDependencies)
pyProjectToml = pyProjectToml.replaceAll('@bindgenHatchEnvScripts@', bindgenHatchEnvScripts)
Expand Down

0 comments on commit e3b1df4

Please sign in to comment.