Template repository for building a Python tool that follows the Tool Specification container contract.
This template ships with gotap inside the image. The default container command is:
CMD ["gotap", "run", "foobar", "--input-file", "/in/input.json"]At build time, gotap generate creates parameters.py from src/tool.yml. At runtime, run.py uses the generated bindings to:
- validate
/in/input.json - load typed parameters and data paths
- emit structured run logs
/
|- in/
| |- input.json
|- out/
| |- ...
|- src/
| |- tool.yml
| |- run.py
| |- parameters.py (generated at build time)
| |- CITATION.cff
/in/input.jsoncontains parameter values and data references/out/receives generated files plusgotapmetadata such as_metadata.json/src/tool.ymldefines the tool metadata and command/src/run.pyis the tool entrypoint referenced bytool.yml
Build the image from the template root:
docker build -t tbr_python_template .Run the sample tool with the bundled input and output folders:
docker run --rm -it \
-v "$(pwd)/in:/in" \
-v "$(pwd)/out:/out" \
-e TOOL_RUN=foobar \
tbr_python_templateTOOL_RUN is only needed when the image contains more than one tool entry. The primary runtime contract is still /in/input.json plus gotap run.
- Update
src/tool.ymlto describe your real tool. - Add Python or system dependencies in
Dockerfile. - Implement the tool logic in
src/run.py. - Rebuild the image so
gotap generaterefreshesparameters.py.
The generated parameters.py file is not edited by hand. It exposes:
get_parameters()get_data()get_run_context()get_logger()
The starter code uses get_logger() to write structured JSON Lines logs to the file chosen by gotap.