Metadata-Version: 2.4
Name: xflow-py
Version: 0.2.0
Summary: A modular ML framework for training and evaluation tasks
Author: Qiyuan Xu
License: MIT License
        
        Copyright (c) 2025 Andrew Xu
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/Andrew-XQY/XFlow
Keywords: machine-learning,tensorflow,data-pipeline
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy
Requires-Dist: pandas
Requires-Dist: tqdm
Requires-Dist: Pillow
Requires-Dist: matplotlib
Requires-Dist: ipython
Requires-Dist: webdataset
Requires-Dist: pyyaml>=6.0
Requires-Dist: typing-extensions>=4.0.0
Provides-Extra: validation
Requires-Dist: pydantic>=2.0.0; extra == "validation"
Provides-Extra: ml-tf
Requires-Dist: tensorflow>=2.16.2; extra == "ml-tf"
Requires-Dist: keras>=3.4.1; extra == "ml-tf"
Provides-Extra: ml-torch
Requires-Dist: torch>=2.5.0; extra == "ml-torch"
Requires-Dist: torchvision; extra == "ml-torch"
Provides-Extra: viz
Requires-Dist: matplotlib; extra == "viz"
Requires-Dist: opencv-python; extra == "viz"
Provides-Extra: dev
Requires-Dist: mypy; extra == "dev"
Requires-Dist: pre-commit; extra == "dev"
Requires-Dist: black; extra == "dev"
Requires-Dist: isort; extra == "dev"
Provides-Extra: docs
Requires-Dist: sphinx>=7.0.0; extra == "docs"
Requires-Dist: furo>=2024.1.29; extra == "docs"
Requires-Dist: setuptools_scm; extra == "docs"
Requires-Dist: pyyaml>=6.0; extra == "docs"
Provides-Extra: ext
Requires-Dist: scipy; extra == "ext"
Provides-Extra: all
Requires-Dist: xflow-py[ml_torch,validation,viz]; extra == "all"
Dynamic: license-file

<div align="center">
  <a href="https://andrew-xqy.github.io/XFlow/">
    <img src="https://raw.githubusercontent.com/Andrew-XQY/XFlow/9feba3930f468ca95b35401232a6febd66f2432c/images/logo.png"
         alt="XFlow Logo" width="128" height="128">
  </a>

  <p>
    <a href="https://andrew-xqy.github.io/XFlow/"><b>Documentation</b></a>
    ·
    <a href="https://github.com/Andrew-XQY/XFlow/issues">Report Bug</a>
    ·
    <a href="https://github.com/Andrew-XQY/XFlow/issues">Request Feature</a>
  </p>
</div>

![Downloads](https://img.shields.io/github/downloads/Andrew-XQY/XFlow/total)
![Contributors](https://img.shields.io/github/contributors/Andrew-XQY/XFlow?color=dark-green)
![Issues](https://img.shields.io/github/issues/Andrew-XQY/XFlow)
![License](https://img.shields.io/github/license/Andrew-XQY/XFlow)
![PyPI version](https://img.shields.io/pypi/v/xflow-py.svg)
---

## About the Project

**XFlow** is a lightweight modular machine-learning framework.

Originally created for physics research, it's now evolving toward generic scientific applications ML workflows: **Data → Processing → Modeling**

<p align="center">
  <img src="https://raw.githubusercontent.com/Andrew-XQY/XFlow/ab43da1ef082e09a683d1da21f82e9cef54d4033/images/Xflow.png"
       alt="XFlow Conceptual Design" width="800">
</p>

---

## Core Data Processing Pipeline (Computational Map example)
`flow` is a step-based computation map for data processing.

Inputs (possibly different data types) move through discrete steps. At each step, a sample either passes through unchanged (identity) or is transformed by a node. Nodes can be multi-input and multi-output, so the map can split and merge data streams. Optional meta nodes (debug, checks, routing) can log, validate, stop, or redirect the pipeline without changing the core step structure.

```mermaid
%%{init: {"themeVariables": {"fontSize": "15px"}, "flowchart": {"htmlLabels": true}}}%%
flowchart TD
  classDef src fill:#0b1220,stroke:#334155,stroke-width:1px,color:#e2e8f0;
  classDef op fill:#0f172a,stroke:#38bdf8,stroke-width:2px,color:#e2e8f0;
  classDef io fill:#111827,stroke:#94a3b8,stroke-width:1px,color:#e5e7eb;
  classDef gate fill:#1f2937,stroke:#f59e0b,stroke-width:2px,color:#fde68a;
  classDef stop fill:#2a0f12,stroke:#fb7185,stroke-width:2px,color:#fecdd3;

  subgraph Inputs["Inputs"]
    DIR["dir: str<br/>/data/run_042"]:::src
    CFG["config: str<br/>YAML or JSON"]:::src
    A1["sensor A:<br/>array&lt;float&gt;"]:::src
    A2["sensor B:<br/>int"]:::src
  end

  READ["<b>ReadImages</b><br/>(dir -> images)"]:::op
  PARSE["<b>ParseConfig</b><br/>(str -> dict)"]:::op

  DIR --> READ
  CFG --> PARSE

  IMGS["images:<br/>tensor[H,W,C,N]"]:::io
  CONF["config:<br/>dict"]:::io

  READ --> IMGS
  PARSE --> CONF

  LOG["<b>LogConfig</b><br/>(print or save)"]:::op
  CONF --> LOG

  JOIN["<b>AlignAndEnrich</b><br/>(images -> 2 outputs)"]:::op
  IMGS --> JOIN

  subgraph JOIN_OUT[" "]
    direction LR
    ALN["aligned_images:<br/>tensor[...]"]:::io
    REP["report:<br/>md or json"]:::io
  end
  style JOIN_OUT fill:transparent,stroke:transparent

  JOIN --> ALN
  JOIN --> REP

  FUSE["<b>FuseSensors</b><br/>(2 signals -> 1 feature vector)"]:::op
  A1 --> FUSE
  A2 --> FUSE

  FEAT["features:<br/>vector&lt;float&gt;"]:::io
  FUSE --> FEAT

  GATE{"<b>QualityGate</b><br/>(meets requirements?)"}:::gate
  ALN --> GATE

  FIX["<b>Remediate</b><br/>(cleanup, re-run, notify)"]:::op
  STOP["STOP<br/>(fail fast)"]:::stop

  GATE -->|fail| FIX
  FIX --> STOP

  subgraph Outputs["Outputs"]
    OUT["artifacts:<br/>aligned_images + features + report"]:::io
  end

  ALN --> OUT
  FEAT --> OUT
  REP --> OUT

  GATE -->|pass| OUT
```

## Getting Started

### Installation

Install from PyPI:

```bash
pip install xflow-py
```

Clone the repository and install in editable mode:

```bash
git clone https://github.com/Andrew-XQY/XFlow.git
cd XFlow
pip install -e .
```
---

## Built With

<p>
  <a href="https://www.python.org/"><img src="https://raw.githubusercontent.com/devicons/devicon/master/icons/python/python-original.svg" height="40px" width="40px" /></a>
  <a href="https://www.tensorflow.org/"><img src="https://raw.githubusercontent.com/devicons/devicon/master/icons/tensorflow/tensorflow-original.svg" height="40px" width="40px" /></a>
  <a href="https://keras.io/"><img src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/keras/keras-original.svg" height="40px" width="40px" /></a>
  <a href="https://pytorch.org/"><img src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/pytorch/pytorch-original.svg" height="40px" width="40px" /></a>
</p>
</p>

- Python 3.12
- TensorFlow 2.x
- Keras 3.x
- PyTorch 2.5.x

---

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
