Sewlore Fabric Care
A dependency-free Python API and local command-line tool for checking paired fabric-care readings before comparing them. It produces accepted records and correction notes as separate CSV files. The template contains only the header; examples and test fixtures are explicitly hypothetical software inputs, not measurements of fabric.
Read the Fabric Measurement Guide: Stretch, Recovery and Care for the recording method and limits of the calculations. An interactive CSV validator is available separately; this package does not require Streamlit or upload data to that service.
Install and run locally
Use Python 3.10 or later. Python 3.12 is the checked local environment. Install this project from its checkout or a built wheel:
python -m pip install .
sewlore-fabric-care --version
sewlore-fabric-care template --output blank.csv
sewlore-fabric-care validate readings.csv --accepted accepted.csv --corrections corrections.csv
The equivalent module invocation is python -m sewlore_fabric_care. Use - as the input for stdin or as one output destination for stdout. Both result destinations are required; their headers are written even when there are no records. Stdout contains only the selected CSV; stderr contains counts or a command error, not source readings.
sewlore-fabric-care template
sewlore-fabric-care validate - --accepted - --corrections corrections.csv
Existing output files are refused unless --overwrite is explicit. The two destinations must differ and cannot replace the input, even with --overwrite. Parent directories must already exist. An I/O failure during writing may leave partial output; inspect both files after a command error.
| Exit code | Meaning |
|---|---|
0 |
No correction entries, including a valid header-only input. |
1 |
Correction entries exist; separate exports were written. |
2 |
Usage, path or I/O error; exports may be absent or partial. |
Strict default policy
The CLI and validate_submission(bytes) use the same restrictions as the original hosted validator: UTF-8 with optional BOM, at most 128 KiB, and at most 250 non-empty records. The exact ten-column header is:
sample_id,before_unit,after_unit,before_length,before_width,after_length,after_width,care_method,rectangle_assumption,notes
Use sample- followed by 1–6 digits, such as sample-001. Before and after units must match within each row and be cm, mm or in. All four readings must be positive finite decimal numbers. Care codes are wash, dry, wash-and-dry, rinse, steam, press or other; they describe what was done, not recommended care. Leave notes empty and keep detailed care observations in your own records. Use yes for area only when the paired length and width readings describe actual flat rectangles; otherwise use no or leave blank.
Do not include names, contact details, body measurements, personal identifiers or other sensitive information. The package makes no network requests, adds no analytics and does not cache or log CSV contents. It reads only the selected input and writes the explicitly selected outputs. Ordinary terminal history, pipes, filesystem permissions and other software on the device remain outside its control.
Malformed quoting, encoding or a policy/limit violation rejects the entire submission before calculation. Numerical, unit and column-count problems produce per-record diagnostics while other valid records remain separate. This distinction is deliberate.
API and results
from sewlore_fabric_care import (
BLANK_CSV, convert_length, validate_submission,
export_validated, export_errors,
)
assert convert_length(0.625, "in", "mm") == 15.875
accepted, corrections = validate_submission(BLANK_CSV.encode("utf-8"))
accepted_csv = export_validated(accepted)
corrections_csv = export_errors(corrections)
calculate_changes(before_length_mm, before_width_mm, after_length_mm, after_width_mm, rectangle_assumption=False) returns signed contraction percentages. For each axis, (before - after) / before * 100 is positive for contraction and negative for expansion. Optional rectangular-area contraction is 100 * (1 - after_length / before_length * after_width / before_width). It is None without the explicit rectangle assumption. Area percentages are not added across axes.
The labelled hypothetical input 20 × 20 cm becoming 19 × 19.5 cm gives approximately +5%, +2.5% and +7.375% rectangular-area contraction. No fabric was tested for these values. Calculations do not certify measurement precision, material performance, future care cycles or garment fit. Binary floating-point arithmetic is used; exported finite numbers use up to 12 significant digits. Preserve original readings for later review.
The lower-level validate_csv(str) is also available. It permits free-text notes and generic sample identifiers and uses a one-million-character limit. It does not enforce the strict CLI policy. Choose validate_submission for hosted-compatible anonymous records. CSV exporters quote fields and prefix formula-like text with an apostrophe; genuine numeric negatives remain numeric. Check your spreadsheet import settings.
Documentation, building and checks
Sphinx documentation is in docs/; .readthedocs.yaml builds it with Python 3.12. The documentation build needs the optional tooling; normal use needs no third-party libraries.
python -m pip install --index-url https://pypi.org/simple -r requirements-build.txt
python -m build
python -m pip install --force-reinstall --no-deps dist/sewlore_fabric_care-0.1.0-py3-none-any.whl
python -B -m unittest discover -s tests -v
python -m sphinx -W --keep-going -b html docs _build/html
Checks exercise the installed API, console entrypoint, file/stdin exports, exit codes, malformed and rejected inputs, unit handling, quoted CSV and overwrite protection. They use invented inputs. See CSV recording context and the browser-local shrinkage calculator for complementary workflows.
Source, provenance and licence
The calculation core comes unchanged from the Fabric-Care CSV Validator v1.0.0 release, commit 1db7b9a4fc8da8a109d6b40e125387752583c8bb. Its input policy changes only the import to a package-relative path. Distribution version 0.1.0 adds the API packaging, local CLI and documentation; it is distinct from that original software version. The original source repository and its software DOI identify the original release, not a DOI assigned to this new distribution.
Original code and documentation © 2026 Sewlore, MIT licence in LICENSE.txt, for any applicable copyright. Development and documentation were AI-assisted with OpenAI Codex. No individual author, academic affiliation, laboratory study, physical measurement dataset, peer review or human visual review is claimed. The licence grants no trademark ownership or platform endorsement.
Sewlore — Recording the method beside the measurement.
Metadata
Release files for sewlore-fabric-care 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| sewlore_fabric_care-0.1.0.tar.gz | 22.3 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sewlore_fabric_care-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 35.3 kB
Release files / sewlore_fabric_care-0.1.0.tar.gz
| Download URL | sewlore_fabric_care-0.1.0.tar.gz |
|---|---|
| Size | 22.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
264020407ebdc49664403791b68a5944acd51d22843874ac1c2b4e1bb9301c4e
|
|
BLAKE2b-256 checksum How to use checksums |
da29cc043fc88c1053b36d22eb4468512575494cc479f2656f496404d20fbf1e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 7, 2026.
Transparency logRelease files / sewlore_fabric_care-0.1.0-py3-none-any.whl
| Download URL | sewlore_fabric_care-0.1.0-py3-none-any.whl |
|---|---|
| Size | 13.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3fda5e77c92aea891b5c4ea1f53f0bfac6f1d7bc1a3ff0003e725bf70f6f0606
|
|
BLAKE2b-256 checksum How to use checksums |
d1fe25ff774055b70c50c20f7371b718979dbdb477698a21083ee5da84536897
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 7, 2026.
Transparency logSecurity for sewlore-fabric-care 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for sewlore_fabric_care-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 7, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.