Skip to main content

No project description provided

Project description

LenexPy

Python toolkit for reading and writing Lenex 3.0 swimming data (.lef/.lxf). Models and validation follow the official Lenex technical documentation (Version 3.0, 4 Mar 2025) — see https://wiki.swimrankings.net/images/6/62/Lenex_3.0_Technical_Documentation.pdf.

What it does

  • Decode/encode Lenex XML (.lef) and zipped Lenex (.lxf).
  • Pydantic + pydantic-xml data models aligned with the 4 Mar 2025 spec (required/optional attributes, timing modes, meet/session/event fields, etc.).
  • JSON helpers to build Lenex objects and emit .lef/.lxf.

Install

pip install lenexpy

Quick start

from lenexpy import fromfile, tofile

lenex = fromfile("meet.lxf")      # .lxf / .lef / .xml
tofile(lenex, "out.lxf")
tofile(lenex, "out.lef")

Work with bytes directly:

from lenexpy.decoder.lef_decoder import decode_lef_bytes
from lenexpy.decoder.lef_encoder import encode_lef_bytes
from lenexpy.decoder.lxf_decoder import decode_lxf_bytes
from lenexpy.decoder.lxf_encoder import encode_lxf_bytes

lenex = decode_lef_bytes(xml_bytes)
xml_bytes = encode_lef_bytes(lenex)

lenex = decode_lxf_bytes(lxf_bytes)
lxf_bytes = encode_lxf_bytes(lenex, "meet.lxf")

Build Lenex from JSON

scripts/parser.py can create Lenex objects from JSON and write Lenex files.

from scripts.parser import create_lenex_from_json_file
from lenexpy import tofile

lenex = create_lenex_from_json_file("meet.json")
tofile(lenex, "meet.lxf")

Minimal JSON shape:

{
  "version": "3.0",
  "constructor": {
    "name": "Bot",
    "version": "1.0.0",
    "contact": {"email": "bot@example.com"}
  },
  "meet": {
    "name": "Test Meet",
    "city": "City",
    "nation": "RUS",
    "sessions": [
      {
        "number": 1,
        "date": "2025-01-01T00:00:00",
        "events": [
          {
            "eventid": 1,
            "number": 1,
            "swimstyle": {
              "distance": 50,
              "relaycount": 1,
              "stroke": "FREE"
            }
          }
        ]
      }
    ]
  }
}

Tests

pytest

Fixture-based round trips live in tests/fixtures. Some third-party fixtures may xfail if they are not spec-conformant (e.g., missing required IDs).

Build

python -m build

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

lenexpy-3.0.2.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

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

lenexpy-3.0.2-py3-none-any.whl (33.8 kB view details)

Uploaded Python 3

File details

Details for the file lenexpy-3.0.2.tar.gz.

File metadata

  • Download URL: lenexpy-3.0.2.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.1 CPython/3.11.14 Linux/6.11.0-1018-azure

File hashes

Hashes for lenexpy-3.0.2.tar.gz
Algorithm Hash digest
SHA256 ad011cb8281013b99933268b3379f28b782753379c80f88191a1557eeef9c09f
MD5 df1f90d2edbc06cb1393889ab971b92a
BLAKE2b-256 ab9891254dcfa90dc230153d3070edc9b75f50d630a9a0090182d238428c753a

See more details on using hashes here.

File details

Details for the file lenexpy-3.0.2-py3-none-any.whl.

File metadata

  • Download URL: lenexpy-3.0.2-py3-none-any.whl
  • Upload date:
  • Size: 33.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.1 CPython/3.11.14 Linux/6.11.0-1018-azure

File hashes

Hashes for lenexpy-3.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c7df9dc129b64103e4c65ce60e5b680719acd3c61ca6d05f4ee7026f09380a8f
MD5 186cab5f3c01413727dc2315653502c9
BLAKE2b-256 149f9f47821c4001ebdd0d03aba9e85b30f3833f487471b7688ae6b32590c64c

See more details on using hashes here.

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