universe: python: Update to 0.2
Update some API references that had fallen out of use. Notably this no longer ran, since docker.#Run now asks for an "input" not an "image," alpine.#Image became alpine.#Build and you have to reference its output. Remove a FIXME -- now copies the inline script to the container as a file rather than executing it with python -c. Add tests Signed-off-by: Adam Smith <adamsmith@nottheeconomist.com>
This commit is contained in:
44
pkg/universe.dagger.io/python/test/test.cue
Normal file
44
pkg/universe.dagger.io/python/test/test.cue
Normal file
@@ -0,0 +1,44 @@
|
||||
package python
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
"dagger.io/dagger/core"
|
||||
|
||||
"universe.dagger.io/python"
|
||||
)
|
||||
|
||||
dagger.#Plan & {
|
||||
actions: test: {
|
||||
|
||||
// Run a script from source directory + filename
|
||||
runFile: {
|
||||
|
||||
dir: _load.output
|
||||
_load: core.#Source & {
|
||||
path: "./data"
|
||||
include: ["*.py"]
|
||||
}
|
||||
|
||||
run: python.#Run & {
|
||||
export: files: "/out.txt": _
|
||||
script: {
|
||||
directory: dir
|
||||
filename: "helloworld.py"
|
||||
}
|
||||
}
|
||||
output: run.export.files."/out.txt" & "Hello, world\n"
|
||||
}
|
||||
|
||||
// Run a script from string
|
||||
runString: {
|
||||
run: python.#Run & {
|
||||
export: files: "/output.txt": _
|
||||
script: contents: #"""
|
||||
with open("output.txt", 'w') as f:
|
||||
f.write("Hello, inlined world!\n")
|
||||
"""#
|
||||
}
|
||||
output: run.export.files."/output.txt" & "Hello, inlined world!\n"
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user