Skip to content

Commit 753f760

Browse files
committed
feat(create-itk-wasm): from environment.yml to pixi.toml
1 parent a0873b0 commit 753f760

File tree

4 files changed

+31
-44
lines changed

4 files changed

+31
-44
lines changed

packages/core/typescript/create-itk-wasm/src/generate/environment-yml.ts

Lines changed: 0 additions & 25 deletions
This file was deleted.

packages/core/typescript/create-itk-wasm/src/generate/package-json.ts

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,13 @@ function generatePackageJson(project: ProjectSpec) {
1313
}
1414

1515
const itkWasm = {
16+
'test-data-hash':
17+
'bafkreiha6oye3fd5cxfadnua5r2jlkaco2xuyeek454d2ihiffsx7rauqe',
18+
'test-data-urls': ['https://placeholder'],
1619
'package-description': project.packageDescription,
1720
'typescript-package-name': project.typescriptPackageName,
18-
'python-package-name': project.pythonPackageName
21+
'python-package-name': project.pythonPackageName,
22+
repository: project.repositoryUrl
1923
}
2024
if (project.repositoryUrl) {
2125
// @ts-ignore
@@ -25,29 +29,25 @@ function generatePackageJson(project: ProjectSpec) {
2529
name: `${project.name}-build`,
2630
version: '0.1.0',
2731
private: true,
28-
description: `Scripts to generate ${project.name} itk-wasm artifacts.`,
32+
description: `Scripts to generate ${project.name} ITK-Wasm artifacts.`,
2933
type: 'module',
3034
'itk-wasm': itkWasm,
3135
license: project.license,
3236
scripts: {
3337
build: 'pnpm build:gen:typescript && pnpm build:gen:python',
3438
'build:emscripten': 'itk-wasm pnpm-script build:emscripten',
3539
'build:emscripten:debug': 'itk-wasm pnpm-script build:emscripten:debug',
40+
'build:micromamba':
41+
'echo "No build:micromamba script required with pixi"',
3642
'build:wasi': 'itk-wasm pnpm-script build:wasi',
3743
'build:wasi:debug': 'itk-wasm pnpm-script build:wasi:debug',
38-
'build:python:wasi': 'itk-wasm pnpm-script build:python:wasi',
44+
'build:python:wasi':
45+
"echo 'No build:python:wasi script required with pixi'",
3946
'bindgen:typescript': 'itk-wasm pnpm-script bindgen:typescript',
4047
'bindgen:python': 'itk-wasm pnpm-script bindgen:python',
4148
'build:gen:typescript': 'itk-wasm pnpm-script build:gen:typescript',
4249
'build:gen:python': 'itk-wasm pnpm-script build:gen:python',
43-
'build:micromamba': 'itk-wasm pnpm-script build:micromamba',
44-
'build:python:versionSync':
45-
'itk-wasm pnpm-script build:python:versionSync',
46-
'publish:python': 'itk-wasm pnpm-script publish:python',
47-
test: 'pnpm test:data:download && pnpm build:gen:python && pnpm test:python',
48-
'test:data:download':
49-
'dam download test/data test/data.tar.gz bafkreigpkk3pqcoqzjzcauogw6dml52yig3ksmcrobau5pkoictymizzri https://github.com/InsightSoftwareConsortium/ITK-Wasm/releases/download/itk-wasm-v1.0.0-b.163/create-itk-wasm-test-data.tar.gz https://bafybeiczuxeuma5cjuli5mtapqnjqypeaum5ikd45zcmfhtt2emp365tca.ipfs.w3s.link/ipfs/bafybeiczuxeuma5cjuli5mtapqnjqypeaum5ikd45zcmfhtt2emp365tca/create-itk-wasm-test-data.tar.gz https://ipfs.filebase.io/ipfs/QmcxyvUKnaoTTwUqEPXwp1sdcbrFh3XnnwckLKVRpctJx9',
50-
'test:data:pack': 'dam pack test/data test/data.tar.gz',
50+
test: 'pixi run test-data-download && pnpm build:gen:python && pnpm test:python',
5151
'test:python:wasi': 'itk-wasm pnpm-script test:python:wasi',
5252
'test:python:emscripten': 'itk-wasm pnpm-script test:python:emscripten',
5353
'test:python:dispatch': 'itk-wasm pnpm-script test:python:emscripten',
@@ -56,8 +56,7 @@ function generatePackageJson(project: ProjectSpec) {
5656
},
5757
devDependencies: {
5858
'@itk-wasm/dam': '^1.1.1',
59-
'@thewtex/setup-micromamba': '^1.9.7',
60-
'itk-wasm': '1.0.0-b.178'
59+
'itk-wasm': '1.0.0-b.180'
6160
}
6261
}
6362
if (project.author) {

packages/core/typescript/create-itk-wasm/src/generate/pixi-toml.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,16 @@ description = "Build the project"
3131
cmd = "pnpm run test"
3232
description = "Run tests"
3333
34+
[tasks.pnpm-install]
35+
cmd = "pnpm install"
36+
description = "Install Node.js dependencies"
37+
38+
[tasks.test-data-download]
39+
cmd = "npx dam download test/data test/data.tar.gz $ITK_WASM_TEST_DATA_HASH $ITK_WASM_TEST_DATA_URLS"
40+
depends-on = ["pnpm-install"]
41+
outputs = ["test/data.tar.gz"]
42+
description = "Download test data"
43+
3444
[target.win-64.dependencies]
3545
m2w64-jq = ">=1.6.0,<2"
3646
@@ -63,10 +73,10 @@ depends-on = ["version-sync-typescript", "version-sync-python-wasi", "version-sy
6373
description = "Synchronize package versions"
6474
6575
[tasks.publish-typescript]
66-
cmd = "pnpm publish --filter \"{typescript}\""
76+
cmd = "pnpm publish --filter \\"{typescript}\\""
6777
6878
[tasks.publish-python-user-check]
69-
cmd = "if [ -n \"$HATCH_INDEX_USER\"]; then echo \"HATCH_INDEX_USER is set\"; else echo \"HATCH_INDEX_USER is not set\"; exit 1; fi"
79+
cmd = "if [ -n \\"$HATCH_INDEX_USER\\"]; then echo \\"HATCH_INDEX_USER is set\\"; else echo \\"HATCH_INDEX_USER is not set\\"; exit 1; fi"
7080
7181
[tasks.publish-python-wasi]
7282
cmd = '''hatch build &&
@@ -120,7 +130,7 @@ description = "Run tests for itkwasm-${project.pythonPackageName}-emscripten"
120130
cmd = '''mkdir -p dist/pyodide &&
121131
cp -r ../../pyodide dist/ &&
122132
hatch build -t wheel ./dist/pyodide/ &&
123-
echo \"\nVisit http://localhost:8877/console.html\n\" &&
133+
echo \\"\\nVisit http://localhost:8877/console.html\\n\\" &&
124134
python -m http.server --directory=./dist/pyodide 8877'''
125135
cwd = "python/itkwasm-${project.pythonPackageName}-emscripten"
126136
depends-on = ["download-pyodide"]
@@ -140,7 +150,7 @@ description = "Run tests for itkwasm-${project.pythonPackageName}"
140150
cmd = '''mkdir -p dist/pyodide &&
141151
cp -r ../../pyodide dist/ &&
142152
hatch build -t wheel ./dist/pyodide/ &&
143-
echo \"\nVisit http://localhost:8877/console.html\n\" &&
153+
echo \\"\\nVisit http://localhost:8877/console.html\\n\\" &&
144154
python -m http.server --directory=./dist/pyodide 8877'''
145155
cwd = "python/itkwasm-${project.pythonPackageName}"
146156
depends-on = ["download-pyodide"]
@@ -149,6 +159,9 @@ description = "Serve itkwasm-${project.pythonPackageName} for development"
149159
[feature.python.tasks.test-python]
150160
depends-on = ["test-wasi", "test-emscripten", "test-dispatch"]
151161
description = "Run tests for all Python packages"
162+
163+
[environments]
164+
python = ["python"]
152165
`
153166
fs.writeFileSync(pixiTomlPath, content)
154167
}

packages/core/typescript/create-itk-wasm/src/generate/project.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import die from '../die.js'
1010

1111
import generateReadme from './readme.js'
1212
import generatePackageJson from './package-json.js'
13-
import generateEnvironmentYml from './environment-yml.js'
13+
import generatePixiToml from './pixi-toml.js'
1414
import generateCMakelists from './cmakelists.js'
1515
import generatePipeline from './pipeline.js'
1616
import generatePnpmWorkspace from './pnpm-workspace.js'
@@ -43,7 +43,7 @@ function generateProject(
4343

4444
generateReadme(project)
4545
generatePackageJson(project)
46-
generateEnvironmentYml(project)
46+
generatePixiToml(project)
4747
generateCMakelists(project)
4848
generatePnpmWorkspace(project)
4949

0 commit comments

Comments
 (0)