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.3.0.tar.gz (50.4 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.3.0-py3-none-win_amd64.whl (101.8 kB view details)

Uploaded Python 3Windows x86-64

metricchrono-0.3.0-py3-none-manylinux_2_28_x86_64.whl (217.2 kB view details)

Uploaded Python 3manylinux: glibc 2.28+ x86-64

metricchrono-0.3.0-py3-none-manylinux_2_28_aarch64.whl (212.6 kB view details)

Uploaded Python 3manylinux: glibc 2.28+ ARM64

metricchrono-0.3.0-py3-none-macosx_11_0_arm64.whl (190.9 kB view details)

Uploaded Python 3macOS 11.0+ ARM64

metricchrono-0.3.0-py3-none-macosx_10_13_x86_64.whl (195.9 kB view details)

Uploaded Python 3macOS 10.13+ x86-64

File details

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

File metadata

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

File hashes

Hashes for metricchrono-0.3.0.tar.gz
Algorithm Hash digest
SHA256 ac0bd3080bd16847e3758043e3455b5fc84c252607c17fc6aa7c70f18ad3a14e
MD5 3f62849f609c477b2f7a11f65725c6dd
BLAKE2b-256 9623c10bed14a92a0967b88a788ed939c65c02e8db79043445aebd196131f7d2

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: metricchrono-0.3.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 101.8 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.3.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 ed1fed6a3f4303688a4cc11f95ec1542d3d0a07dd5d25fe10918d7e6a83a085b
MD5 c5f64096305c46e5c548e896040e16b9
BLAKE2b-256 6b68a337eb8e5e996a892750d00ba6bd3f088c6d9e2921c97f2ce62ffc252d84

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for metricchrono-0.3.0-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3889927a03261b13630ad0e997fec226929823a422f1c792bd879146bd0b604c
MD5 8a91a9c9ae223679e0c75c08349f6e85
BLAKE2b-256 38da7fdf21011ed85c39d770c1ae3e181e2ba921eecb38ae94c269fc2ec938e6

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for metricchrono-0.3.0-py3-none-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c9843a2c01ca7e7b972e3b273015579cf13eca13e09a3821e685d7edba0d11da
MD5 21a3e50ab273e1c59fa8edfcd9ecf990
BLAKE2b-256 3d30e3a4594440cf79e69f0543065462e612768831f269283e7ff7e71f04aacc

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for metricchrono-0.3.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8d5dd7efca6f722ab9e7ee71402129f2a80160af7d7fc13db4149bd04d2c7b70
MD5 24948d10442896c2a74a5b9c43ac103d
BLAKE2b-256 8b159b4063ecb866da9c8ccfa2822be2ea7cd8c4aa75636ccbc83627ce914e28

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for metricchrono-0.3.0-py3-none-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 7c7e211d0a760e6fcbb707a6ba2723093c48d52f0c7046ad4b48db0ec5531b69
MD5 5c90a5b8deb57307cbf09cfd2ea09880
BLAKE2b-256 b76a7cf0f0c9a4b1c857dceb229c64a9ca2a1ade3f8a43ffc427dd4092b58c61

See more details on using hashes here.

Provenance

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