Skip to main content

High-performance bitemporal data processing for Python

Project description

PyTemporal

High-performance bitemporal data processing for Python

PyTemporal is a Rust-powered library for processing bitemporal timeseries data with world-class performance (157,000+ rows/second). Perfect for financial services, audit systems, and applications requiring immutable data trails with both business and system time dimensions.

Quick Start

# Install from source
git clone <your-repo>
cd pytemporal
uv run maturin develop --release
import pandas as pd
from pytemporal import BitemporalTimeseriesProcessor

# Initialize processor
processor = BitemporalTimeseriesProcessor(
    id_columns=['id'],
    value_columns=['price']
)

# Process temporal updates
result = processor.process_updates(
    current_state=current_df,
    updates=updates_df, 
    system_date='2025-01-27'
)

print(f"Updated {len(result.to_insert)} records")

Key Features

  • ๐Ÿš€ World-Class Performance: 157,000+ rows/second throughput
  • ๐Ÿ”„ Bitemporal Processing: Track both business time and system time
  • ๐Ÿ Python-First: High-level DataFrame API with pandas integration
  • โšก Zero-Copy: Apache Arrow columnar format for memory efficiency
  • ๐Ÿ”ง Flexible Schema: Configure ID and value columns dynamically
  • ๐ŸŽฏ Two Update Modes: Delta updates or full state replacement
  • ๐Ÿ”€ Smart Conflation: Optional merging of consecutive records with identical values
  • ๐Ÿ—๏ธ Production Ready: Comprehensive test coverage and clean architecture

Documentation

What is Bitemporal Data?

Bitemporal data tracks two time dimensions:

  • Effective Time: When events occurred in the real world
  • As-Of Time: When information was recorded in the system

This enables powerful queries like "What did we think the price was on Jan 15th, as of Jan 20th?"

Use Cases

  • Financial Services: Price histories, portfolio valuations, risk calculations
  • Audit Systems: Immutable change tracking with full reconstruction capability
  • Regulatory Compliance: Time-accurate reporting for compliance requirements
  • Data Warehousing: Slowly changing dimensions with full history preservation

Performance

Dataset Size Processing Time Throughput Memory
800k ร— 80 cols 5.4 seconds 157k rows/sec ~14GB
100k ร— 20 cols 0.6 seconds 167k rows/sec ~2GB

Benchmarked on modern hardware with optimized settings

Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Python DataFrameโ”‚โ”€โ”€โ”€โ–ถโ”‚ PyTemporal (Rust)โ”‚โ”€โ”€โ”€โ–ถโ”‚ Processed Resultsโ”‚
โ”‚ (Pandas)        โ”‚    โ”‚ โ€ข Arrow Columnar โ”‚    โ”‚ (DataFrame)     โ”‚  
โ”‚                 โ”‚    โ”‚ โ€ข Parallel Proc  โ”‚    โ”‚                 โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ”‚ โ€ข Timeline Logic โ”‚    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Built With:

  • Rust: Core processing engine for maximum performance
  • Apache Arrow: Columnar data format for zero-copy operations
  • PyO3: Seamless Rust-Python integration
  • Rayon: Data parallelism for multi-core performance

Development

# Run tests
cargo test                                    # Rust tests
uv run python -m pytest tests/ -v           # Python tests

# Performance benchmarks  
cargo bench                                  # Detailed benchmarks
uv run python validate_refactoring.py       # End-to-end validation

# Build release
uv run maturin develop --release

Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature-name
  3. Make changes and add tests
  4. Run the test suite: cargo test && uv run pytest
  5. Submit a pull request

License

This project is licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in PyTemporal by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Acknowledgments

Built with modern Rust performance engineering and extensive profiling to achieve world-class bitemporal processing speeds while maintaining clean, maintainable code.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pytemporal-1.4.27-cp312-cp312-manylinux_2_34_x86_64.whl (2.5 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

pytemporal-1.4.27-cp312-cp312-macosx_11_0_arm64.whl (2.1 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pytemporal-1.4.27-cp311-cp311-manylinux_2_34_x86_64.whl (2.5 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

pytemporal-1.4.27-cp311-cp311-macosx_11_0_arm64.whl (2.1 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pytemporal-1.4.27-cp310-cp310-manylinux_2_34_x86_64.whl (2.5 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ x86-64

pytemporal-1.4.27-cp310-cp310-macosx_11_0_arm64.whl (2.1 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pytemporal-1.4.27-cp39-cp39-manylinux_2_34_x86_64.whl (2.5 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.34+ x86-64

pytemporal-1.4.27-cp39-cp39-macosx_11_0_arm64.whl (2.1 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

Details for the file pytemporal-1.4.27-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for pytemporal-1.4.27-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 1194860b2e52d07158c1c5ce61e0c0c4b8ae7b8cf80d4c2aeab1a0fe6bd35831
MD5 21e44426aa500d50a0f5097c8795b863
BLAKE2b-256 9a3cabcfb5779004247eae90363d917ea56b793e8e5d99003e516ab53c368e50

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytemporal-1.4.27-cp312-cp312-manylinux_2_34_x86_64.whl:

Publisher: build-wheels.yml on gingermike/pytemporal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytemporal-1.4.27-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pytemporal-1.4.27-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 70714493fd7c1d297f4790d932a75016e52ccbd752d19460e2f9e20d5878dbcf
MD5 bbba627d8f6357cbce265c1c3484c399
BLAKE2b-256 68bf9413fe60105dff8dbbeb40158cc5aea9703fe3b299147a1eac3c5341397d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytemporal-1.4.27-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: build-wheels.yml on gingermike/pytemporal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytemporal-1.4.27-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for pytemporal-1.4.27-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 55a781e948718d2d7b0e14fc9026d363e5afb235495979df7d3e592a3173e47b
MD5 a6cf8897736c28c4dd7e9400436542c6
BLAKE2b-256 0f5cb3dff289e4cc03e556270bd2af00c1edcc93941a5bc793621189826d9221

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytemporal-1.4.27-cp311-cp311-manylinux_2_34_x86_64.whl:

Publisher: build-wheels.yml on gingermike/pytemporal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytemporal-1.4.27-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pytemporal-1.4.27-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bddf76bb437fcbe52961580e4d44a546ae77bebeec5e1d6fe017fcd063aeec42
MD5 d7272dbc4c2bc4f89ebc89f35abbeeab
BLAKE2b-256 7ec2310ca08e75f69e0540f7b44d18fcfae8d565aa138f7dd28ed0ce7f9922c5

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytemporal-1.4.27-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: build-wheels.yml on gingermike/pytemporal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytemporal-1.4.27-cp310-cp310-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for pytemporal-1.4.27-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 5af412f379352c1fefb69a339b31e587d998f8bc39138f45e5b6cb81ec243346
MD5 41eef47ca288a79e8a67f39a2f736b85
BLAKE2b-256 1e8a69b0b44f612e926dd6023471eb53914407a90de8fae51e58834ff142d267

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytemporal-1.4.27-cp310-cp310-manylinux_2_34_x86_64.whl:

Publisher: build-wheels.yml on gingermike/pytemporal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytemporal-1.4.27-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pytemporal-1.4.27-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 951808752a3c903aa273bf803d44e3afe5471a881e81ce39b4bb656198b00906
MD5 e4a2d7b7df4675c17eae9845b411edd9
BLAKE2b-256 73082fa96bfe9dcf0efc53e64f36ff97984d26fe40e91e5fe80fd869a7c88fc6

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytemporal-1.4.27-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: build-wheels.yml on gingermike/pytemporal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytemporal-1.4.27-cp39-cp39-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for pytemporal-1.4.27-cp39-cp39-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 f7ce7aa365d4a0041c83b4ba88a4cb2b0a41f9390703572ec29b0084e5cec60c
MD5 2e2586b647ff9fd4b39ff580e3c87799
BLAKE2b-256 e99260241504df1d1dbee018f79dbb6ef35cd78d3892db51419601fca31b906c

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytemporal-1.4.27-cp39-cp39-manylinux_2_34_x86_64.whl:

Publisher: build-wheels.yml on gingermike/pytemporal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytemporal-1.4.27-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pytemporal-1.4.27-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2b32b521457ccb885a534ba729b268cfcb0f3ca03b845589c191bff46307232c
MD5 9cfb4a0c4141035991e81069fd5e533e
BLAKE2b-256 4f275d5f8c291cc6491594c847ffc5955ff72dc44f7fdf18997331e011d48d18

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytemporal-1.4.27-cp39-cp39-macosx_11_0_arm64.whl:

Publisher: build-wheels.yml on gingermike/pytemporal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page