Files and JSON
Use file ports for persistent artifacts and specialized formats. Use JSON ports for small structured values that should be consumed as an object rather than a table.
Read-only file inputs
input_file returns a path inside the pipeline runtime. Treat that path as
read-only.
Python
from pathlib import Path
import flasktrack as ft
source = Path(ft.input_file("sequence"))
sequence_text = source.read_text(encoding="utf-8")
R
source("/opt/flasktrack/flasktrack.R")
sequence_path <- ft_input_file("sequence")
sequence_text <- paste(readLines(sequence_path, warn = FALSE), collapse = "\n")
Create a separate result and publish it through the declared output port. Do not overwrite or rename the input.
Publish an existing file
Python
R
Supplying an accurate content type helps FlaskTrack and downstream destinations handle the file correctly.
CSV and Parquet
CSV and Parquet helpers read or publish file ports. They do not replace Arrow
table ports between processing blocks.
Python
imported = ft.input_csv("uploaded_csv")
ft.output_parquet("archive", imported, compression="snappy")
R
imported <- ft_input_csv("uploaded_csv")
ft_output_parquet("archive", imported, compression = "snappy")
JSON configuration
Validate required keys and expected value types before using configuration.
import flasktrack as ft
config = ft.input_json("config")
if not isinstance(config, dict):
raise ValueError("config must be a JSON object")
if "minimum_value" not in config:
raise ValueError("config is missing minimum_value")
minimum_value = float(config["minimum_value"])
When publishing JSON, convert library-specific scalar objects to ordinary
Python or R values first. Python JSON output rejects NaN and infinity; decide
whether those values should become null, a string, or an error before
publishing.
Text and binary files
Use output_text for generated plain text and output_bytes for in-memory
binary content. Both require a declared file output.