Skip to main content

Python bindings for the MetricChrono Rust C ABI

Project description

MetricChrono Python

Production Python bindings for the same metricchrono-ffi native library used by the Rust and C APIs.

When building a wheel from the repository, the package build runs Cargo and bundles the platform native library into the wheel:

python3 -m pip wheel bindings/python --no-deps -w /tmp/metricchrono-wheel
python3 -m pip install /tmp/metricchrono-wheel/metricchrono-0.2.0-*.whl

Cargo must be available for source builds. To use the wrapper directly from the source tree without installing a wheel, build the native library from the repository root:

cargo build -p metricchrono-ffi --release

Then point Python at the library if it is not installed in a standard dynamic loader path:

export METRICCHRONO_FFI_LIB=target/release/libmetricchrono_ffi.dylib

Use .so on Linux and .dll on Windows.

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.

Verify

PYTHONPATH=bindings/python METRICCHRONO_FFI_LIB=target/release/libmetricchrono_ffi.dylib \
  python3 bindings/python/tests/golden.py
python3 -m pip install build
python3 -m build bindings/python --sdist --outdir /tmp/metricchrono-sdist
python3 -m pip wheel /tmp/metricchrono-sdist/metricchrono-0.2.0.tar.gz --no-deps -w /tmp/metricchrono-wheel

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.4.0.tar.gz (60.5 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.4.0-py3-none-win_amd64.whl (110.0 kB view details)

Uploaded Python 3Windows x86-64

metricchrono-0.4.0-py3-none-manylinux_2_28_x86_64.whl (225.2 kB view details)

Uploaded Python 3manylinux: glibc 2.28+ x86-64

metricchrono-0.4.0-py3-none-manylinux_2_28_aarch64.whl (220.9 kB view details)

Uploaded Python 3manylinux: glibc 2.28+ ARM64

metricchrono-0.4.0-py3-none-macosx_11_0_arm64.whl (197.8 kB view details)

Uploaded Python 3macOS 11.0+ ARM64

metricchrono-0.4.0-py3-none-macosx_10_13_x86_64.whl (203.4 kB view details)

Uploaded Python 3macOS 10.13+ x86-64

File details

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

File metadata

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

File hashes

Hashes for metricchrono-0.4.0.tar.gz
Algorithm Hash digest
SHA256 3490a4eda3c42323444204e755cb85dfcc7a2a330a3a62c0efac78a8a5279a69
MD5 16b8d0bc39c6531f5d1747ed2459c8cd
BLAKE2b-256 6064684cd26bc051e22cc9b0aa0bcbb3b742f7cb739d5a6229d42e7554b2e433

See more details on using hashes here.

Provenance

The following attestation bundles were made for metricchrono-0.4.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.4.0-py3-none-win_amd64.whl.

File metadata

  • Download URL: metricchrono-0.4.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 110.0 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.4.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 2c4935ada4f2bd2098c56337c5f02aeafd7068d78d3c989e5a1df4a8b7ef68ca
MD5 78abbd42db92209205c738888b4b5b61
BLAKE2b-256 29fbbdd84996e0f4b7300ae0b247a3a61b5cf799fd7d4114fc33bf0d1d8b1c96

See more details on using hashes here.

Provenance

The following attestation bundles were made for metricchrono-0.4.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.4.0-py3-none-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for metricchrono-0.4.0-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 dfb201e8b59ed5ac573541bfd5463285bdc059254fd890e9ad84f4e332b1d22b
MD5 e4057bf59a554b6112193f4727329788
BLAKE2b-256 c848593a7df5ff467651d030dcd9bfa4c8ae7a2d43ac77cb7422d3442b06aa6f

See more details on using hashes here.

Provenance

The following attestation bundles were made for metricchrono-0.4.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.4.0-py3-none-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for metricchrono-0.4.0-py3-none-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 e840a68646e970850bbda72201bb877acd3abba098df8fea86671a62640a0b86
MD5 ab6f5710582dcb98992793494bab5820
BLAKE2b-256 00829f9890dbd46ea1538c6378d426452ae644ef454e37f7139cbc1b2b84af4e

See more details on using hashes here.

Provenance

The following attestation bundles were made for metricchrono-0.4.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.4.0-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for metricchrono-0.4.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d2a5e2e16431d108ac6dc3dca0c5ba89cb891c467f4482c179d0fa649d646dfe
MD5 e58101980e82939c8195064c06b88a81
BLAKE2b-256 2d0bfc84b10a207a4ce6a5c6b8067f5a18c2916b8c06b4aff7484200b2243bf9

See more details on using hashes here.

Provenance

The following attestation bundles were made for metricchrono-0.4.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.4.0-py3-none-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for metricchrono-0.4.0-py3-none-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 638ce2e7986721723ba941d8034d4cabf524b9ce382009bb0764a6abcbda3428
MD5 217607d52bf2c12166fa08f5e40c988e
BLAKE2b-256 cda15e6fbe9b7bd7b88b3e3dc9449be09ec7298f51721148ce3873539a2ac6d4

See more details on using hashes here.

Provenance

The following attestation bundles were made for metricchrono-0.4.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