API Reference¶
Auto-generated from source docstrings.
IO¶
Output Parser¶
fp_wraptr.io.parser
¶
Parse FP output files (fmout.txt) into structured data.
The FP output file contains: 1. Echo of input commands with program responses 2. Estimation results (coefficients, standard errors, fit stats per equation) 3. Solve iteration log 4. Forecast table: for each requested variable, rows of - "P lv" (level values), "P ch" (absolute change), "P %ch" (percent change) across quarterly periods
Example forecast block from fmout.txt: Variable Periods forecast are 2025.4 TO 2029.4 427 PCY P lv 5.0353 4.2968 2.3212 ... P ch -0.58871 -0.73847 -1.9756 ... P %ch -35.744 -46.974 -91.483 ...
FPOutputData
dataclass
¶
Parsed FP output data.
Source code in src/fp_wraptr/io/parser.py
to_dataframe()
¶
Convert forecast data to a pandas DataFrame.
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with periods as index and variables as columns (level values). |
Source code in src/fp_wraptr/io/parser.py
to_dict()
¶
Convert to a JSON-serializable dictionary.
Source code in src/fp_wraptr/io/parser.py
ForecastVariable
dataclass
¶
A single variable's forecast data.
Source code in src/fp_wraptr/io/parser.py
EstimationResult
dataclass
¶
Estimation results for a single equation.
Source code in src/fp_wraptr/io/parser.py
EstimationCoefficient
dataclass
¶
A single coefficient from an equation's estimation results.
Source code in src/fp_wraptr/io/parser.py
SolveIteration
dataclass
¶
parse_fp_output(path)
¶
Parse an FP output file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path | str
|
Path to fmout.txt or similar FP output file. |
required |
Returns:
| Type | Description |
|---|---|
FPOutputData
|
FPOutputData with extracted forecast information. |
Source code in src/fp_wraptr/io/parser.py
Input Parser¶
fp_wraptr.io.input_parser
¶
Parse FP input and related data-format files.
Parsers included:
- FP input file (fminput.txt) command-oriented parser.
- FP model data file (fmdata.txt) with SMPL / LOAD / values blocks.
- FM exogenous file (fmexog.txt) with SMPL / CHANGEVAR variable overrides.
parse_fp_input(path)
¶
Parse an FP input file into a structured dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path | str
|
Path to fminput.txt or similar FP input file. |
required |
Returns:
| Type | Description |
|---|---|
dict
|
Structured dictionary with parsed command sections. |
Source code in src/fp_wraptr/io/input_parser.py
parse_fp_input_text(text)
¶
Parse FP input text into structured fields.
The parser is line-oriented at the command level and splits on semicolons, which is how FP consumes commands.
Source code in src/fp_wraptr/io/input_parser.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | |
Writer¶
fp_wraptr.io.writer
¶
Utilities for generating FP input artifacts and patched inputs.
This module writes FP exogenous variable override files and applies text-level
patches to base FP input files, including INPUT FILE reference updates for
generated fmexog inputs.
write_exogenous_file(variables, sample_start, sample_end, output_path)
¶
Write an FP exogenous variable file (CHANGEVAR format).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
variables
|
dict[str, dict]
|
Dict mapping variable names to {method, value} dicts. method: one of CHGSAMEPCT, SAMEVALUE, CHGSAMEABS value: numeric value or list of (period, value) pairs |
required |
sample_start
|
str
|
Start period, e.g. "2025.4" |
required |
sample_end
|
str
|
End period, e.g. "2029.4" |
required |
output_path
|
Path
|
Where to write the file. |
required |
Returns:
| Type | Description |
|---|---|
Path
|
Path to the written file. |
Source code in src/fp_wraptr/io/writer.py
patch_fmexog_reference(base_input, fmexog_path, output_path)
¶
Patch INPUT FILE references to an FMEXOG-style file path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
base_input
|
Path
|
Path to source input file. |
required |
fmexog_path
|
Path
|
Path to the replacement exogenous input file. |
required |
output_path
|
Path
|
Output path for patched file. |
required |
Returns:
| Type | Description |
|---|---|
Path
|
Path to patched file. |
Source code in src/fp_wraptr/io/writer.py
patch_input_file(base_input, overrides, output_path)
¶
Create a modified FP input file by applying text-level overrides.
Supports two patch styles
1) Literal replacement (legacy): {"old text": "new text"}
2) Command-aware parameter patch:
{"cmd:SETUPSOLVE.MAXCHECK": "80"}
{"cmd:SETUPSOLVE[1].MINITERS": "40"}
Command-aware patches update FP command parameters without relying on fragile full-command string matches.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
base_input
|
Path
|
Path to the original fminput.txt. |
required |
overrides
|
dict[str, str]
|
Dict of {search_string: replacement_string} pairs. |
required |
output_path
|
Path
|
Where to write the patched file. |
required |
Returns:
| Type | Description |
|---|---|
Path
|
Path to the written file. |
TODO: Replace with AST-level manipulation once input parser is complete.
Source code in src/fp_wraptr/io/writer.py
Scenarios¶
Configuration¶
fp_wraptr.scenarios.config
¶
Scenario configuration models.
A scenario config is a YAML file that describes: - Which FP model directory to use - What exogenous variable overrides to apply - Forecast period settings - What variables to track in output - Optional input overlay directory for extra include scripts
Example YAML
name: higher_growth description: "Test scenario with higher potential GDP growth" fp_home: FM forecast_start: "2025.4" forecast_end: "2029.4" overrides: YS: method: CHGSAMEPCT value: 0.008 track_variables: - PCY - UR - GDPR
ScenarioConfig
¶
Bases: BaseModel
Configuration for an FP scenario run.
Source code in src/fp_wraptr/scenarios/config.py
from_yaml(path)
classmethod
¶
Load scenario config from a YAML file.
Source code in src/fp_wraptr/scenarios/config.py
to_yaml(path)
¶
Write scenario config to a YAML file.
Source code in src/fp_wraptr/scenarios/config.py
VariableOverride
¶
Bases: BaseModel
Override for a single exogenous variable.
Source code in src/fp_wraptr/scenarios/config.py
Runner¶
fp_wraptr.scenarios.runner
¶
Scenario execution pipeline.
Orchestrates the full run flow: 1. Load scenario config (YAML) 2. Prepare working directory (copy data files + apply overrides) 3. Invoke fp.exe via subprocess wrapper 4. Parse output 5. Generate charts
ScenarioResult
dataclass
¶
Result of a scenario execution.
Source code in src/fp_wraptr/scenarios/runner.py
run_scenario(config, output_dir=None, backend=None)
¶
Execute a scenario end-to-end.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
ScenarioConfig
|
Scenario configuration. |
required |
output_dir
|
Path | None
|
Base directory for run artifacts. |
None
|
backend
|
ModelBackend | None
|
Optional execution backend (defaults to FPExecutable). |
None
|
Returns:
| Type | Description |
|---|---|
ScenarioResult
|
ScenarioResult with run outcome and parsed data. |
Source code in src/fp_wraptr/scenarios/runner.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 | |
load_scenario_config(path)
¶
Load a scenario YAML file with a clear path-focused error message.
Source code in src/fp_wraptr/scenarios/runner.py
validate_fp_home(fp_home)
¶
Validate that fp_home exists and provide actionable remediation.
Source code in src/fp_wraptr/scenarios/runner.py
Batch¶
fp_wraptr.scenarios.batch
¶
Batch scenario execution and golden-output comparison tools.
run_batch(configs, output_dir, baseline_dir=None)
¶
Run each scenario configuration in sequence and return results.
Source code in src/fp_wraptr/scenarios/batch.py
compare_to_golden(result, golden_dir, tolerance=0.0001)
¶
Compare a scenario result against a stored golden output.
Source code in src/fp_wraptr/scenarios/batch.py
save_golden(result, golden_dir)
¶
Copy fmout.txt into a golden directory.
Source code in src/fp_wraptr/scenarios/batch.py
DSL Compiler¶
fp_wraptr.scenarios.dsl
¶
Human-readable scenario DSL compiler.
This module provides a lightweight line-oriented DSL that compiles into
ScenarioConfig so users can author scenarios without verbose YAML.
Example DSL::
scenario baseline_plus
description "Higher growth + lower rates"
forecast 2025.4 to 2029.4
track PCY,UR,GDPR
set YS CHGSAMEPCT 0.008
alert UR max 6.0
patch cmd:SETUPSOLVE.MAXCHECK 80
policy monetary_rule rate=4.0 method=SAMEVALUE
DSLCompileError
¶
Bases: ValueError
Raised when DSL text cannot be compiled into a valid scenario.
Source code in src/fp_wraptr/scenarios/dsl.py
compile_scenario_dsl_text(text, default_name=None)
¶
Compile DSL text into ScenarioConfig.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
DSL source text. |
required |
default_name
|
str | None
|
Optional fallback scenario name if no |
None
|
Source code in src/fp_wraptr/scenarios/dsl.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | |
compile_scenario_dsl_file(path)
¶
Compile a DSL file into ScenarioConfig.
Analysis¶
Diff¶
fp_wraptr.analysis.diff
¶
Compare FP runs and produce summary deltas.
Compares two parsed FP outputs (or two run directories) and reports the top variable differences, both absolute and percentage.
diff_outputs(baseline, scenario, top_n=20)
¶
Compare two parsed FP outputs.
Computes the difference in the final forecast period level for each common variable and ranks by absolute difference.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
baseline
|
FPOutputData
|
Baseline parsed output. |
required |
scenario
|
FPOutputData
|
Scenario parsed output. |
required |
top_n
|
int
|
Number of top deltas to include. |
20
|
Returns:
| Type | Description |
|---|---|
dict
|
Dict with: |
dict
|
|
dict
|
|
dict
|
|
dict
|
|
Source code in src/fp_wraptr/analysis/diff.py
diff_run_dirs(dir_a, dir_b, top_n=20)
¶
Compare two run directories by parsing their fmout.txt files.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dir_a
|
Path | str
|
First run directory (baseline). |
required |
dir_b
|
Path | str
|
Second run directory (scenario). |
required |
top_n
|
int
|
Number of top deltas to include. |
20
|
Returns:
| Type | Description |
|---|---|
dict
|
Dict with comparison summary. |
Source code in src/fp_wraptr/analysis/diff.py
export_diff_csv(diff_result, output_path)
¶
Export diff deltas as a CSV file.
Source code in src/fp_wraptr/analysis/diff.py
export_diff_excel(diff_result, output_path)
¶
Export diff deltas as an Excel file.
Source code in src/fp_wraptr/analysis/diff.py
Report¶
fp_wraptr.analysis.report
¶
Utilities for generating markdown run reports.
build_run_report(run_dir, baseline_dir=None)
¶
Build a markdown summary for a completed fp-wraptr run.
Source code in src/fp_wraptr/analysis/report.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | |
Dependency Graph¶
fp_wraptr.analysis.graph
¶
Build and analyze FP dependency graphs.
build_dependency_graph(parsed_input)
¶
Build a variable dependency graph.
The graph has a directed edge B -> A when variable A depends on B
in any supported command type.
Source code in src/fp_wraptr/analysis/graph.py
summarize_graph(graph)
¶
Summarize node/edge counts and core structural diagnostics.
Source code in src/fp_wraptr/analysis/graph.py
get_upstream(graph, variable)
¶
Return all ancestors of variable.
get_downstream(graph, variable)
¶
Return all descendants of variable.
Visualization¶
fp_wraptr.viz.plots
¶
Forecast visualization using matplotlib.
Provides two canonical plot types: 1. Forecast levels: time series of variable levels over the forecast horizon. 2. Forecast comparison: overlay baseline vs scenario levels with delta shading.
plot_forecast(data, variables=None, output_path=Path('artifacts/forecast.png'), title=None)
¶
Plot forecast levels for selected variables.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
FPOutputData
|
Parsed FP output data. |
required |
variables
|
list[str] | None
|
List of variable names to plot. If None, plots all. |
None
|
output_path
|
Path | str
|
Path to save the chart. |
Path('artifacts/forecast.png')
|
title
|
str | None
|
Chart title. If None, auto-generated. |
None
|
Returns:
| Type | Description |
|---|---|
Path
|
Path to the saved chart file. |
Source code in src/fp_wraptr/viz/plots.py
plot_comparison(baseline, scenario, variables=None, output_path=Path('artifacts/comparison.png'), title=None)
¶
Plot baseline vs scenario comparison for selected variables.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
baseline
|
FPOutputData
|
Baseline parsed output. |
required |
scenario
|
FPOutputData
|
Scenario parsed output. |
required |
variables
|
list[str] | None
|
Variables to compare. If None, uses common variables. |
None
|
output_path
|
Path | str
|
Path to save the chart. |
Path('artifacts/comparison.png')
|
title
|
str | None
|
Chart title. |
None
|
Returns:
| Type | Description |
|---|---|
Path
|
Path to the saved chart file. |
Source code in src/fp_wraptr/viz/plots.py
Dashboard¶
Artifacts¶
fp_wraptr.dashboard.artifacts
¶
Helpers for discovering and loading fp-wraptr dashboard run artifacts.
RunArtifact
dataclass
¶
Metadata for one scenario run artifact directory.
Source code in src/fp_wraptr/dashboard/artifacts.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | |
backend_name
property
¶
Return the configured backend for the run (fpexe/fppy/both/unknown).
load_output()
¶
Load and parse output data for this run.
Preference order
1) fmout.txt (rich FP console output)
2) LOADFORMAT.DAT / PABEV.TXT / PACEV.TXT (PRINTVAR LOADFORMAT series)
Source code in src/fp_wraptr/dashboard/artifacts.py
load_series_output()
¶
Load run output preferring LOADFORMAT-style series over fmout.
This is useful for side-by-side comparisons between fpexe/fppy runs, since both engines emit comparable LOADFORMAT artifacts.
Source code in src/fp_wraptr/dashboard/artifacts.py
scan_artifacts(artifacts_dir)
¶
Scan for run directories up to three levels deep.
A run is identified by a scenario.yaml file present in the directory.
Source code in src/fp_wraptr/dashboard/artifacts.py
Charts¶
fp_wraptr.dashboard.charts
¶
Plotly chart builders for dashboard forecast and comparison views.
forecast_figure(data, variables=None, title=None, mode='levels', *, units=None)
¶
Build a multi-panel forecast figure for selected variables.
Source code in src/fp_wraptr/dashboard/charts.py
comparison_figure(baseline, scenario, variables=None, title=None, baseline_label='Baseline', scenario_label='Scenario', *, units=None)
¶
Build baseline-vs-scenario subplots with area shading between series.
Source code in src/fp_wraptr/dashboard/charts.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | |
delta_bar_chart(diff_result, top_n=15, sort_by='abs_delta')
¶
Build a horizontal bar chart of top-delta forecast changes.
Source code in src/fp_wraptr/dashboard/charts.py
FRED¶
fp_wraptr.fred.ingest
¶
Fetch economic time series from the FRED API.
Requires the fredapi optional dependency and a FRED API key
set via the FRED_API_KEY environment variable.
get_fred_client()
¶
Create and return an authenticated Fred API client.
Source code in src/fp_wraptr/fred/ingest.py
fetch_series(series_ids, start=None, end=None, cache_dir=None, cache_ttl_seconds=DEFAULT_CACHE_TTL_SECONDS, respect_tos=True, min_request_interval_seconds=DEFAULT_MIN_REQUEST_INTERVAL_SECONDS)
¶
Fetch one or more series from FRED as a wide DataFrame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
series_ids
|
list[str]
|
FRED series IDs to fetch. |
required |
start
|
str | None
|
Optional observation start date (YYYY-MM-DD). |
None
|
end
|
str | None
|
Optional observation end date (YYYY-MM-DD). |
None
|
cache_dir
|
Path | None
|
Cache directory for JSON payloads. |
None
|
cache_ttl_seconds
|
int
|
Maximum cache age before refresh. |
DEFAULT_CACHE_TTL_SECONDS
|
respect_tos
|
bool
|
If True, insert delay between API calls to avoid burst traffic. |
True
|
min_request_interval_seconds
|
float
|
Minimum delay between uncached calls. |
DEFAULT_MIN_REQUEST_INTERVAL_SECONDS
|
Source code in src/fp_wraptr/fred/ingest.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | |
clear_cache(cache_dir=None)
¶
Delete all cached FRED series files.
Source code in src/fp_wraptr/fred/ingest.py
Runtime¶
Backend Protocol¶
fp_wraptr.runtime.backend
¶
Runtime backend protocol for model execution.
Defines the interface that any model backend (fp.exe subprocess, fair-py pure-Python engine, or future alternatives) must satisfy in order to be used by the scenario runner.
ModelBackend
¶
Bases: Protocol
Protocol that every model execution backend must implement.
Implementations
FPExecutable— subprocess wrapper around fp.exe / WineFairPyBackend— pure-Python engine (wraps fair-py / fp-py)
Source code in src/fp_wraptr/runtime/backend.py
check_available()
¶
run(input_file=None, work_dir=None, extra_env=None)
¶
Execute a model run and return the result.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_file
|
Path | None
|
Path to the input file. |
None
|
work_dir
|
Path | None
|
Working directory for the run. |
None
|
extra_env
|
dict[str, str] | None
|
Additional environment variables. |
None
|
Returns:
| Type | Description |
|---|---|
RunResult
|
RunResult with captured output. |
Source code in src/fp_wraptr/runtime/backend.py
RunResult
dataclass
¶
Backend-agnostic result of a model run.
Source code in src/fp_wraptr/runtime/backend.py
BackendInfo
dataclass
¶
Metadata about a backend for display/debugging.
Source code in src/fp_wraptr/runtime/backend.py
fp.exe Backend¶
fp_wraptr.runtime.fp_exe
¶
Subprocess wrapper for the Fair-Parke executable (fp.exe).
fp.exe is a Windows PE32 binary. On macOS/Linux it requires Wine. The executable reads from stdin (via INPUT FILE= directive) and writes to stdout. Key files it expects in its working directory: - fminput.txt (or specified input file) - fmdata.txt, fmage.txt, fmexog.txt (data files referenced by input)
Environment variable FP_HOME (or config) points to the directory containing fp.exe and data files.
FPExecutable
dataclass
¶
Wrapper around the fp.exe subprocess.
Usage
fp = FPExecutable(fp_home=Path("FM")) result = fp.run(input_file=Path("fminput.txt"), work_dir=Path("runs/test1"))
Source code in src/fp_wraptr/runtime/fp_exe.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 | |
check_available()
¶
Check if fp.exe (and Wine if needed) are available.
preflight_report(input_file=None, work_dir=None)
¶
Return diagnostic details about fp.exe run prerequisites.
Source code in src/fp_wraptr/runtime/fp_exe.py
run(input_file=None, work_dir=None, extra_env=None)
¶
Run fp.exe with the given input file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_file
|
Path | None
|
Path to the FP input file. If None, uses fminput.txt in fp_home. |
None
|
work_dir
|
Path | None
|
Working directory for the run. If None, uses fp_home. Data files are copied here if work_dir != fp_home. |
None
|
extra_env
|
dict[str, str] | None
|
Additional environment variables. |
None
|
Returns:
| Type | Description |
|---|---|
FPRunResult
|
FPRunResult with stdout/stderr capture. |
Raises:
| Type | Description |
|---|---|
FPExecutableError
|
If fp.exe is not found or Wine is unavailable. |
Source code in src/fp_wraptr/runtime/fp_exe.py
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 | |
fair-py Backend (stub)¶
fp_wraptr.runtime.fairpy
¶
fppy (fp-py) pure-Python backend.
fp-wraptr vendors the fppy package and runs it as a subprocess using:
python -m fppy.cli mini-run ...
This keeps the integration surface stable while fppy continues to evolve. The parity contract for fp-wraptr is PABEV.TXT (PRINTVAR LOADFORMAT output).
FairPyBackend
dataclass
¶
Pure-Python model backend wrapping vendored fppy via subprocess.
Source code in src/fp_wraptr/runtime/fairpy.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 | |
info()
¶
Return metadata about this backend.