Files
root 948d98accb Initial commit: bs-roster-parser v1.0.0
Python library for parsing BattleScribe/NewRecruit roster JSON.
Extracted from Nachmund Tracker's processJSON, ported JS→Python.

- parse_roster(json_string) / parse_roster_file(path) → RosterSummary
- Extracts: unit name, pts, CP, model count, weapon breakdown per model variant
- Handles: variable-model-count units, nested costs, compound upgrades
- Unicode apostrophe-safe unit lookup (find_unit)
- to_dict() for JSON serialization
- 8/8 tests passing on real roster data (27 units, 2815pts)
2026-06-18 03:04:16 +00:00

17 lines
578 B
Python

"""
bs-roster-parser — Parse BattleScribe/NewRecruit roster JSON into flat unit lists.
Usage:
from bs_roster_parser import parse_roster, RosterSummary
with open('roster.json') as f:
summary = parse_roster(f.read())
for unit in summary.units:
print(f"{unit.name}: {unit.pts}pts, {unit.model_count} models")
print(f"Total: {summary.total_pts}pts, {summary.total_cp} CP")
"""
from .parser import parse_roster, parse_roster_file, RosterSummary, Unit
__version__ = "1.0.0"
__all__ = ["parse_roster", "parse_roster_file", "RosterSummary", "Unit"]