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
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 | |
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.
Parameters cls has bound (an imported task: its exported defaults, or bind())
are not carried over -- only kwargs override them.
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
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 | |
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_summary is only the readable part, capped at TASK_ID_TRUNCATE_SUMMARY
chars; uniqueness comes from the hash, which covers the full params.
: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
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 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 | |
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
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 | |
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_excel |
{}
|
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 |
formatted
|
bool
|
write a formatted sheet 'Sheet1' via oryxflow.utils.excel_write |
False
|
**kwargs
|
dict
|
df.to_excel arguments, or excel_write options if formatted |
{}
|
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}, or {sheet_name: spec dict} if formatted |
required |
formatted
|
bool
|
write formatted sheets via oryxflow.utils.excel_write |
False
|
kwargs
|
additional arguments to pass to df.to_excel, or excel_write options if formatted |
{}
|
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