Airflow-oriented extraction of the core Bots EDI translation runtime.
Project description
bots-airflow
bots_airflow is an Airflow-oriented extraction of the core Bots EDI translation
runtime: grammar loading, parsing into message trees, mapping execution, and
serialization.
Architecture and release target: docs/architecture.md
Current scope
This package provides:
- a
botscore-backed translation runtime for grammar loading, parse/tree handling, mapping execution, and serialization - a lean bootstrap that initializes extracted runtime state in memory without the full Bots engine control path
- a direct translation runner that does not use Bots engine, routes, channels, or translate tables
- a thin
Translatorfacade plus lower-levelTranslationRequestandtranslate_text(...)APIs for direct task execution - a registry-backed import hook for explicit grammar and mapping resolution
- an explicit
TranslationContextmodel for per-run values - a
BaseMappingclass and service model for state-light, dependency-injected mappings - developer utilities for extracting reduced recorddefs packs from larger legacy sources
Public boundary
bots_airflow is the public runtime package, not a distribution of partner-specific
flows.
The supported runtime:
- runs on
botscore - does not require the legacy Bots engine
- does not require
usersys - does not bundle project-specific grammars, mappings, or sample partner files
Project-specific grammars and mappings should live in your own runtime modules and
be installed or imported alongside bots_airflow in Airflow.
Install
Published-package install:
pip install bots-airflow
This pulls in the declared standalone botscore dependency.
For local workspace development against the sibling extracted runtime checkout:
pip install -e ../bots_core
pip install -e .[dev,test,docs]
Runtime modules
The intended production model is:
- install
bots_airflow - install your own private runtime package, or make your runtime modules importable
on the Airflow
PYTHONPATH - import those modules in DAG code and pass them to
bots_airflow
Example with imported runtime modules:
import my_company_edi.grammars.csv.order_lines_out as order_lines_out
import my_company_edi.grammars.json.orders_in as orders_in
from bots_airflow import GrammarSpec, TranslationContext, init
from my_company_edi.mappings.order_lines import OrdersToCsv
translator = init(
grammar_in=GrammarSpec(
editype="json",
messagetype="orders",
module=orders_in,
),
grammar_out=GrammarSpec(
editype="csv",
messagetype="order_lines",
module=order_lines_out,
),
map=OrdersToCsv,
)
result = translator.translate_text(
input_text,
context=TranslationContext(
reference="batch-001",
values={"order_prefix": "WEB-"},
),
)
print(result.output_text)
The same runtime modules can also be referenced by import path strings:
from bots_airflow import GrammarSpec, TranslationContext, init
translator = init(
grammar_in=GrammarSpec(
editype="json",
messagetype="orders",
module="my_company_edi.grammars.json.orders_in",
),
grammar_out=GrammarSpec(
editype="csv",
messagetype="order_lines",
module="my_company_edi.grammars.csv.order_lines_out",
),
map="my_company_edi.mappings.order_lines_module",
)
translator.translate(
"input.json",
"output.csv",
context=TranslationContext(reference="batch-002"),
)
Layout
src/bots_airflow/bootstrap.pyInitializes the extracted runtime state and import paths needed for parse/map/write execution.src/bots_airflow/context.pyDefines explicit per-run translation inputs passed from Airflow tasks and upstream code.src/bots_airflow/translator.pyProvides the main Airflow-facing facade for direct translation execution.src/bots_airflow/runner.pyExecutes the low-level parse/map/write flow directly against the extracted runtime.src/bots_airflow/registry.pyRegisters explicit grammar and mapping modules for runtime import resolution.src/bots_airflow/mapping.pyDefines mapping base classes and injected service interfaces.src/bots_airflow/devtools/Contains developer-only extraction and maintenance utilities.
Developer utilities
To extract a reduced recorddefs pack for a grammar in your own runtime modules:
python3 -m bots_airflow.devtools.extract_recorddefs \
--source-recorddefs path/to/legacy_recorddefs.py \
--grammar my_company_edi.grammars.x12.orders_850 \
--output path/to/generated_segments.py
This utility is intentionally outside the runtime path. Developers use it to turn large shared segment catalogs into small reviewed Python modules that the runtime imports directly. Full usage and examples: docs/extract-recorddefs.md
Mapping model
Use the mapping constructor for stable dependencies and options:
- partner or code resolver services
- feature flags
- mapping-level configuration
Use TranslationContext for per-run values:
- partner ids
- routing decisions
- metadata from upstream Airflow tasks
- run-specific configuration payloads
That split keeps mappings easy to test and makes retries explicit.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bots_airflow-0.1.0a1.tar.gz.
File metadata
- Download URL: bots_airflow-0.1.0a1.tar.gz
- Upload date:
- Size: 27.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0953248db8c60721cbf716a34d807f41ab7733559270425e5f73ab803bf8513d
|
|
| MD5 |
0c9c1d332cd02cf3b174b970eab7b526
|
|
| BLAKE2b-256 |
c55090b80f546dfd214b75cc86e6db6a30e0b2112b465e1449cfb1ca45e9a830
|
Provenance
The following attestation bundles were made for bots_airflow-0.1.0a1.tar.gz:
Publisher:
publish.yml on rioncm/bots-airflow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bots_airflow-0.1.0a1.tar.gz -
Subject digest:
0953248db8c60721cbf716a34d807f41ab7733559270425e5f73ab803bf8513d - Sigstore transparency entry: 1126454180
- Sigstore integration time:
-
Permalink:
rioncm/bots-airflow@7c142b72497436570277ce6ccd40d32505e8e8c3 -
Branch / Tag:
refs/tags/v0.1.0a1 - Owner: https://github.com/rioncm
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7c142b72497436570277ce6ccd40d32505e8e8c3 -
Trigger Event:
push
-
Statement type:
File details
Details for the file bots_airflow-0.1.0a1-py3-none-any.whl.
File metadata
- Download URL: bots_airflow-0.1.0a1-py3-none-any.whl
- Upload date:
- Size: 15.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b86e05b31feba2fa0025c9aa924c50bf79bbba8c74dd75bdd3b426aa6b0e7719
|
|
| MD5 |
2dd40026ba7916a73ca06a466d955921
|
|
| BLAKE2b-256 |
2f3c635517ef47f391d4fabd4205e4836822483fa986f9beba0efd1e5699e213
|
Provenance
The following attestation bundles were made for bots_airflow-0.1.0a1-py3-none-any.whl:
Publisher:
publish.yml on rioncm/bots-airflow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bots_airflow-0.1.0a1-py3-none-any.whl -
Subject digest:
b86e05b31feba2fa0025c9aa924c50bf79bbba8c74dd75bdd3b426aa6b0e7719 - Sigstore transparency entry: 1126454261
- Sigstore integration time:
-
Permalink:
rioncm/bots-airflow@7c142b72497436570277ce6ccd40d32505e8e8c3 -
Branch / Tag:
refs/tags/v0.1.0a1 - Owner: https://github.com/rioncm
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7c142b72497436570277ce6ccd40d32505e8e8c3 -
Trigger Event:
push
-
Statement type: