API Reference¶
Auto-generated from the source docstrings. For task-writing guidance start with the Guide; this page is the exhaustive symbol reference.
Top-level API¶
The public API re-exported from oryxflow — run, preview, Workflow, WorkflowMulti,
the requires / inherits decorators, the Parameter types, and the invalidate_* /
enable_* helpers.
Engine — oryxflow.core¶
oryxflow.core ¶
Mini-engine: a small, self-contained execution engine for oryxflow. Provides the Task base
class, target bases, flatten/getpaths, deterministic task ids, the
inherits/requires decorators, find_deps and a sequential build.
The execution engine is sequential: the DAG is run in dependency order in-process. The
workers argument is accepted for API compatibility but ignored.
Register ¶
Bases: type
Minimal metaclass providing a class-level task_family property and instance memoization.
A property defined directly on class:
Task is only invoked for instances; reading
SomeTaskClass.task_family needs this metaclass property (used eg by WorkflowMulti).
__call__ memoizes instances so two Cls(**same_params) calls return the identical
object (and __init__ runs only on the first), preserving the instance identity that
Workflow's path/flow propagation depends on.
Source code in oryxflow/core.py
Task ¶
Base class for all oryxflow tasks.
Subclasses declare class:
~oryxflow.parameter.Parameter members and override
meth:
run, meth:
requires and meth:
output.
Source code in oryxflow/core.py
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 | |
logger
property
¶
Contextual logger for task authors; auto-tagged with task identity.
Lives in the oryxflow namespace, so it is silent until
oryxflow.enable_logging() is called.
get_params
classmethod
¶
Return all (name, Parameter) pairs for this task, in declaration order.
Source code in oryxflow/core.py
get_param_names
classmethod
¶
Return parameter names. include_significant=True returns all params.
get_param_values
classmethod
¶
Resolve parameter values from positional args, kwargs and defaults.
:param params: list of (param_name, Parameter)
:param args: positional arguments
:param kwargs: keyword arguments
:returns: list of (name, value) tuples, one per parameter
Source code in oryxflow/core.py
get_task_family
classmethod
¶
to_str_params ¶
Convert parameters to a {name: serialized_value} dict.
:param bool only_significant: only include parameters marked significant. :param bool only_public: accepted for API compatibility; visibility is not modeled.
Source code in oryxflow/core.py
clone ¶
Create a new task instance from this one, overriding some args.
Parameters common to this task and cls are carried over; kwargs take precedence.
Source code in oryxflow/core.py
requires_grid ¶
Build the requires() dict for depending on cls once per value -- the runtime
form of the @requires_each decorator, for when the values are only known here
(computed from this task's own parameters).
Each keyword is a parameter name mapped to the list of values to fan out over;
the cartesian product of those lists is taken. Every task returned is a
meth:
clone, so the parameters this task and cls have in common -- everything
the flow passed down -- reach every branch without being listed here.
Dict keys are the value itself for a single parameter, or name_value pairs joined
with _ for several; they are what inputLoad(task=key) selects on.
A value may also be a callable taking this task and returning the list, for a grid
computed from this task's own parameters. It may not read this task's inputs --
input() is defined as getpaths(self.requires()), so that recurses forever.
derive={'name': fn} sets a FURTHER parameter per branch, computed from that branch's
fanned values: derive={'source': lambda v: URLS[v['region']]}. It lands in the
branch's parameters, and therefore in its task_id -- so editing the lookup
invalidates exactly the branches it changes. The derived name stays OUT of the dict key
(the key remains the fanned value, which the derived value is a function of).
::
def requires(self):
return self.requires_grid(ProcessState, state=STATES[self.country])
Source code in oryxflow/core.py
complete ¶
True if all of this task's outputs exist.
Note: TaskData OVERRIDES this to ALSO require the stored code
fingerprint to match the current one (TaskData._code_ok), so a
code_version bump makes a task incomplete and forces a rerun -- the
fingerprint is authoritative here, not merely advisory. The AST
source-hash is a SEPARATE, warn-only advisory (fires when code changed
but code_version did not); it does not gate completeness.
Source code in oryxflow/core.py
output ¶
requires ¶
input ¶
deps ¶
Target ¶
LocalTarget ¶
Bases: Target
Tiny local target base.
self.path is stored as-is (NOT coerced to str); subclasses
(CacheTarget/_LocalPathTarget) override the rest and normalize the path.
Source code in oryxflow/core.py
inherits ¶
Copy parameters (and nothing else) from one or more task classes onto the decorated task,
and add clone_parent/clone_parents helpers. Avoids pythonic inheritance.
Supports positional tasks (clone_parents returns a list) or named tasks via keyword
arguments (clone_parents returns a dict).
Source code in oryxflow/core.py
requires_each ¶
Fan out over ONE task: copies its parameters except the ones being fanned out, and
defines requires() as a meth:
Task.requires_grid over them.
The decorated task is the point the branches converge into, so it must NOT carry the fanned-out parameter itself -- that is why those names are skipped when the parameters are copied across.
Stacks with @requires/@inherits/other @requires_each decorators. Pass a
single-entry {name: Cls} dict to name the group; it defaults to the dependency's
task family. A grid value may be a callable taking the task, resolved at requires()
time against its parameters.
derive={'name': fn} sets a further parameter per branch from that branch's fanned values
(see meth:
Task.requires_grid); derived names are excluded from the decorated task's
parameters for the same reason fanned ones are.
Source code in oryxflow/core.py
requires ¶
Same as class:
inherits, but also auto-defines the requires method.
Source code in oryxflow/core.py
TaskFailure ¶
One failed task: the task instance plus why it failed.
Source code in oryxflow/core.py
RunResult ¶
What happened to the DAG in one build: identities, status, failure context.
Source code in oryxflow/core.py
MultiRunResult ¶
Bases: dict
Return value of WorkflowMulti.run(): a {flow_name: RunResult} dict that also
carries .summary()/.success so print(result.summary()) works the same as for a
single Workflow (whose run() returns a plain class:
RunResult).
Source code in oryxflow/core.py
summary ¶
Per-flow execution summaries, each under a ===== <flow> ===== header.
flatten ¶
Create a flat list of all items in a structured object (dicts, lists, items)::
>>> sorted(flatten({'a': 'foo', 'b': 'bar'}))
['bar', 'foo']
>>> sorted(flatten(['foo', ['bar', 'troll']]))
['bar', 'foo', 'troll']
>>> flatten('foo')
['foo']
>>> flatten(42)
[42]
Source code in oryxflow/core.py
getpaths ¶
Map all Tasks in a structured object to their .output().
Source code in oryxflow/core.py
traversal_scope ¶
Memoize completeness, resolved dependencies and code fingerprints for the duration of
one traversal -- a build, a preview, a Workflow.complete(), accept_code(), the
upstream/downstream walks behind the invalidate helpers.
Nested scopes share one memo and only the outermost drops it, so a task's run() calling
oryxflow.run() (flow-within-a-flow) needs no special case: that nested build clears the
shared volatile memo whenever it materializes something.
Source code in oryxflow/core.py
traversal_stats ¶
Memo counters for the traversal in flight, else the most recent one.
Internal. The regression tests assert on the MISS counts: one miss per unique task is the invariant this whole section exists to hold, and unlike wall-clock it is deterministic.
Source code in oryxflow/core.py
traversal_memo_clear ¶
Drop the volatile memo: something changed what is complete (a task materialized, an output was invalidated). The structural memos are untouched -- neither the code nor the DAG shape changes mid-traversal.
Source code in oryxflow/core.py
complete_cached ¶
Evaluate a cascading complete() at most once per task per traversal.
cascade=False is never memoized: it does no recursion, so there is nothing to save, and
it is what the load paths ask right after a save.
Source code in oryxflow/core.py
task_id_str ¶
Return a canonical, deterministic string identifying a task.
The id is {family}_{param_summary}_{md5(sorted_json)[:10]} so that
task_id.split('_')[0] yields the task family (the directory convention).
:param task_family: the task family (class name) :param params: dict mapping parameter names to serialized (str) values
Source code in oryxflow/core.py
dfs_paths ¶
Back-compat generator: yield tasks on paths from start_task to goal_task_family
(goal_task_family=None yields the whole upstream DAG). Superseded by find_paths
(ordered paths) and find_deps (deduped set); both are memoized.
Source code in oryxflow/core.py
find_deps ¶
Set of all tasks on all paths between task (the downstream root) and
upstream_task_family. upstream_task_family=None returns the whole upstream DAG.
Source code in oryxflow/core.py
find_paths ¶
Ordered dependency paths (task -> ... -> upstream_task_family), deduped, root
first. Returns a list of lists of task instances; empty if the family is unreachable.
Source code in oryxflow/core.py
build ¶
Run tasks and their dependencies sequentially, in dependency order.
All state is local to this call, so a task's run() may itself call oryxflow.run /
flow.run (the flow-within-a-flow pattern) without corrupting the outer build.
External tasks (external=True or run is None) are never executed; if still
incomplete after their dependencies, they are marked failed.
:param flow: flow name when launched via Workflow/WorkflowMulti; stamped into
this build's event envelopes.
:returns: a class:
RunResult with .ran/.complete/.failed task identities,
.success, .run_id, per-task .reasons and code-change .warnings.
Source code in oryxflow/core.py
1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 | |
Parameters — oryxflow.parameter¶
oryxflow.parameter ¶
Self-contained, trimmed set of parameter types used by oryxflow.
There is no command-line / config-file value resolution, parameter visibility,
date_interval, freezing (FrozenOrderedDict) or jsonschema support. Values
are resolved from the constructor argument or the default only.
Only the parameter types oryxflow actually uses are kept:
Parameter, IntParameter, FloatParameter, BoolParameter, DateParameter,
DictParameter, ListParameter, ChoiceParameter and EnumParameter.
ParameterException ¶
MissingParameterException ¶
Bases: ParameterException
Raised when a required parameter has no value and no default.
UnknownParameterException ¶
Bases: ParameterException
Raised when an unknown parameter is supplied to a task.
DuplicateParameterException ¶
Bases: ParameterException
Raised when a parameter is supplied both positionally and as a keyword.
Parameter ¶
Parameter whose value is a str, and the base class for the other parameter types.
Parameters are set on the Task class to parameterize tasks::
class MyTask(oryxflow.tasks.TaskData):
foo = oryxflow.Parameter()
When a value is not provided at instantiation, the default is used.
Source code in oryxflow/parameter.py
IntParameter ¶
FloatParameter ¶
BoolParameter ¶
Bases: Parameter
A Parameter whose value is a bool. Has an implicit default of False.
Source code in oryxflow/parameter.py
parse ¶
Parse a bool from the string, matching 'true'/'false' case-insensitively.
Source code in oryxflow/parameter.py
DateParameter ¶
Bases: Parameter
Parameter whose value is a class:
~datetime.date, formatted YYYY-MM-DD.
Source code in oryxflow/parameter.py
DictParameter ¶
Bases: Parameter
Parameter whose value is a dict.
The value is stored as-is (no freezing); it is serialized with sorted keys so that the task id stays deterministic.
Source code in oryxflow/parameter.py
ListParameter ¶
Bases: Parameter
Parameter whose value is a list.
The value is stored as-is (no freezing); it is serialized as JSON so that the task id stays deterministic.
Source code in oryxflow/parameter.py
ChoiceParameter ¶
Bases: Parameter
A string-valued parameter restricted to a fixed set of choices::
class MyTask(oryxflow.tasks.TaskData):
model = oryxflow.ChoiceParameter(choices=['rf', 'lgbm'], default='rf')
Values stay plain strings (no enum.Enum ceremony, unlike
:class:EnumParameter); a value outside choices raises immediately at task
construction (or when the default is resolved), so typos fail fast instead of
dying deep in downstream code.
Source code in oryxflow/parameter.py
EnumParameter ¶
Bases: Parameter
A parameter whose value is an :class:~enum.Enum. Pass the enum class via enum=::
class Model(enum.Enum):
Honda = 1
Volvo = 2
class MyTask(oryxflow.tasks.TaskData):
my_param = oryxflow.EnumParameter(enum=Model)
Source code in oryxflow/parameter.py
Tasks — oryxflow.tasks¶
oryxflow.tasks ¶
TaskData ¶
Bases: Task
Task which has data as input and output
Attributes:
| Name | Type | Description |
|---|---|---|
target_class |
obj
|
target data format |
target_ext |
str
|
file extension |
persists |
list
|
list of strings naming the outputs this task saves.
Declare it on your task class, e.g. |
data |
dict
|
data container for all outputs |
Source code in oryxflow/tasks/__init__.py
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 | |
reset ¶
invalidate ¶
Reset a task, eg by deleting output file
Source code in oryxflow/tasks/__init__.py
complete ¶
Check if a task is complete: output exists AND the stored code fingerprint
matches the current one (_code_ok -- a code_version bump makes the
task incomplete and forces a rerun; authoritative, unlike the warn-only AST
source-hash advisory). With check_dependencies, cascades upstream.
The cascading form is evaluated once per task per engine traversal (see
core.traversal_scope); cascade=False is never memoized.
Source code in oryxflow/tasks/__init__.py
output ¶
Output target(s) this task produces
Source code in oryxflow/tasks/__init__.py
inputLoad ¶
Load all or several outputs from task
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
keys
|
list
|
list of data to load |
None
|
task
|
str, class
|
if requires multiple tasks load that task 'input1' for eg |
None
|
cached
|
bool
|
cache data in memory |
False
|
as_dict
|
bool
|
if the inputs were saved as a dictionary. use this to return them as dictionary. |
False
|
flatten
|
bool
|
False groups a fan-out's branches under one key, so a task that mixes a fan-out with shared inputs can tell them apart |
True
|
Returns: list or dict of all task output
Source code in oryxflow/tasks/__init__.py
inputLoadConcat ¶
inputLoadConcat(keys=None, tag=True, tagkeys=None, as_dict=False, concat_fn=None, cached=False, task=None, flatten=True)
Load every dependency and concatenate into one DataFrame. Works for the dict form of requires() ({key: Task(...)}) and the list/positional form. By default each dependency's significant params are added as columns. concat_fn(identifier, params, df)->df overrides.
task: concatenate only one fan-out group (the group name, or the dependency class -- pass the class and a rename can't break it), or only one dependency. flatten: False returns {name: DataFrame} -- each fan-out group concatenated within itself, every other dependency its own entry.
Source code in oryxflow/tasks/__init__.py
outputLoad ¶
Load all or several outputs from task
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
keys
|
list
|
list of data to load |
None
|
as_dict
|
bool
|
cache data in memory |
False
|
cached
|
bool
|
cache data in memory |
False
|
Returns: list or dict of all task output
Source code in oryxflow/tasks/__init__.py
save ¶
Persist data to target
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict
|
data to save. keys are the self.persist keys and values is data |
required |
Source code in oryxflow/tasks/__init__.py
TaskCache ¶
TaskCachePandas ¶
TaskJson ¶
TaskPickle ¶
TaskCSVPandas ¶
TaskCSVGZPandas ¶
TaskExcelPandasSingle ¶
Bases: TaskData
Task which saves each persist key as a separate Excel file
Source code in oryxflow/tasks/__init__.py
TaskExcelPandas ¶
Bases: TaskData
Task which saves multiple dataframes as sheets in a single Excel file
Source code in oryxflow/tasks/__init__.py
TaskPqPandas ¶
TaskMarkdown ¶
TaskAggregator ¶
Bases: Task
Task which groups other tasks, without saving an output of its own
Declare the group in requires() (or with @oryxflow.requires) and leave
run() empty. The group is complete when every task it requires is complete.
example::
@oryxflow.requires({'ols': TaskTrainOLS, 'gbm': TaskTrainGBM})
class TaskTrainAll(oryxflow.tasks.TaskAggregator):
pass
oryxflow.Workflow(TaskTrainAll).run()
For a one-off group that needs no task of its own, pass a list instead:
oryxflow.run([TaskTrainOLS(), TaskTrainGBM()]).
Source code in oryxflow/tasks/__init__.py
Targets — oryxflow.targets¶
oryxflow.targets ¶
CacheTarget ¶
Bases: LocalTarget
Saves to in-memory cache, loads to python object
Source code in oryxflow/targets/__init__.py
DataTarget ¶
Bases: _LocalPathTarget
Local target which saves in-memory data (eg dataframes) to persistent storage (eg files) and loads from storage to memory
This is an abstract class that you should extend.
Source code in oryxflow/targets/__init__.py
load ¶
Runs a function to load data from storage into memory
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fun
|
function
|
loading function |
required |
cached
|
bool
|
keep data cached in memory |
False
|
**kwargs
|
arguments to pass to |
{}
|
Returns: data object
Source code in oryxflow/targets/__init__.py
save ¶
Runs a function to save data from memory into storage
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
obj
|
data to save |
required |
fun
|
function
|
saving function |
required |
**kwargs
|
arguments to pass to |
{}
|
Returns: filename
Source code in oryxflow/targets/__init__.py
CSVPandasTarget ¶
Bases: DataTarget
Saves to CSV, loads to pandas dataframe
Source code in oryxflow/targets/__init__.py
load ¶
Load from csv to pandas dataframe
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cached
|
bool
|
keep data cached in memory |
False
|
**kwargs
|
arguments to pass to pd.read_csv |
{}
|
Returns: pandas dataframe
Source code in oryxflow/targets/__init__.py
save ¶
Save dataframe to csv
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
obj
|
pandas dataframe |
required |
**kwargs
|
dict
|
additional arguments to pass to df.to_csv |
{}
|
Returns: filename
Source code in oryxflow/targets/__init__.py
CSVGZPandasTarget ¶
Bases: CSVPandasTarget
Saves to CSV gzip, loads to pandas dataframe
Source code in oryxflow/targets/__init__.py
save ¶
Save dataframe to csv gzip
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
obj
|
pandas dataframe |
required |
**kwargs
|
dict
|
additional arguments to pass to df.to_csv |
{}
|
Returns: filename
Source code in oryxflow/targets/__init__.py
ExcelPandasTarget ¶
Bases: DataTarget
Saves to Excel, loads to pandas dataframe
Source code in oryxflow/targets/__init__.py
load ¶
Load from Excel to pandas dataframe
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cached
|
bool
|
keep data cached in memory |
False
|
**kwargs
|
arguments to pass to pd.read_csv |
{}
|
Returns: pandas dataframe
Source code in oryxflow/targets/__init__.py
save ¶
Save dataframe to Excel
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
obj
|
pandas dataframe |
required |
**kwargs
|
dict
|
additional arguments to pass to df.to_csv |
{}
|
Returns: filename
Source code in oryxflow/targets/__init__.py
ExcelPandasSheetsTarget ¶
Bases: _LocalPathTarget
Saves dict of dataframes as sheets in a single Excel file, loads selectively by sheet
Source code in oryxflow/targets/__init__.py
load ¶
Load sheets from Excel file
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
keys
|
str / list
|
sheet name(s) to load. None loads all sheets |
None
|
cached
|
bool
|
keep data cached in memory |
False
|
**kwargs
|
arguments to pass to pd.read_excel |
{}
|
Returns: dict of dataframes, single dataframe, or filtered dict
Source code in oryxflow/targets/__init__.py
save ¶
Save dict of dataframes as sheets in a single Excel file
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict
|
{sheet_name: dataframe} |
required |
kwargs
|
additional arguments to pass to df.to_excel |
{}
|
Returns: filename
Source code in oryxflow/targets/__init__.py
PqPandasTarget ¶
Bases: DataTarget
Saves to parquet, loads to pandas dataframe
Source code in oryxflow/targets/__init__.py
load ¶
Load from parquet to pandas dataframe
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cached
|
bool
|
keep data cached in memory |
False
|
**kwargs
|
arguments to pass to pd.read_parquet |
{}
|
Returns: pandas dataframe
Source code in oryxflow/targets/__init__.py
save ¶
Save dataframe to parquet
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
obj
|
pandas dataframe |
required |
**kwargs
|
dict
|
additional arguments to pass to df.to_parquet |
{}
|
Returns: filename
Source code in oryxflow/targets/__init__.py
JsonTarget ¶
Bases: DataTarget
Saves to json, loads to dict
Source code in oryxflow/targets/__init__.py
load ¶
Load from json to dict
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cached
|
bool
|
keep data cached in memory |
False
|
**kwargs
|
arguments to pass to json.load |
{}
|
Returns: dict
Source code in oryxflow/targets/__init__.py
save ¶
Save dict to json
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dict_
|
dict
|
python dict |
required |
**kwargs
|
dict
|
additional arguments to pass to json.dump |
{}
|
Returns: filename
Source code in oryxflow/targets/__init__.py
MarkdownTarget ¶
Bases: DataTarget
Saves to markdown (.md) and HTML (.html), loads markdown string
Source code in oryxflow/targets/__init__.py
load ¶
Load from markdown file to string
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cached
|
bool
|
keep data cached in memory |
False
|
**kwargs
|
arguments to pass to read function |
{}
|
Returns: markdown string
Source code in oryxflow/targets/__init__.py
save ¶
Save markdown string to .md and .html files
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
md_string
|
str
|
markdown string |
required |
**kwargs
|
dict
|
additional arguments to pass to markdown.markdown |
{}
|
Returns: filename
Source code in oryxflow/targets/__init__.py
PickleTarget ¶
Bases: DataTarget
Saves to pickle, loads to python obj
Source code in oryxflow/targets/__init__.py
load ¶
Load from pickle to obj
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cached
|
bool
|
keep data cached in memory |
False
|
**kwargs
|
arguments to pass to pickle.load |
{}
|
Returns: dict
Source code in oryxflow/targets/__init__.py
save ¶
Save obj to pickle
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
obj
|
python object |
required |
**kwargs
|
dict
|
additional arguments to pass to pickle.dump |
{}
|
Returns: filename