Skip to main content

racetale-pace

Running maths with no dependencies, in Python. The same code as the racetale-pace npm package, and the same numbers as the free runner tools on the RaceTale blog: pace, finish time, race predictions, split plans, heart rate zones, spectator passing times and GPX start/finish trimming.

  • No dependencies, typed, Python 3.9 or newer.
  • Pure functions. Nothing is sent anywhere and nothing is stored.
  • Distances are kilometres and times are seconds inside; units only matter when you show a result.
pip install racetale-pace

Examples

from racetale_pace import format_duration, pace_from_time, riegel, split_plan, hr_zones, to_seconds

# Pace needed for a 3:45 marathon, in seconds per km
pace = pace_from_time(to_seconds(3, 45, 0), 42.195)
format_duration(pace)  # "5:20"

# A 25:00 5K, predicted for the marathon (Riegel, exponent 1.06)
format_duration(riegel(25 * 60, 5, 42.195))  # "3:59:47"

# Split table for a 25:00 5K, one row per km
split_plan(5, 1500, "km")[0]
# SplitRow(mark=1.0, length=1.0, split_seconds=300.0, cumulative_seconds=300.0, pace_seconds=300.0)

# Five heart rate zones from a max heart rate of 185
hr_zones(185)[0]
# HrZone(zone=1, name='Very easy', from_percent=50, to_percent=60, from_bpm=93, to_bpm=111)

When will a runner pass a spot? A 4:00 marathon starting at 09:00, a spectator at km 10 and km 30:

from racetale_pace import passing_times, format_clock

for p in passing_times([10, 30], 42.195, 4 * 3600, start_minutes=9 * 60, margin_minutes=10):
    print(p.km, format_clock(p.pass_minutes)[0], format_clock(p.arrive_minutes)[0])
# 10 09:57 09:47
# 30 11:51 11:41

Hide the first and last 200 m of a GPX track before sharing it:

from racetale_pace import LatLon, trim_range

points = [LatLon(47.0, 8.0), ...]
rng = trim_range(points, 200)  # (first_index, last_index) or None if the track is too short
if rng:
    shareable = points[rng[0] : rng[1] + 1]

What is in it

Area Functions
Pace and time pace_from_time, time_from_pace, distance_from_pace, pace_in_unit, speed, to_seconds, format_duration
Units KM_PER_MILE, to_km, from_km, DISTANCES (5K to 50K)
Predictions riegel (T2 = T1 x (D2 / D1)^1.06, optimistic for a first marathon)
Splits split_plan (even, positive or negative split), time_share, seconds_at_distance
Spectators passing_times, format_clock, parse_spots
Heart rate estimate_max_hr (208 - 0.7 x age), hr_zones (percent of max, or Karvonen with a resting rate)
GPX distance_meters, track_length, trim_range

These are estimates for planning, not medical or coaching advice.

MIT licence.

Metadata

Release files for racetale-pace 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 racetale-pace 1.0.0
File Size Uploaded Provenance Actions
racetale_pace-1.0.0.tar.gz 7.5 kB Without provenance Details for racetale_pace-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for racetale-pace 1.0.0
File Interpreter ABI Platform Actions
racetale_pace-1.0.0-py3-none-any.whl Python 3 none any Details for racetale_pace-1.0.0-py3-none-any.whl

Total release size: 14.6 kB

Release files / racetale_pace-1.0.0.tar.gz

Download URL racetale_pace-1.0.0.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
f440203a2d43a2183e7f0da2d8f9c114610c79c97ae8a422a13a826cdca8eb6d
BLAKE2b-256 checksum
How to use checksums
8d6d1782723916f745a046bdf6cced6e3e494e979f898bb970a997078170016a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

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

Download URL racetale_pace-1.0.0-py3-none-any.whl
Size 7.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0a8a9947ff5f86f553007961cc741a442e6924a1a436be853473fffed06f4382
BLAKE2b-256 checksum
How to use checksums
9868ad027579f907b391b0195c09fa0b540eeda496d94b9e2da607643f413df7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Security for racetale-pace 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