Skip to main content

Python bindings for MetricChrono with native acceleration and a pure-Python fallback

Project description

MetricChrono Python

Production Python bindings for MetricChrono. The PyPI package uses the bundled metricchrono-ffi native library via ctypes when it is present, and otherwise falls back to a byte-identical pure-Python implementation — so import metricchrono works with no native library at all.

Install

python3 -m pip install metricchrono

pip install metricchrono downloads a pre-built binary wheel and needs no Rust toolchain or Cargo. Wheels are published for Linux (manylinux x86_64 and aarch64), macOS (Intel and Apple Silicon), and Windows (x86_64).

Only the source-distribution (sdist) fallback build needs Cargo plus a Rust toolchain — used when pip cannot find a matching wheel for the target platform.

Source-tree usage

To use the wrapper directly from a checkout without installing a wheel, no native build is required: the pure-Python backend works from the source tree. Build the native library from the repository root only when you want the fast path, then point Python at it:

cargo build -p metricchrono-ffi --release
export METRICCHRONO_FFI_LIB=target/release/libmetricchrono_ffi.dylib

Use .so on Linux and .dll on Windows.

Backend selection defaults to METRICCHRONO_BACKEND=auto: Python uses the native library when the wheel or source-tree cdylib is present and loadable, otherwise it falls back to the pure-Python backend. Force a backend with METRICCHRONO_BACKEND=python or METRICCHRONO_BACKEND=native.

Example

import metricchrono as mc

ladder = mc.geometric_ladder(0.5, 1.0, 2.0, 4, 0.5, 1.0)
print(mc.ladder_distance(3.0, ladder))

with mc.EventLog(2) as log:
    log.append(10, [1.0, 0.0])
    log.append(11, [1.0, 1.0])
    print(log.next_event(0, 0))

API Surface

  • Kernel and ladders: Tier, tick_distance, ladder_distance, geometric_ladder, Ladder.
  • Serialization: tier_from_schema, tier_to_schema, ladder_from_schema, ladder_to_schema, tick_vector_from_schema, tick_vector_to_schema, consensus_result_from_schema.
  • Smooth and adaptive helpers: smooth_tick_distance, smooth_ladder_distance, adaptive_ladder_distance, ZoomDecision.
  • Event memory: EventLog.
  • Consensus: weighted_consensus, coherence_residuals, simple_weight_update.

Project details


Download files

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

Source Distribution

metricchrono-0.5.0.tar.gz (87.1 kB view details)

Uploaded Source

Built Distributions

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

metricchrono-0.5.0-py3-none-win_amd64.whl (116.7 kB view details)

Uploaded Python 3Windows x86-64

metricchrono-0.5.0-py3-none-manylinux_2_28_x86_64.whl (232.8 kB view details)

Uploaded Python 3manylinux: glibc 2.28+ x86-64

metricchrono-0.5.0-py3-none-manylinux_2_28_aarch64.whl (228.2 kB view details)

Uploaded Python 3manylinux: glibc 2.28+ ARM64

metricchrono-0.5.0-py3-none-macosx_11_0_arm64.whl (205.1 kB view details)

Uploaded Python 3macOS 11.0+ ARM64

metricchrono-0.5.0-py3-none-macosx_10_13_x86_64.whl (210.7 kB view details)

Uploaded Python 3macOS 10.13+ x86-64

File details

Details for the file metricchrono-0.5.0.tar.gz.

File metadata

  • Download URL: metricchrono-0.5.0.tar.gz
  • Upload date:
  • Size: 87.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for metricchrono-0.5.0.tar.gz
Algorithm Hash digest
SHA256 870e32aac43dd1fe37acdf9599d4d6a29a1bb2ef69aacad5aae82251dfba7eb6
MD5 02e024b26223981a4fb2bcb05de8d7db
BLAKE2b-256 322c2af941e4ce7b517f01a86759d8c05b35f278f6190a07c2da8cea4613edf6

See more details on using hashes here.

Provenance

The following attestation bundles were made for metricchrono-0.5.0.tar.gz:

Publisher: release.yml on chrono-metrics/metricchrono

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

File details

Details for the file metricchrono-0.5.0-py3-none-win_amd64.whl.

File metadata

  • Download URL: metricchrono-0.5.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 116.7 kB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for metricchrono-0.5.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 a1c99ff43e74027944b289ecf461f6576daa604163c4eb866a851af9a873a2fd
MD5 1962ac27079311e13d64a896b4a6c86c
BLAKE2b-256 614b4ac87b38c380d500b15cd8b6ff47ea464d8877673a7e4928e5ceedc4d654

See more details on using hashes here.

Provenance

The following attestation bundles were made for metricchrono-0.5.0-py3-none-win_amd64.whl:

Publisher: release.yml on chrono-metrics/metricchrono

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

File details

Details for the file metricchrono-0.5.0-py3-none-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for metricchrono-0.5.0-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 58e467ae7e9bd867de6ba0d309ac28c04af942b03dde37ee69cd0dba211e0617
MD5 92f5d2c11e1280a554918e77d9333e93
BLAKE2b-256 4d5232c44a4ef75ecc89f6947efcd3894133abcdc577500e6d4e779bce4af01a

See more details on using hashes here.

Provenance

The following attestation bundles were made for metricchrono-0.5.0-py3-none-manylinux_2_28_x86_64.whl:

Publisher: release.yml on chrono-metrics/metricchrono

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

File details

Details for the file metricchrono-0.5.0-py3-none-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for metricchrono-0.5.0-py3-none-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 7778e0cfda9b8cae647d59ede64b1d4ac6d2c658b6b14c250aefc725ed6b27ab
MD5 bf06365a5fcdd1be92e5b476f8d3d65d
BLAKE2b-256 17f0cc2e7cb8b04445138fc9df602eac87d109c076aab3d246b1f635bbaecc3f

See more details on using hashes here.

Provenance

The following attestation bundles were made for metricchrono-0.5.0-py3-none-manylinux_2_28_aarch64.whl:

Publisher: release.yml on chrono-metrics/metricchrono

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

File details

Details for the file metricchrono-0.5.0-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for metricchrono-0.5.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a99561ef6a14b7d039ea38da103d130265eda6161ae5694fba00322132c1d53d
MD5 9478a3e4ec422b91addfd2b50f58c48d
BLAKE2b-256 b4c11f62bef0d5f4258fba4f63a909942c925dc2885eb6ab64b97e86617d9624

See more details on using hashes here.

Provenance

The following attestation bundles were made for metricchrono-0.5.0-py3-none-macosx_11_0_arm64.whl:

Publisher: release.yml on chrono-metrics/metricchrono

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

File details

Details for the file metricchrono-0.5.0-py3-none-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for metricchrono-0.5.0-py3-none-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 a46614bb5161a889a8f8557a695128c0a5efbd3c4d7a869d99b58acde4e6a4ce
MD5 d19c65c33c36f9fc54c8a03a05fc93c3
BLAKE2b-256 fdc4d4b48015842df7986cff042af1129d5cc4a6e82e41e5f1e6d61bf107a75c

See more details on using hashes here.

Provenance

The following attestation bundles were made for metricchrono-0.5.0-py3-none-macosx_10_13_x86_64.whl:

Publisher: release.yml on chrono-metrics/metricchrono

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