fashion-size
Size types (UK dress size, EU adult shoe size, chest in centimetres) and the charts that convert them. Clothing and footwear share this library.
pip install fashion-size
Requires Python 3.12 or newer. There are no runtime dependencies.
Default UK / EU / US / AU charts are in Python. Brand charts that differ from those defaults ship as JSON: the rows, the source page, and notes live with the chart, and the date it was last checked lives in the brand catalog.
This package does not depend on Django. Django model fields are in django-fashion-size.
The source repository is github.com/ababic/fashion-size.
Size types and conversion behavior
fashion-size supports three conversion models:
- Brand-variable chart lookup: the size type can use default scales or brand overrides.
- Fixed default chart lookup: the size type always uses shipped default scales.
- Fixed formula conversion: conversion is direct (
in<->cm), not chart-based.
| Size type | Common size units | Conversion model | How units vary |
|---|---|---|---|
Dress (dress) |
uk-dress-size, eu-dress-size, us-dress-size, au-dress-size (fr-dress-size resolves to EU) |
Brand-variable chart lookup | Regional numeric labels. French dress labels are the EU value. |
Adult shoe (adult-shoe) |
uk-adult-shoe-size, eu-adult-shoe-size, us-adult-shoe-size, au-adult-shoe-size (fr-adult-shoe-size resolves to EU) |
Brand-variable chart lookup | Numeric rows vary by locale; alpha shoe labels (XXS ... XXL) are accepted and convert identically across UK/EU/US/AU. |
Kids shoe (kids-shoe) |
uk-kids-shoe-size, eu-kids-shoe-size, us-kids-shoe-size, au-kids-shoe-size (fr-kids-shoe-size resolves to EU) |
Brand-variable chart lookup | Same unit behavior as adult shoes, but with the kids shoe chart lineage. The default chart covers children and babies (one chart for every gender). Baby shoe sizes (UK 0–5.5) stay on the baby shoe chart. |
Baby shoe (baby-shoe) |
uk-baby-shoe-size, eu-baby-shoe-size, us-baby-shoe-size, au-baby-shoe-size (fr-baby-shoe-size resolves to EU) |
Brand-variable chart lookup | Same unit behavior as other shoes, but with the baby shoe chart lineage. |
Cup (cup-size) |
uk-cup-size, eu-cup-size, us-cup-size, au-cup-size (fr-cup-size resolves to EU) |
Brand-variable chart lookup | Letter mappings differ across locales (DD/E/DDD etc). Alpha cup labels (XXS, XS, S, MD, LG, XL, XXL) are locale-identity values. |
Band (band-size) |
uk-band-size, eu-band-size, us-band-size, au-band-size, fr-band-size |
Fixed default chart lookup | UK/US are inch labels, EU is centimetre label, AU is dress-style number, and FR is EU + 15. Brand overrides are intentionally disabled for this type. |
Waist label (waist-size) |
uk-waist-size, eu-waist-size, us-waist-size, au-waist-size |
Brand-variable chart lookup | UK/US/AU waist labels are inch-based. EU waist is a shared regional unit: adult rows use continental labels, while child rows use centimetres. |
Chest label (chest-size) |
uk-chest-size, eu-chest-size, us-chest-size, au-chest-size (fr-chest-size resolves to EU) |
Brand-variable chart lookup | UK/US/AU chest labels are inch-based. EU chest is a shared regional unit: adult rows use continental labels, while child rows use centimetres. French chest labels match EU. |
Body measurements (chest, waist, collar, sleeve) |
cm-chest-size, in-waist-size, in-collar-size, in-sleeve-length, etc. |
Fixed formula conversion | Tape-measure style values in in/cm. Bounds: chest 18–88, waist 16–85, collar 11–28, sleeve 28–40. A dress shirt 15.5/34 is collar and sleeve, both inches. Each exposes length_range on the size type. |
Leg length / inseam (inside-leg, shorts-inseam, trousers-inseam) |
in-inside-leg, in-shorts-inseam, in-trousers-inseam, and cm-* pairs |
Fixed formula conversion | Garment inside-leg / inseam in in/cm. Prefer shorts-inseam (2–24 in) or trousers-inseam (17–42 in) on product-specific attributes (17–24 in overlaps by design; disambiguate by product/schema). Generic inside-leg / leg-length accepts 2–42 in when the catalog has not split shorts vs trousers. |
Hem length (hem-length) |
in-hem-length, cm-hem-length (attribute slug dress-length also resolves here) |
Fixed formula conversion | Fitted-dress hem tape measure in in/cm, bounds 20–42 in (separate from trousers-inseam so dresses do not reuse that bucket). |
Label sizes (trouser-length, top-length, skirt-length, jacket-length, shoe-width, proportion, age-months, age-years, letter) |
one universal unit per type (trouser-length, letter, …) |
None | Sold-as words, age bands, and generic letter sizes (XXS through 6XL, plus ONE for one size). raw is a canonical token (regular, mid, extra-wide, 5-6, 2XL). Month units include months, month, mths, mth, and m. Synonyms fold in (R, M/Mid, std, XXL, small). skirt-length and jacket-length (coat-length) share the length words with top/trouser length but stay separate types for dresses and outerwear. They are not on locale charts. |
Today, shipped brand overrides are concentrated in selected dress and shoe charts. Types still marked as brand-variable above continue to fall back to default scales when no matching brand chart exists for the brand, demographic, product type, and as_of capture instant.
Size description strings
fashion_size.descriptions is imported only when you call it. It recognises common feed strings and joins size values back into one string. The product type's family chooses how an unlabelled number is read. Chart sizes stay in the region they were written in. Length values can move between inches and centimetres. Label wording follows preferred_regions, from the vocabulary on the label size type.
from fashion_size.descriptions import decode_size_description, encode_size_description
from fashion_size.product_types import ProductType
from fashion_size.types import Locale
decoded = decode_size_description("30/32", Locale.UK, product_type=ProductType.JEANS)
decoded.format_id # "waist-leg"
decoded.confidence
decoded.sizes
encode_size_description(
decoded.sizes, Locale.UK, preferred_regions=(Locale.UK, Locale.EU)
).text
encode_size_description is the listing string. A regional dress size keeps its own prefix by default (UK 10, EU 38); pass include_region_prefix=False for bare numbers (10, 10M). In English, an inch length drops the inch mark and uses the catalogue letter when the size type has one (W30, L30). A region label such as EU 30 stays. Waist plus inside leg is 30/32 in inches. Waist plus a trouser-length word is 30L. Length and proportion tokens use each region's listing short form when one exists (S, M, R, L, XL, XS, P for UK, US, AU, EU, and FR), so chest or waist plus Regular is 40R, Mid is 40M, and a dress trails as UK 10R or UK 10P. Skirt length and jacket length use the same short forms (UK 10M, outerwear chest 40L). A dress plus hem measurement is space-joined (UK 10 34). A bare M on a top stays letter Medium; Mid / mid-length and adult waist codes such as 30M are top/trouser length. Pass age_group=AgeGroup.CHILD or AgeGroup.BABY when the feed is kids or baby clothing: trailing M / 6m stays months, because Mid length is an adult reading. With an inside leg, that letter trails the slash (30/32R). Full regional words such as French Court remain on label_text. A bra is 34DD. Age is the age display only. Anything else is space-joined in input order.
confidence is 1 when the caller names a writer format, 0.9 when only one format fits, and 0.65 when more than one fits. An empty value list, a format that matches nothing, or every value discarded returns an empty string, no format id, and confidence 0. Decode-only ids (unit-patterns, regions, numbered-fit, collar-sleeve, shoe-width, length-word, bare-number) are an error. discarded lists tokens that were duplicates, out of the target length range, unused, or not recognised. A range such as UK 8-10 is not a size. A cell with several regions, such as EU 38 / UK 10 or 41 (UK 7.5), returns each region. preferred_regions then keeps the first of those that is present. Omit it and source_region is used. Chart sizes are not converted onto a chart. A length that cannot be converted into the preferred unit is discarded with reason out-of-range. Length conversion uses age_group (adult when omitted), the same value that selects a child or baby shoe and months versus years.
Callers choose which attributes become Size values. Opaque catalogue text such as one-size, bags, or bedding stays outside encode. The letter token ONE displays as One size.
An unprefixed number is read in source_region only when it is on that region's default chart for the size type. If not, and exactly one other region's chart has it, that region is used (39 on a UK shoe is EU 39). If several charts or none have it, no chart size is returned. A prefixed number such as EU 39 is never moved. Letters, cups, and lengths are not affected. Pass age_group=AgeGroup.CHILD or AgeGroup.BABY to place a shoe on the kids or baby chart, including a prefixed number such as EU 28 (adult when omitted). A bra band has to be a row on that chart. French bands are used for a French feed, or when no other chart has the number.
A bra string such as 32DD is a UK inch band from 28 to 56 plus a cup letter. A bare band with no cup uses the feed source_region (UK/US inches, EU centimetres, AU or FR band labels). Otherwise an even UK dress size from 4 to 24 applies on bras and stays a UK dress label regardless of source_region (for example 10 is dress, 32 is band in the UK). A cup span such as A-C, D-E, F-G, or GG-H is a cup-range label and is not a chart cup; it may sit alone or next to a dress or band (10 A-C). Strings such as M C or Medium A-C on a bra or swimwear product are a generic letter size plus a chart cup letter or a cup-range. On a dress, skirt, nightwear, or swimwear product a cup letter paired with a numeric size is ignored (32DD on a dress is dress 32 only). A French prefix is folded onto EU before an unlabelled number in the adult shoe span (35–50) is read as a shoe size, so a lone EU 40 or FR 40 with no product type is an EU adult shoe size. A French band outside that span, such as FR 90, stays a band size.
Chart hits
chart_hits lists every default chart one size token sits on, and the families, age groups, and genders those charts could belong to. It does not pick a single reading. decode_size_description still does that once the product type is known. The function takes the token only: no source region and no product type.
from fashion_size.chart_hits import chart_hits
chart_hits("14 REG")
chart_hits("EU 39")
chart_hits("8")
ChartHits.families, age_groups, and genders are the union of the hits. A hit with a blank age or gender adds nothing to that set. An empty set abstains, so a letter or a number that sits on no chart leaves the other tokens on the line free to decide. The caller stores the hits and intersects the three sets.
A region prefix keeps that region's charts. EU 39 is the EU adult shoe charts, women's and men's. No prefix does not assume UK and does not assume a dress size, so bare 39 also sits on the UK, US, and AU men's waist and chest charts. French dress, shoe, and chest labels use the EU numbers and are reported as FR. French waist is not a chart. A French band is the EU centimetre label plus 15.
A length token (SHT, REG, LNG, PET, TAL, or a trailing S, R, L, or T) keeps adult dress, waist, and chest hits and drops shoe, band, and child hits. 14 REG is three adult women's dress hits, UK, US, and AU, each with length_token reg. 58/60L keeps the EU women's dress, EU men's dress, EU waist, and EU chest charts for both numbers. 62L is EU waist and EU chest.
A cup letter reads the number as a band on each band chart that contains it (UK and US inches, EU centimetres, AU dress-style numbers, FR the EU label plus 15) and does not return the dress hit. 30C and 32C are a band plus cup C, in the bras family, even though UK dress 30 and 32 are on the women's chart. The band chart is one chart for every adult, so the band hit's gender is blank. The cup hit is adult women's. 32M is a band plus cup M. A trailing L is always a length, because 58/60L has to be one: 32L is adult dress, waist, and chest, and cup L is not returned. L is the only length letter that is also on the cup chart. 32M is a band plus cup M. A bare M after a number is that cup, not months; months are written 6 months or 6 mths.
A cup range (A-C, D-E, F-G, GG-H) has to contain a hyphen. It is one bras hit with no number and no region. A C, 10 A C, and Medium A-C match nothing. An even number from 4 to 24 beside a range is UK dress, family bras, and the shoe and band hits for that number are dropped. 10 A-C is that dress size plus the cup range. The written prefix is not kept: US 10 A-C comes back as UK dress, and no hit records that the cell said US.
Each hit's size_kind is the size-type slug: dress, adult-shoe, kids-shoe, baby-shoe, waist-size, chest-size, band-size, cup-size, cup-range, letter, age-years, age-months, or unplaced. chart_region, age_group, and gender are the enums, or blank.
A letter (S, M, L, XL, and the usual synonyms) is one hit with no family, so all three sets stay empty. An age label (2-3 years, 6 months) is one hit with no family. Years are children and months are babies, and that age group is the only entry in age_groups. A number on no chart is one unplaced hit with no region and empty sets.
The kids' shoe rows are registered for babies and for children. They are returned once, as children. Baby shoes are the separate chart (UK 0–5.5, EU 16–22) and those hits are babies. A number that also sits on an adult chart returns the adult hit as well.
Brand charts
from fashion_size import SUPPORTED_BRANDS, ProductType
from fashion_size.charts import chart_for, load_brand_charts
"Dune London" in SUPPORTED_BRANDS
chart = chart_for("Dune London", "adult-shoe", "adult", "female", product_type=ProductType.SHOES)
chart.updated_at
chart.effective_from
chart.effective_until
chart.source_url
chart.source_notes
chart.rows
ProductType is the list of ranges a brand chart can cover on its own (jeans, trousers, shorts, skirts, bras, swimwear, nightwear, hosiery, outerwear, shoes, boots, and so on). A chart names the product types it replaces. Each product type belongs to a ProductTypeFamily (bottoms, tops, footwear, dresses, bras, other). A family is the shared way of reading an unlabelled size: jeans and trousers are both bottoms, dresses and skirts are both dresses. A product type's profile adds the cases that are not shared, such as a suit chest size or a dress-shirt collar and sleeve.
Each override chart is a JSON file named by id under src/fashion_size/fixtures/charts. The file holds the rows, the source page, and any notes about that table. Which brand it belongs to, the size type and demographic, when it was last checked, and when its rows take effect live in fashion_size.brands. A later chart for the same size type, demographic, and product types replaces the earlier one: effective_until is that next start, or none while the chart is current. A brand with no charts there matches the default charts. Superseded charts stay in the catalog.
chart_for takes an optional as_of timestamp, the instant the raw size was captured. Omit it to use the latest matching chart generation. A capture time before the first chart in a series returns none.
Conversion
from fashion_size import Demographic, ProductType
from fashion_size.types import UK_ADULT_SHOE_SIZE, UK_DRESS_SIZE, Size
women = Demographic("adult", "female")
value = Size.from_raw("10", UK_DRESS_SIZE)
value.convert_to_locale("eu", demographic=women)
shoe = Size.from_raw("7", UK_ADULT_SHOE_SIZE)
shoe.convert_to_locale(
"eu",
demographic=women,
brand_name="Dune London",
product_type=ProductType.SHOES,
)
convert takes a SizeUnit on the same size type, or "cm" / "in" for a length. convert_to_locale resolves a locale such as "eu" to that size type's SizeUnit and calls convert. Both require a Demographic (age group and gender). Optional brand_name and product_type select a brand chart. Optional as_of is when the raw size was captured; omit it to use the latest matching brand chart generation and the current default chart. Set strict_brand_name=True to reject a brand name that is not in SUPPORTED_BRANDS.
Both return a ConvertedSize with the resulting size and a ConversionSource (identity, default, brand, or length_formula). When the default chart is used, source.default_reason says why: no brand was passed (no_brand), the name is not in the catalog (unknown_brand), the catalog brand has no override charts (brand_uses_default), or the brand has no chart for this size type, product type, and capture time (no_matching_chart). Band size with a brand name records size_type_uses_default. ConvertedSize has no conversion method, so a converted value is not converted again.
Default charts use the same windows. The charts shipped in this package apply from the first representable instant until a later default for that size type and demographic replaces them. A capture time before a brand's first override uses the default chart that was in force then.
Chart age coverage
A size type defines the numeric scale on the attribute (kids-shoe, baby-shoe, …). A catalogue age group (child, baby, adult) is how the product is filed. fashion_size.chart_coverage.CHART_AGE_COVERAGE lists, per size type, every catalogue age that may use that type's conversion charts.
| Size type | Catalogue ages covered | Notes |
|---|---|---|
baby-shoe |
baby |
UK 0–5.5 scale |
kids-shoe |
child, baby |
UK 6+ youth scale; same rows whether the item is filed as child or baby |
adult-shoe |
adult |
|
dress |
adult, child |
Separate default row sets per age |
waist-size, chest-size |
adult, child |
Kids rows are child-only; no baby waist/chest charts |
cup-size, band-size |
adult |
Lookup tries charts stored under the product's age first. For kids-shoe on a baby label, a brand override filed under child is used when there is no baby chart — the same rule as the default kids shoe chart. Other size types do not fall back across catalogue ages.
brand_name may be any string. A BrandName selects that brand's chart. Any other name uses the default chart unless strict_brand_name is set. An unknown product_type is an error.
French dress, shoe, cup, and chest labels are the EU size ("fr" converts to that EU value). French band size is the EU centimetre label plus 15. French waist size is not on the chart. Length size types convert between centimetres and inches (1 in = 2.54 cm) only inside each type's inch bounds (see the conversion table). Display rounding (nearest centimetre, nearest half inch) does not change the stored value.
Each length size type exposes inclusive bounds on the type itself: SHORTS_INSEAM.length_range_start / length_range_stop, or SHORTS_INSEAM.length_range (start_inches, stop_inches, and centimetre properties). These are fixed per size type, not read from locale charts. The same range is available on SizeUnit.length_range (for example INCH_SHORTS_INSEAM.length_range). length_entry_bounds(size_type) returns the same limits as min/max fields for form widgets. Use length_value_in_range(raw, size_unit) to validate an entry against the attribute's size unit. When a number could belong to more than one leg-length attribute, length_size_types_for_inches and length_size_types_for_measurement list matching types with the narrowest span first (garment inseams before generic inside leg). By default they consider shorts-inseam, trousers-inseam, and inside-leg only; pass candidates= to widen (for example LENGTH_SIZE_TYPES) or narrow to garment inseams. size_from_attribute_option returns None for length values outside the attribute's bounds.
UK, US, and AU waist and chest labels are the inch measurement, so they display like a length (30", 30 in). A UK or US band is the underbust in inches; an EU band is centimetres (75cm, 75 cm). An EU waist or chest label stays regional (EU 46): adult charts use a different number, and children's charts store centimetres, on one shared size unit. An AU band is a dress-style number (AU 12). A French band keeps its own number (FR 90).
Sports bras and bralettes can use alpha cup labels on the same size type. Stored values are XXS, XS, S, MD, LG, XL, and XXL (CUP_ALPHA_ORDER). Common aliases (small, med, medium, lg, large, x-large, 2xl) normalise to those. They convert identically across UK / EU / US / AU. Size.display shows MD / LG as M / L; raw stays MD / LG. Single-letter m and l are bra cup letters, so a feed that means alpha must send MD / LG (or medium / large) — do not persist the short display and parse it again. These labels are not rows on the letter chart. cup_attribute_values appends them after the chart letters for a locale, and cup_sort_key orders letters by chart row, then alpha from XXS to XXL.
Shoe sizes can also use alpha labels (XXS, XS, S, M, L, XL, XXL) on the existing shoe size types (adult-shoe, kids-shoe, baby-shoe). Common aliases (small, medium, large, x-large, 2xl) normalise to canonical tokens. These alpha labels convert identically across UK / EU / US / AU and are not rows on numeric charts. shoe_attribute_values(size_unit, age_group=..., gender=...) appends them after the chart values for that demographic.
Display language defaults to en-gb. A host application can register its own getter (Django's get_language, for example) with fashion_size.register_display_language.
Development
Install uv, then from the repo root:
uv sync
uv run pytest
uv run ruff check src tests
uv sync creates .venv and installs the package plus the locked dev group (pytest and ruff). .python-version pins Python 3.12 for local work; GitHub Actions runs uv sync --locked on Python 3.12–3.14. Commit changes to uv.lock when dev dependencies change.
Without uv: pip install -e ".[testing,development]" then run pytest and ruff as usual.
Releasing
Publishing uses PyPI trusted publishing. On PyPI, add a pending publisher for the fashion-size project:
- Owner:
ababic - Repository:
fashion-size - Workflow:
release.yml - Environment:
pypi
Create a GitHub environment named pypi (no secrets).
Version numbers (CalVer)
Releases use calendar versioning: YYYY.M.D (UTC date when the release is tagged), for example 2026.10.5. Git tags are v plus that string (v2026.10.5). The tag without the v must match fashion_size.__version__.
For a second release on the same UTC day, bump the micro segment: 2026.10.5.1 and tag v2026.10.5.1 (or use .post1 if you prefer PEP 440 post-releases).
Before tagging, bump src/fashion_size/__version__.py, update CHANGELOG.md, commit, then push the tag. The tagged commit must be on main or a branch named release-*. The workflow runs tests, checks that the tag matches the package version, builds wheels, creates a GitHub release, and publishes to PyPI. A tag whose commit is not on one of those branches fails before anything is published.
License
BSD 3-Clause. See LICENSE.
Metadata
Release files for fashion-size 2026.11.13.1
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 | Actions |
|---|---|---|---|---|
| fashion_size-2026.11.13.1.tar.gz | 100.7 kB | With provenance | Details for fashion_size-2026.11.13.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fashion_size-2026.11.13.1-py3-none-any.whl | Python 3 | none | any | Details for fashion_size-2026.11.13.1-py3-none-any.whl |
Total release size: 182.3 kB
Release files / fashion_size-2026.11.13.1.tar.gz
| Download URL | fashion_size-2026.11.13.1.tar.gz |
|---|---|
| Size | 100.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3ef080d5cb1e4466fd39e00f75f21cfff3006447ff512fc84d3b5cc24727282c
|
|
BLAKE2b-256 checksum How to use checksums |
d8913e32abf54cbb21080d20c60f452c9a4ef4736ff20f4faafb789713085405
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 13, 2026.
Transparency logRelease files / fashion_size-2026.11.13.1-py3-none-any.whl
| Download URL | fashion_size-2026.11.13.1-py3-none-any.whl |
|---|---|
| Size | 81.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fa3a30c043727499365b797b8649e5762f67bc18c67b5b8444d7f4f24ecc62dd
|
|
BLAKE2b-256 checksum How to use checksums |
68ed0961f031cd9623a31e24a6de12b2090b82ba6ffc3b200fb07f4cfce6e6b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 13, 2026.
Transparency logSecurity for fashion-size 2026.11.13.1
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
Both files in this release have been uploaded with provenance metadata.
Attestation for fashion_size-2026.11.13.1.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 Nov 13, 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.