No project description provided
Project description
LenexPy
Библиотека для чтения/записи LENEX (LEF/LXF) и преобразования "удобного JSON" в Lenex.
Основное
- LEF: обычный XML Lenex.
- LXF: ZIP с одним LEF файлом внутри.
- Модели на pydantic-xml, сериализация/десериализация без изменения XML‑контракта.
Установка
pip install lenexpy
Быстрый старт
Чтение/запись:
from lenexpy import fromfile, tofile
lenex = fromfile("meet.lxf") # .lxf / .lef / .xml
tofile(lenex, "out.lxf")
tofile(lenex, "out.lef")
Работа с bytes:
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")
Удобный JSON -> Lenex
Файл parser.py принимает простой JSON и строит Lenex.
from parser import create_lenex_from_json_file
from lenexpy import tofile
lenex = create_lenex_from_json_file("meet.json")
tofile(lenex, "meet.lxf")
Минимальный JSON:
{
"version": "3.0",
"constructor": {"name": "Bot", "version": "1.0.0"},
"meet": {"name": "Test Meet", "city": "City", "nation": "RUS"}
}
Тесты
pytest
Фикстуры кладите в tests/fixtures (поддержка вложенных папок).
Сборка
python -m build
Project details
Release history Release notifications | RSS feed
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.1b0.tar.gz
(13.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
lenexpy-3.0.1b0-py3-none-any.whl
(31.8 kB
view details)
File details
Details for the file lenexpy-3.0.1b0.tar.gz.
File metadata
- Download URL: lenexpy-3.0.1b0.tar.gz
- Upload date:
- Size: 13.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.11.7 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac7e661754a5beed90a5ccafa479725c60a1e738af531997a273b305defd54e8
|
|
| MD5 |
01849b007f3e68aee28e284554697be4
|
|
| BLAKE2b-256 |
17dec306c5882c3ff46505303202025f0474f94828a442dea822e199c97e5914
|
File details
Details for the file lenexpy-3.0.1b0-py3-none-any.whl.
File metadata
- Download URL: lenexpy-3.0.1b0-py3-none-any.whl
- Upload date:
- Size: 31.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.11.7 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1978e1ab8bd6bb7d604770534b94375a886dcd38de96fc4af7064ab393d3959c
|
|
| MD5 |
7684d66d767677da09af83310d0aa37c
|
|
| BLAKE2b-256 |
d43355f930f7e715ebe3f4711db97e9b89a5ae2b6d43daf8c935f68a51d05b2e
|