Numeric CSV interchange for VIT/SMIS with explicit mm, cm and inch units

We maintain Sewlore’s sewing tools and have prepared an independent, small Python helper for a particular interchange workflow: bringing a CSV containing explicit units into an individual-measurement file, or exporting a numeric measurement file into a common unit before comparing it with another table.

SeamlyME already has CSV export. This helper’s purpose is the narrower roundtrip and mixed-unit import workflow, with explicit errors and a choice about carrying personal metadata. It is not a replacement for SeamlyME, and it is not an official Seamly extension.

First distinguish the file formats

The official schemas distinguish legacy .vit (<vit>, version 0.3.3) and current .smis (<smis>, version 0.3.4). Merely changing a file extension or writing version 0.3.4 inside a <vit> root does not produce the matching schema. This release accepts those two specific versions and generates a correctly paired root/version. It does not import newer Tape/Valentina formats or multisize tables.

An example you can reproduce without personal data

The bundled CSV is explicitly synthetic:

name,value,unit,full_name,description
bust_circ,840,mm,Bust circumference,Synthetic example only
waist_circ,26,in,Waist circumference,Synthetic example only
hip_circ,96,cm,Hip circumference,Synthetic example only

Running:

python sewlore_measurements.py from-csv examples/mixed-units.csv example-copy.smis --unit cm

creates centimetre values of 84, 66.04 and 96, using 1 inch = 25.4 mm. The identifiers stay unchanged. It is still necessary to check that those identifiers and measurements match what your own pattern expects; a syntactically valid measurement file is not a fitting result.

What is deliberately rejected

This is a numeric interchange tool. It rejects formulas such as bust_circ / 2 rather than trying to evaluate them or incorrectly converting their text between units. Duplicate identifiers, unsupported units, malformed CSV and XML entity declarations also fail with an error. The supported identifier subset is ASCII letters, digits and underscores, beginning with a letter or underscore. The current release does not cover every name permitted by the broader schema.

Keep an original copy and make metadata choices

Output files must have new names; the tool does not overwrite the input or an existing output. Ordinary exports leave out personal information and notes. If you deliberately want to preserve those fields locally, importing with --template original.smis copies the metadata from that editable original. The CSV replaces the complete measurement list, so a partial CSV must not be treated as a patch file. Read-only templates are rejected.

Checks and limitations

The generated examples validate against the official VIT 0.3.3 and SMIS 0.3.4 schemas. Automated checks cover CLI roundtrips, all unit pairs, mixed units, XML escaping, metadata handling and invalid inputs. Roundtrips involving inches write up to 15 significant digits, so insignificant trailing-digit differences can occur. Native interactive opening and saving in SeamlyME has not yet been verified in this environment; please work on a copy and review the result in your installed application.

The code, step-by-step explanation and synthetic files are available here:

Sewlore Measurement Interchange

Sewlore maintains the independent helper. It uses only Python’s standard library, runs locally and has no analytics or network requests. The code and examples are MIT licensed. AI assisted with implementation and documentation; the numerical behavior was checked with automated tests. Feedback on interoperability is welcome, especially examples of unsupported identifiers or versions with personal details removed.

I have tested and found this to be technically defecive, pretty much useless, and does not improve the Seamly community ecosystem. It appears to be completetly written by AI without ever opening and testing with SeamlyMe. Here is a list of the major issues I found when testing with real measurement files:

1. The @ Custom Prefix Crash (Workflow Blindness)

  • The Script’s Error: “Error: Unsupported measurement name ‘@Hauteur_cape’; use an ASCII letter/underscore followed by letters, digits or underscores.” for a valid measurment name. "

  • The Monotropic Cause: The AI hardcoded an aggressive variable check (NAME = re.compile(r"[A-Za-z_][A-Za-z_0-9]*\Z")).

  • The Reality: The @ prefix is a vital, standard Seamly feature used to designate and track custom user-defined variables vs. standard body dimensions. Banning this symbol locks out users and renders existing patterns un-importable.

2. The Formula Explosion (The “Value” Attribute Misconception)

  • The Script’s Error: “MeasurementError: ‘bust_circ/20’ is not a numeric literal.”

  • The Monotropic Cause: The AI read the lXML schema attribute value=“…” and blindly assumed it could only contain flat numbers. It locks it down using a strict NUMERIC.fullmatch() check.

  • The Reality: Due to a historical naming quirk in Seamly’s early development, the value attribute actually holds the dynamic mathematical formula expression (e.g., ). By banning letters and math operators here, the script completely strips out Seamly’s core parametric math functionality.

3. The International Decimal Crash

  • The Script’s Error: “Error: CSV row 2: wrong number of cells.”

  • The Monotropic Cause: The script relies on un-quoted, basic comma splitting. It has no structural parsing fallback or locale awareness.

  • The Reality: A large portion of Seamly’s global community lives in regions that use a comma as a decimal separator (e.g., 66,04). When a user types their measurements naturally, this script reads the decimal comma as a structural column boundary, completely offsets the text layout, miscounts the fields, and implodes.

4. The Codec & Separator Blindness

  • The Script’s Behavior: Hardcodes utf-8-sig and csv.DictReader defaults.

  • The Reality: SeamlyME features multi-locale Export options window precisely because data formats change globally. Users routinely select Semicolons, Tabs, UTF-16, or legacy System encodings to ensure their data loads cleanly in local versions of Excel. This script ignores those UI selections completely, guaranteeing file corruption or UnicodeDecodeError crashes for international configurations.

5. Clunky CLI Usage

  • The Script’s Behavior: Lacks clean, human-centric fallback error routing or file menus. It utilizes confusing positional subcommands (to-csv input output).

  • The Reality: Non-programmers cannot debug raw terminal scripts. If a file extension handles oddly on a user’s machine, the terminal drops out entirely and launches unrelated background software loops (like my legacy Atom text editor telemetry crashes) instead of offering an intuitive, visual file-picker solution.