Skip to main content

Packflow logo

Packflow on PyPI - Version Packflow on PyPI - Python Versions Packflow on GitHub - License

Introduction

packflow is a software development kit (SDK) that simplifies the development process and standardizes packaging of AI/ML running on streaming data sources.

What does Packflow do? Packflow provides a framework for writing, running, and packaging inference code. It offers a standardized structure (the InferenceBackend class) for writing model execution logic, provides the runtime backbone that executes models with built-in profiling and preprocessing, and includes tools to bundle code into portable zip archives. This means you write your inference code once using Packflow's structure, and Packflow handles both the optimized execution and creation of shareable packages for transfer between systems.

Many existing packaging frameworks are catered towards inference APIs and often require custom preprocessing steps. This can be particularly challenging when dealing with data sources that typically generate data one row at a time in key-value pairs (e.g., firewall logs or message streams).

Packflow, however, is optimized to run models on either individual events or batches of events, streamlining development and reducing the need for additional preprocessing. By leveraging Packflow, teams can focus on building and deploying models with custom out-of-the-box workflows and utilities, significantly reducing the time and effort required to onboard new capabilities.

Getting Started

The following instructions quickly walk through how to install Packflow and serve user documentation.

Installing Packflow

Prerequisite Requirements

  • Python (version 3.10+)

Installation from PyPI

  1. Packflow can be installed directly from PyPI:
pip install packflow

Documentation

Packflow documentation is hosted at https://dow-cdao.github.io/packflow/. Pre-built HTML is also available on the gh-pages branch.

To build and serve documentation locally:

  1. Install system prerequisites: Pandoc (required in addition to the pandoc Python package) and make1
  2. Navigate to the docs folder: cd docs
  3. Install Python dependencies: pip install -r requirements.txt
  4. Run make dev to serve with live reloading at https://127.0.0.1:8000/

Usage

Packflow provides a flexible base class called an InferenceBackend that allows users to build highly scalable platform- and tool-agnostic inference code, enabling simplified sharing across environments.

Additionally, Packflow's CLI can assist with creating projects, gathering environmental information, and creating distributable code packages for sharing reproducible inference code between disconnected environments.

Dummy Inference Backend

To create a dummy Inference Backend, update the inference.py file to the following:

from packflow import InferenceBackend


class Backend(InferenceBackend):
    def execute(self, inputs):
        """
        Simply print 'Hello, world!' then return the input data
        """
        print('Hello, world!')
        return inputs

Load and Run the Inference Backend

In a different Python file or from the command line in the same directory, execute the following:

from packflow.loaders import LocalLoader

backend = LocalLoader('inference:Backend').load()

backend({"sample": "data"})
# >> {"sample": "data"}

Recent Changes

0.4.1

  • Expanded NumPy compatibility to support releases providing Python 3.14 wheels.
  • Added Python 3.13 and 3.14 to the supported runtime metadata.

0.4.0

Recent updates include improvements to configuration structure and new CLI capabilities:

  • New: Interactive packflow create command with guided prompts for project setup
  • Renamed backend.validate() to backend.check_io() for clarity
  • Project templates simplified for better first-run experience
  • Added tests.py to project templates with integrated validation and testing
  • Removed standalone validate.py from templates
  • Default PackflowConfig version now set to 0.1.0 when not specified
  • Added questionary dependency for interactive CLI prompts
  • Custom configuration keys in packflow.yaml should now be placed under an extra: field for cleaner validation
  • Backend configuration can now be defined directly in packflow.yaml instead of separate JSON files
  • Name validation relaxed to allow numbers and hyphens (not as first character)
  • New packflow validate and packflow --version commands
  • Environment variables can be specified in packflow.yaml and are set automatically during packflow operations
  • packflow export now respects .gitignore patterns
  • verbose defaults to false to reduce log output
  • Backend configuration supports output_keys field to declare expected output fields

For projects using custom top-level keys in packflow.yaml, nest them under extra: to maintain compatibility with current validation.

0.3.0

  • Initial release

Contributing

Contributions to Packflow are welcomed and highly encouraged! Please refer to the CONTRIBUTING.md guide for more information and guidelines for contributing to Packflow.

Authors

Packflow is developed and maintained by Booz Allen Hamilton on behalf of the Federal Government of the United States of America and the Department of War's Chief Digital and Artificial Intelligence Office (CDAO).

License

packflow is distributed under the terms of the MIT license. Please refer to the LICENSE for more information of acceptable usage and distribution of Packflow.

  1. Installation of make varies by operating system. On MacOS, install xcode-select. On Windows, it is recommend to use Windows Subsystem for Linux (WSL). On Debian/Ubuntu, make can be installed via apt package manager:

    sudo apt update
    sudo apt install make build-essential ↩

Metadata

Release files for packflow 0.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for packflow 0.4.1
File Size Uploaded
packflow-0.4.1.tar.gz 36.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for packflow 0.4.1
File Interpreter ABI Platform
packflow-0.4.1-py3-none-any.whl Python 3 none any Details

Total release size: 79.8 kB

Release files / packflow-0.4.1.tar.gz

Download URL packflow-0.4.1.tar.gz
Size 36.3 kB
Tags Source
SHA-256 checksum
How to use checksums
0896cc968b6ea9612bace5b67c6ceacb03a1eca04085e6a90a03b3a8ae89c819
BLAKE2b-256 checksum
How to use checksums
4d577e982ec6d75b28c42148e3f100b27ad45dee3e447b09436030ef5c1b5c9c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.2 CPython/3.11.14 Darwin/24.6.0

Release files / packflow-0.4.1-py3-none-any.whl

Download URL packflow-0.4.1-py3-none-any.whl
Size 43.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aabec59720bf108a0585789f5e9d9c1e5e3c03c0534465adb26d37c66f931087
BLAKE2b-256 checksum
How to use checksums
eac957bf2e4570529364b378a8f3704f077b90e7564ca545b3d3b4ae60a9a693
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.2 CPython/3.11.14 Darwin/24.6.0
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page