Skip to main content

hallmodel-py

Python interface to the Hall adult- and child- body-weight dynamics models, backed by the C++ kernel in hallmodel-core (vendored here as a git submodule).

The kernel is the same math the R package INSP-RH/bw compiles. Compiled in matched toolchains with -ffp-contract=off, the outputs are byte-for-byte reproducible against the upstream parity contract; under the contract's published tolerance (rtol=1e-9, atol=1e-12), all 18 contract cases pass.

This is the first reference consumer of hallmodel-core — it is also the worked example for "here is how you write a new language binding against the core."


Install

git clone --recurse-submodules <repo-url> hallmodel-py
cd hallmodel-py
python3 -m venv .venv && source .venv/bin/activate
pip install -e .

Build needs a C++17 compiler and pybind11 (declared in pyproject.toml).

If you cloned without --recurse-submodules:

git submodule update --init --recursive

Use

import bw_cpp

# Adult model — single individual, baseline EI from Mifflin-St Jeor
res = bw_cpp.adult_weight(bw=76, ht=1.73, age=36, sex="male")
print(res["Body_Weight"].shape)       # (1, 366)

# Adult with a 500-kcal deficit over 365 days
import numpy as np
res = bw_cpp.adult_weight(
    bw=90, ht=1.80, age=40, sex="male",
    EIchange=np.full((1, 365), -500.0),
)

# Child model — auto FFM/FM/EI defaults from age + sex
res = bw_cpp.child_weight(age=6, sex="male", days=365)

# Energy interpolation
out = bw_cpp.EnergyBuilder().build(
    energy=np.array([[2000, 2200, 1800]]),
    time=np.array([0, 5, 10]),
    method="Linear",
)

See the docstrings in bw_cpp/__init__.py for the full API, and the upstream R wrappers for the semantics of each parameter — they are the same.

Parity proof

./proof/verify.sh builds the binding against the pinned hallmodel-core submodule, drives all 18 contract cases through bw_cpp, and asserts the contract's tolerance via contract/compare.py. Exit 0 = parity holds.

./proof/verify.sh

The committed proof/last_run.log and proof/outputs/ are the frozen evidence of the most recent green run. CI re-runs them on every PR. The pinned submodule sha is the version contract: bumping it triggers a re-verify.

The one excluded field is BMI_Category — the contract's generate.R coerces character matrices through as.numeric(), producing a column of literal "NA" strings in every adult golden. See hallmodel-core/proof/verify.sh for the full explanation.

How this maps to upstream

upstream R here
INSP-RH/bw::adult_weight() bw_cpp.adult_weight()
INSP-RH/bw::child_weight() bw_cpp.child_weight()
INSP-RH/bw::child_reference_EI() bw_cpp.child_reference_EI()
INSP-RH/bw::child_reference_FFMandFM() bw_cpp.child_reference_FFMandFM()
INSP-RH/bw::EnergyBuilder() bw_cpp.EnergyBuilder().build()

Argument names, semantics, and defaults all match INSP-RH/bw's R wrappers because this Python shim was deliberately written as a direct port of those wrappers. The contract gate enforces it.

License

MIT, carried forward from INSP-RH/bw.

Citing

Cite the original bw package and Hall et al.'s underlying papers. See the README of INSP-RH/bw and hallmodel-core/docs/ATTRIBUTION.md.

Metadata

Release files for hallmodel 2026.10.21.15

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hallmodel 2026.10.21.15
File Size Uploaded Provenance Actions
hallmodel-2026.10.21.15.tar.gz 30.0 kB With provenance Details for hallmodel-2026.10.21.15.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for hallmodel 2026.10.21.15
File Actions
hallmodel-2026.10.21.15-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.24+ x86-64, Linux glibc 2.28+ x86-64 Details for hallmodel-2026.10.21.15-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
hallmodel-2026.10.21.15-cp314-cp314-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 macOS 11.0+ ARM64 Details for hallmodel-2026.10.21.15-cp314-cp314-macosx_11_0_arm64.whl
hallmodel-2026.10.21.15-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.24+ x86-64, Linux glibc 2.28+ x86-64 Details for hallmodel-2026.10.21.15-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
hallmodel-2026.10.21.15-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details for hallmodel-2026.10.21.15-cp313-cp313-macosx_11_0_arm64.whl
hallmodel-2026.10.21.15-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64, Linux glibc 2.24+ x86-64 Details for hallmodel-2026.10.21.15-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
hallmodel-2026.10.21.15-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details for hallmodel-2026.10.21.15-cp312-cp312-macosx_11_0_arm64.whl
hallmodel-2026.10.21.15-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.24+ x86-64, Linux glibc 2.28+ x86-64 Details for hallmodel-2026.10.21.15-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
hallmodel-2026.10.21.15-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details for hallmodel-2026.10.21.15-cp311-cp311-macosx_11_0_arm64.whl
hallmodel-2026.10.21.15-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.24+ x86-64, Linux glibc 2.28+ x86-64 Details for hallmodel-2026.10.21.15-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
hallmodel-2026.10.21.15-cp310-cp310-macosx_11_0_arm64.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64 Details for hallmodel-2026.10.21.15-cp310-cp310-macosx_11_0_arm64.whl

Total release size: 1.6 MB

Release files / hallmodel-2026.10.21.15.tar.gz

Download URL hallmodel-2026.10.21.15.tar.gz
Size 30.0 kB
Tags Source
SHA-256 checksum
How to use checksums
6c4483d499d98a7d6ffcd94160ea34bd8f52c452bec5719491219374f1059301
BLAKE2b-256 checksum
How to use checksums
7077514b201e73a89b6897596799de1645e85c5caa6d1106a62c2cc2cb3aeee7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / hallmodel-2026.10.21.15-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL hallmodel-2026.10.21.15-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 167.7 kB
Tags CPython 3.14 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
94206e000aaf1c005dd2c5f21221be588d486525a9363b2a9d98450fa99dc027
BLAKE2b-256 checksum
How to use checksums
99e83e4d59140b657200f1e55cbb9bc5d9a908f56a7e7565a052a509afe9e4b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / hallmodel-2026.10.21.15-cp314-cp314-macosx_11_0_arm64.whl

Download URL hallmodel-2026.10.21.15-cp314-cp314-macosx_11_0_arm64.whl
Size 142.0 kB
Tags CPython 3.14 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
fa9211f8d1e3045662b22df3d98fbe7f9a3c7b82b91e75289277e553e03a7d2b
BLAKE2b-256 checksum
How to use checksums
d5fc11a5b12db2e224e03fe0b4d34facbaf7cd9b8e3908acac4f24cd9c41f4f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / hallmodel-2026.10.21.15-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL hallmodel-2026.10.21.15-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 167.7 kB
Tags CPython 3.13 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
c57a66ee89391d5a37a2916b4ca9d3d90202efd4f79c09ec3d4e007197fd13b0
BLAKE2b-256 checksum
How to use checksums
24c2f95c2497881ddae3e4574776170474fec62b4396048b03224bd30d5cabf4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / hallmodel-2026.10.21.15-cp313-cp313-macosx_11_0_arm64.whl

Download URL hallmodel-2026.10.21.15-cp313-cp313-macosx_11_0_arm64.whl
Size 142.2 kB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
6d9c56be666996701f7c67eef42b6a9f3f241ce0a6429a4b3bf90dc8764ab410
BLAKE2b-256 checksum
How to use checksums
487152f504558a63d5e3fd08bfb0976b5bc17c4227aec78bcb719b512ecf33b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / hallmodel-2026.10.21.15-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL hallmodel-2026.10.21.15-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 167.6 kB
Tags CPython 3.12 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
72519ed13876cc692741264302f579fe10e55cc974f05fec9de2b1e8f3b14683
BLAKE2b-256 checksum
How to use checksums
de9020478523416719da0bb6d82d54d475e37c6a110f162cbc9c3efe9c5f1d43
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / hallmodel-2026.10.21.15-cp312-cp312-macosx_11_0_arm64.whl

Download URL hallmodel-2026.10.21.15-cp312-cp312-macosx_11_0_arm64.whl
Size 142.2 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
f2873284c3119bcfb0b7cda15446f70eda7df4b901425c179466739845d3ae40
BLAKE2b-256 checksum
How to use checksums
c2629a1d7e2a722a16d1e1168d4bff9cec63e4df87ea25ca74cbfff9b03125c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / hallmodel-2026.10.21.15-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL hallmodel-2026.10.21.15-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 164.5 kB
Tags CPython 3.11 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
f9081ad0468ace017d18c452bfcbd23b5182e0bfbbb2711643e1d6702cd34f58
BLAKE2b-256 checksum
How to use checksums
71f4645670a128e663f6bce56f41f8e4d5853ad54e1eb487def8502eeefbf5c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / hallmodel-2026.10.21.15-cp311-cp311-macosx_11_0_arm64.whl

Download URL hallmodel-2026.10.21.15-cp311-cp311-macosx_11_0_arm64.whl
Size 139.5 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
db5d8ccd32ccadf1e015e2c103c8f289748d634f9f11aae227e5f732b093ec10
BLAKE2b-256 checksum
How to use checksums
cf1f3cdde3b559893760264121684f42304bc82addd3aaabb759e0572bbc502f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / hallmodel-2026.10.21.15-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL hallmodel-2026.10.21.15-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 163.8 kB
Tags CPython 3.10 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
23b56fd3d22875c3d0fd9c9b853f6551ad37ad4761e8b67c10a443cbc35fe70f
BLAKE2b-256 checksum
How to use checksums
e484affc4b1f9286951cd283ac50a9e5df86bf1b8288067abd8327a797e8412f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / hallmodel-2026.10.21.15-cp310-cp310-macosx_11_0_arm64.whl

Download URL hallmodel-2026.10.21.15-cp310-cp310-macosx_11_0_arm64.whl
Size 138.4 kB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
63add4f5dfbb8a4d4bc053bb134aebf7d3ad30d52c9f84b0c8b6e75340c14aad
BLAKE2b-256 checksum
How to use checksums
d6ec6f481a349517ddd747a46bdd5ccc267e4e3dea97c5f1d2319a9161f7e56a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Security for hallmodel 2026.10.21.15

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 11 files in this release have been uploaded with provenance metadata.

Select from 11 files

Attestation for hallmodel-2026.10.21.15.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page