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.16

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.16
File Size Uploaded Provenance Actions
hallmodel-2026.10.21.16.tar.gz 30.0 kB With provenance Details for hallmodel-2026.10.21.16.tar.gz

Built distributions (wheels)

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

Total release size: 1.6 MB

Release files / hallmodel-2026.10.21.16.tar.gz

Download URL hallmodel-2026.10.21.16.tar.gz
Size 30.0 kB
Tags Source
SHA-256 checksum
How to use checksums
0d237387a7d2614e70cf3e6de8a92d40201e6002f9392f5558cc938df4c2c307
BLAKE2b-256 checksum
How to use checksums
154e112152aa4fcce5e9ecc5f78bbbc164787892e2d40f828d95bd5b927f2a21
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.16-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL hallmodel-2026.10.21.16-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
1fbf635bece42025e98a9e8c6e9d6816126581037eb794029289aa4567fb168f
BLAKE2b-256 checksum
How to use checksums
3caa974ac58d17bf738f7b39231013b21f954e85c3bed7112ba1f296ca1ed913
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.16-cp314-cp314-macosx_11_0_arm64.whl

Download URL hallmodel-2026.10.21.16-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
f9dbbffee9fd8ed0099eb6c139991e1bb890596e4b6913bd79ce470fcc589128
BLAKE2b-256 checksum
How to use checksums
afc03602b754ced7ab11f3a5ffdec0a183330004fb3f61d26abab0c6c1e05da5
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.16-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL hallmodel-2026.10.21.16-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
baf78560eeda3460c76ee30318cbacec3b27eaf570e021c9861025bc065723d6
BLAKE2b-256 checksum
How to use checksums
edcff5a958c3dd0cc593e73a0dbdbaf54b69e597c8ace105fd7a1e3ccf008c64
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.16-cp313-cp313-macosx_11_0_arm64.whl

Download URL hallmodel-2026.10.21.16-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
84edd1ec77fcf49e7e6f36587eb4c7951b4e5c4c51481b83cee7a056427a630a
BLAKE2b-256 checksum
How to use checksums
57be8b61244a4677b368d67b93cf8e2e2a265cf136b2b5feeebe81c4c6659705
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.16-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL hallmodel-2026.10.21.16-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
c21d42554840c2280d86c1cb376a7cf5156e35af2efbac4f09e379cccd1454de
BLAKE2b-256 checksum
How to use checksums
199b7ea7dd313a914546a7d7f77e69234d0ff46904fd96965bf9df1168dbc547
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.16-cp312-cp312-macosx_11_0_arm64.whl

Download URL hallmodel-2026.10.21.16-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
52f57fe26d43253e23ccba0dd30084ed56d3dc1c844d00dce73d1587a6939429
BLAKE2b-256 checksum
How to use checksums
7e3ceb9bbb46113872a31dc28643a1e99e5318794f2da7cc560cfe38ed038e17
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.16-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL hallmodel-2026.10.21.16-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
94304ab1fb23234810c140bf565d45998ed7218ed069c28f049044022ad7f5d1
BLAKE2b-256 checksum
How to use checksums
083b8223a072c657a3e780a57ae7bd61189ec34d689320be3af3f1b95cdb311e
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.16-cp311-cp311-macosx_11_0_arm64.whl

Download URL hallmodel-2026.10.21.16-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
d13034f5b10f2b3a8cf5235b3c647351f51d2065a05801c252c0eab089b5e640
BLAKE2b-256 checksum
How to use checksums
b92c699226dbac095b2bfeaa2a90c4ad6fa091563eba70a27d91427e839c44fd
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.16-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL hallmodel-2026.10.21.16-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 163.7 kB
Tags CPython 3.10 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
289640f706b081c9701676aed9951d01db325e9ad5abde7aaf7f88a953aa451a
BLAKE2b-256 checksum
How to use checksums
9c689d69f17142efbf51c99195b909ac3be88e51666315850308f513d4d4f636
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.16-cp310-cp310-macosx_11_0_arm64.whl

Download URL hallmodel-2026.10.21.16-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
15d4e6734a7e3e02703d74514168a0062e4e88fce8f2b74b44134edbb00c0860
BLAKE2b-256 checksum
How to use checksums
fa8455318a163511167e488c59eb43f5b24c18b122852a28a8a3c720bbed9302
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.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.

Full provenance

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

Select from 11 files

Attestation for hallmodel-2026.10.21.16.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