Skip to content

Commit

Permalink
feat(bindgen): Use __version__ for Python JS package version
Browse files Browse the repository at this point in the history
  • Loading branch information
thewtex committed Apr 25, 2023
1 parent b7a235d commit 66a9ccb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist/
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from itkwasm.pyodide import JsPackageConfig, JsPackage

default_config = JsPackageConfig("https://cdn.jsdelivr.net/npm/@itk-wasm/[email protected]/dist/bundles/compress-stringify.js")
from ._version import __version__

default_config = JsPackageConfig(f"https://cdn.jsdelivr.net/npm/@itk-wasm/compress-stringify@{__version__}/dist/bundles/compress-stringify.js")
js_package = JsPackage(default_config)
6 changes: 4 additions & 2 deletions src/bindgen/python.js
Original file line number Diff line number Diff line change
Expand Up @@ -684,11 +684,13 @@ function emscriptenPyodideModule(packageDir, pypackage, options) {
const defaultJsModuleName = options.packageName.replace('itkwasm-', '')
const version = options.packageVersion ?? '0.1.0'

const moduleUrl = options.jsModuleUrl ?? `https://cdn.jsdelivr.net/npm/${defaultJsPackageName}@${version}/dist/bundles/${defaultJsModuleName}.js`
const moduleUrl = options.jsModuleUrl ?? `https://cdn.jsdelivr.net/npm/${defaultJsPackageName}@{__version__}/dist/bundles/${defaultJsModuleName}.js`

const moduleContent = `from itkwasm.pyodide import JsPackageConfig, JsPackage
default_config = JsPackageConfig("${moduleUrl}")
from ._version import __version__
default_config = JsPackageConfig(f"${moduleUrl}")
js_package = JsPackage(default_config)
`

Expand Down

0 comments on commit 66a9ccb

Please sign in to comment.