Skip to main content

USA Swimming meet result (.cl2 / SDIF v3) parser and analysis library

Project description

tunas

PyPI Python License: MIT

A Python library for parsing and analyzing USA Swimming meet result files (.cl2 / Hy-Tek SDIF v3).

tunas parses .cl2 files into clean, idiomatic Python objects (Meet, Club, Swimmer, IndividualSwim, Relay) and bundles USA Swimming time standards for offline qualifying-time lookups.

Install

pip install tunas

Requires Python 3.12+ and has zero third-party runtime dependencies.

Quick example

from tunas import read_cl2

meets, report = read_cl2("results.cl2")

for meet in meets:
    print(f"{meet.name} ({meet.start_date})")
    for swim in meet.individual_swims:
        outcome = swim.time if swim.time is not None else swim.status.value  # DQ / NS / ...
        print(f"  {swim.swimmer.full_name:<24} {swim.event.name:<16} {outcome}")

if report.warnings:
    print(f"{len(report.warnings)} records flagged — see report.warnings")

read_cl2 parses files into self-contained Meet objects and a ParseReport. Swimmers are scoped to each meet; reconcile cross-meet swimmers by grouping on id_short or id_long in your application.

Features

  • SDIF v3 Parser: Parses .cl2 meet result files including relays (E0/F0) and splits (G0).
  • Self-Contained Meets: No global state or cross-file merging; parsing is a pure function of input bytes.
  • Clean Object Model: Slotted dataclasses with direct object references (swimmers, clubs, swims, splits, and contact/registration data).
  • Offline Time Standards: Local lookup of USA Swimming B through AAAA motivational cuts.
  • Lenient Parsing: Recovers from data-quality issues by default with a detailed ParseReport. Opt-in strict=True raises on the first violation.
  • Type-Safe: Fully typed and carries the py.typed marker.

Documentation

Full documentation is available in docs/:

Development

Managed with uv (Python 3.12+):

uv sync                     # set up the environment
uv run pytest               # run the (offline, self-contained) test suite
uv run pytest --cov=tunas   # with coverage (gated at 95%)
uv run ruff check && uv run mypy src/tunas   # lint + type-check

See docs/architecture.md for the full workflow and the release process.

Status

tunas is in alpha. The API documented in docs/ is stable, but breaking changes may occur before 1.0 based on real-world feedback.

License

MIT

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

tunas-0.1.0.tar.gz (69.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tunas-0.1.0-py3-none-any.whl (75.5 kB view details)

Uploaded Python 3

File details

Details for the file tunas-0.1.0.tar.gz.

File metadata

  • Download URL: tunas-0.1.0.tar.gz
  • Upload date:
  • Size: 69.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tunas-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f45ce25505db6bcfee9c380a884ff39f88fdf92ad6227f841718c14e2767a0c8
MD5 ab0eeab43964b5120ede3dd525c5c21d
BLAKE2b-256 0160645e2dae7c63d506a1594f01f7da5f030f2ed9c3ed655941edbce05d9316

See more details on using hashes here.

Provenance

The following attestation bundles were made for tunas-0.1.0.tar.gz:

Publisher: publish.yml on ajoe2/tunas

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tunas-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: tunas-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 75.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tunas-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 74a2e10c256c74da0aefe4cf5b4263194d7bdda50859ee764c96b5527c71af90
MD5 612c5c109d438b5451b34124719ae437
BLAKE2b-256 16b7cbe19097ff7228c16b26ab36ec86fc0733cf681de7f9ae2374017a49aacb

See more details on using hashes here.

Provenance

The following attestation bundles were made for tunas-0.1.0-py3-none-any.whl:

Publisher: publish.yml on ajoe2/tunas

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