Registry / data / tfx-bsl

tfx-bsl

JSON →
library1.21.0pypypi✓ verified 84d ago

tfx-bsl (TFX Basic Shared Libraries) is a foundational Python library within the TensorFlow Extended (TFX) ecosystem. It provides low-level, high-performance data manipulation primitives, including efficient handling of TF.Example and Apache Arrow data structures, and optimized C++ extensions. It serves as a core dependency for many TFX libraries and components like TensorFlow Data Validation (TFDV) and TensorFlow Transform (TFT). The current version is 1.17.1, and it follows the TFX release cadence, typically aligning with TensorFlow releases.

pip install tfx-bsl
INSTALL
IMPORT
SIG · TFX-BSL
T
tfx-bsl
datapythonv1.21.0
Install
79.7s avg
Import
Disk
2765MB
Pass rate
2/ 10
Env Coverage2 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.21.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✕ build_error
✓ 75.8s
py 3.11
✕ build_error
2/8 runs
py 3.12
✕ build_error
2/8 runs
py 3.13
✕ build_error
2/8 runs
py 3.9
✕ build_error
✓ 83.56s
2765MB installed
● package 2765MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

version
from tfx_bsl import version
from tfx_bsl.coders.example_coder import ExampleToRecordBatchDecoder

Demonstrates how to convert `tf.train.Example` protobufs to an Apache Arrow `RecordBatch` and back using `tfx_bsl`'s `ExampleToRecordBatchDecoder` and `RecordBatchToExamplesEncoder`. This is a core data transformation task that `tfx-bsl` facilitates for TFX components.

import tensorflow as tf import pyarrow as pa from tfx_bsl.coders.example_coder import ExampleToRecordBatchDecoder, RecordBatchToExamplesEncoder # 1. Create a list of serialized tf.train.Example examples_list = [ tf.train.Example(features=tf.train.Features(feature={ 'feature1': tf.train.Feature(int64_list=tf.train.Int64List(value=[1, 2])), 'feature2': tf.train.Feature(float_list=tf.train.FloatList(value=[1.0, 2.0])) })).SerializeToString(), tf.train.Example(features=tf.train.Features(feature={ 'feature1': tf.train.Feature(int64_list=tf.train.Int64List(value=[3])), 'feature2': tf.train.Feature(float_list=tf.train.FloatList(value=[3.0])) })).SerializeToString() ] # 2. Decode TF.Examples to an Apache Arrow RecordBatch decoder = ExampleToRecordBatchDecoder() record_batch = decoder.decode(examples_list) print(f"\nDecoded RecordBatch schema:\n{record_batch.schema}") print(f"Decoded RecordBatch content:\n{record_batch}") # 3. Encode the Apache Arrow RecordBatch back to TF.Examples encoder = RecordBatchToExamplesEncoder(record_batch.schema) encoded_examples_iterator = encoder.encode(record_batch) encoded_examples_list = list(encoded_examples_iterator) print(f"\nRe-encoded examples (first one):\n{tf.train.Example().FromString(encoded_examples_list[0])}") # Verify round-trip (simplified check) assert len(examples_list) == len(encoded_examples_list) print("\nSuccessfully decoded to Arrow and re-encoded to TF.Example.")
Debug
Known issues
breakingVersion mismatches between `tfx-bsl`, `tensorflow`, `tfx`, and `apache-beam` are the most common cause of runtime errors. Ensure all TFX-related packages are installed with compatible versions, ideally from the same TFX release train.
fix
Always install `tfx` (which pins `tfx-bsl`) or refer to the official TFX compatibility matrix: `https://www.tensorflow.org/tfx/releases#python_package_compatibility`.
affects: All versions
gotchaPython 3.8 and earlier are not supported by recent `tfx-bsl` versions. Python 4.x is also not yet supported. The package specifically targets Python 3.9-3.11.
fix
Ensure your environment uses Python 3.9, 3.10, or 3.11. Check `requires_python` from PyPI for the exact range for your specific `tfx-bsl` version.
affects: 1.x.x onwards
gotchaUsing `pip install tfx-bsl` without explicitly installing `tensorflow` or its `[tensorflow]` extra will result in a version of `tfx-bsl` that might not be fully functional or compatible with your existing TensorFlow installation.
fix
Prefer `pip install tfx` (which includes `tfx-bsl` and `tensorflow`) or `pip install tfx-bsl[tensorflow]` to ensure core dependencies are aligned.
affects: All versions
breakingTFX-BSL relies on custom C++ extensions. Issues with build environments, incompatible compilers, or missing system dependencies (like specific glibc versions) can lead to `ImportError` or segmentation faults.
fix
Use pre-built wheels if possible. If building from source, ensure your C++ toolchain (gcc/g++) is compatible with TensorFlow's requirements and that all necessary libraries are present. Often, this means sticking to official Docker images or tested environments.
affects: All versions
Upgrade
Version history
1.21.0latest on PyPI · released Jun 10, 2026
Audit
Dependencies
tensorflowoptionalTightly coupled for data processing (e.g., tf.train.Example, tf.io.TFRecordOptions).
apache-beamoptionalRequired for distributed data processing using Beam runners, commonly used by TFX components.
pyarrowrequiredCore dependency for Apache Arrow data structures and operations.
Agent activity
17 hits · last 30 days
node
14
OpenAI (training)
1
Resources
tfx-bsl — pip install tfx-bsl · libregistry