Skip to main content

ultracalcpal-nutrition

Ultra-marathon fuelling maths with no dependencies, in Python. The same code as the ultracalcpal-nutrition npm package, and the same numbers as the free calculator on ultracalcpal.com.

  • No dependencies, typed, Python 3.9 or newer.
  • Pure functions. Nothing is sent anywhere and nothing is stored.
  • Kilograms, kilometres, Celsius, grams, millilitres and milligrams inside; convert at the edge with the unit helpers.
  • Results that need words (fuel kinds, risk flags, drop-bag items) are codes and numbers, so you can put them in any language.
pip install ultracalcpal-nutrition

Examples

from ultracalcpal_nutrition import PlanInputs, calculate_plan, fuel_options, carb_loading_per_day, recovery

# A 70 kg runner, 14 hours out, steady effort, hot day
plan = calculate_plan(PlanInputs(weight_kg=70, duration_h=14, effort="moderate", weather="hot"))
# carbs_per_hour=56, fluids_per_hour=630, sodium_per_hour=700, total_carbs=784, total_fluids=8820, total_sodium=9800

# What an hour's carbs look like as products
fuel_options(plan)
# [FuelOption(kind='gels', per_hour=3, carbs_g=56), FuelOption(kind='chews', per_hour=2, ...),
#  FuelOption(kind='drink', per_hour=2, carbs_g=56, fluids_ml=630)]

carb_loading_per_day(70)  # 700 g a day for the three days before
recovery(70)  # Recovery(carbs_g=84, protein_g=21, fluids_ml=1750), the first hour after

The course, as segments between aid stations and what to put in each drop bag:

from ultracalcpal_nutrition import AidStation, station_segments, drop_bags

segments = station_segments(plan, 14, [
    AidStation("a", "Creek", 25, "km", crew_access=True),
    AidStation("b", "Finish", 100, "km"),
])
drop_bags(segments)  # what to pack at Creek: gels, bottles, salt capsules, spare kit, a headlamp

Heat, and what stands out for this plan:

from ultracalcpal_nutrition import heat_index_c, wbgt_c, weather_adjustments, risk_flags

hi = heat_index_c(32, 60)  # 37.1, the feels-like temperature in Celsius
wbgt_c(32, 60)  # 33.3, wet-bulb globe temperature estimate
weather_adjustments(hi, 60, plan.fluids_per_hour, plan.sodium_per_hour)  # 30 % more fluids, 40 % more sodium
risk_flags(PlanInputs(weight_kg=70, duration_h=14, effort="moderate", weather="hot"), plan)
# [Risk(code='heat-manual', severity='moderate', ...), Risk(code='long-duration', ...)]

What is in it

Area Functions
Per hour calculate_plan, carbs_per_hour, fluids_per_hour, sodium_per_hour, advanced_metrics, hourly_timeline, dual_carb_split
Fuel fuel_options, mixed_strategy, SERVINGS, cost_estimate
Before and after carb_loading_per_day, recovery, caffeine_protocol
Aid stations sort_stations, station_segments, drop_bags
Weather heat_index_c, wbgt_c, dew_point_c, heat_stress_level, weather_adjustments, HEAT_MULTIPLIERS
Risks and review risk_flags, variance
Units kg_to_lb, lb_to_kg, km_to_mi, mi_to_km, c_to_f, f_to_c, round1
Constants CARBS_G_PER_KG_H, FLUIDS_ML_PER_KG_H, SODIUM_MG_PER_H, CARB_CAP, GUT_CARB_CAP, SODIUM_SENSITIVITY, ALTITUDE, CAFFEINE, ELECTROLYTES

The numbers are published sports-nutrition ranges scaled by body weight and conditions: a starting point to test in training, not medical advice. Talk to a doctor or a sports dietitian about your own health.

MIT licence.

Metadata

Release files for ultracalcpal-nutrition 1.0.0

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

Source distribution (sdist)

Source distribution for ultracalcpal-nutrition 1.0.0
File Size Uploaded Provenance Actions
ultracalcpal_nutrition-1.0.0.tar.gz 11.9 kB Without provenance Details for ultracalcpal_nutrition-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ultracalcpal-nutrition 1.0.0
File Interpreter ABI Platform Actions
ultracalcpal_nutrition-1.0.0-py3-none-any.whl Python 3 none any Details for ultracalcpal_nutrition-1.0.0-py3-none-any.whl

Total release size: 23.1 kB

Release files / ultracalcpal_nutrition-1.0.0.tar.gz

Download URL ultracalcpal_nutrition-1.0.0.tar.gz
Size 11.9 kB
Tags Source
SHA-256 checksum
How to use checksums
871037c2b0a65730f5e6b29c676fb582b6a8f42b3e51c016de998a19fa094949
BLAKE2b-256 checksum
How to use checksums
f7dd32f9bef087fedc833b01baab2fd3b4d45c496914894f54d798b25b5aae90
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release files / ultracalcpal_nutrition-1.0.0-py3-none-any.whl

Download URL ultracalcpal_nutrition-1.0.0-py3-none-any.whl
Size 11.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
db203f3aea5d8debf5502ab359a19a2b120c4ed515f9bd70fd3052f65b8e0aed
BLAKE2b-256 checksum
How to use checksums
2a0f87faa96753bd0570f1bd4434a216eb1b17984a8b47e71a28caf27f9731ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Security for ultracalcpal-nutrition 1.0.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

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