This project has been archived by its maintainers, and is no longer receiving any updates.
curly-message
The Python implementation of the Curly Message Format.
{
"greeting": "Hello, {{name; default:Guest}}!",
"inbox": "You have {{count:number}} {{count:plural; one:message; other:messages}}."
}
Resolved at the locale en:
greeting {"name": "Alice"} -> "Hello, Alice!"
greeting {} -> "Hello, Guest!"
inbox {"count": 1} -> "You have 1 message."
inbox {"count": 1234} -> "You have 1,234 messages."
A placeholder may carry a modifier (:number, :date, :ago, :currency,
one of the comparisons eq, ne, lt, lte, gt, gte, or one of the
plural selections plural and ordinal), a set of options, and a default.
Resolving a message never raises: a modifier that cannot produce a result, a
value no conversion turns into text, or a modifier nobody registered resolves
the placeholder through its fallback chain, and is reported. The one exception
is a resolution host code asks for while another is in progress on the same
thread of execution, which raises ReentryLimitError past the bound on how
many may be, and may pass on the stack running out (Limits).
Installation
pip install curly-message # Core and Extensions, with no dependencies
pip install "curly-message[intl]" # and Intl, over Babel
A release candidate installs with pip install --pre curly-message.
The intl extra installs Babel 2.14 or later,
and tzdata for the zone database where the system has none. Intl is on
wherever such a Babel is installed, by this extra or by any other package
that depends on Babel: in an environment that carries one,
{{n:number}} formats rather than naming a modifier nobody registered.
levels() says which it is.
Usage
from curly_message import create_parser
parser = create_parser()
parser.resolve("Hello, {{name; default:Guest}}!", {"name": "Alice"})
# -> 'Hello, Alice!'
parser.resolve("You have {{count:number}} new messages.", {"count": 1234}, locale="en")
# -> 'You have 1,234 new messages.'
parser.resolve("{{gender:eq; male:He; female:She; default:They}} replied.", {"gender": "female"})
# -> 'She replied.'
number here, and currency below, are Intl modifiers: they format with the
intl extra installed, and without it they are modifiers nobody registered
(see Levels).
parser.resolve(message, payload=None, *, props=None, locale=None, message_id=None) takes the inputs resolution is defined over:
| Argument | Meaning |
|---|---|
payload |
The values the placeholders name, a dict. Its default entry is the message-wide fallback. |
props |
Per-call options for the modifiers, keyed by modifier name: {"currency": {"currency": "EUR"}}. A payload entry layers over them. |
locale |
The locale the formatting modifiers and the plural selections format for, as a BCP 47 tag. None is no locale. |
message_id |
The message's identifier. No step reads it; every report carries it. |
A payload entry that is a dict whose keys are only value, default and
props is a wrapper: it carries a value with its own default and its own
props. A caller holding untrusted data passes recognize_wrappers=False, and
every entry is read as a value.
parser.resolve(
"{{price:currency}}",
{"price": {"value": 12.5, "props": {"currency": {"currency": "USD"}}}},
locale="en",
)
# -> '$12.50'
The props of the Intl modifiers are ECMA-402's options, by their ECMA-402
names (maximumFractionDigits, dateStyle, timeZone, and so on).
Host-defined modifiers
def upper(given):
return given.value.upper()
parser = create_parser(custom_modifiers={"upper": upper})
parser.resolve("{{name:upper}}", {"name": "ada"})
# -> 'ADA'
A modifier receives a ModifierInput: value (text), options (the
placeholder's Options in source order, each with a key and a value),
props (a read-only Mapping composed from modifier_defaults, the call's
props and the wrapper's own, in that order, property by property; a
resolution reads each layer once for each modifier name and wrapper, so a
layer changed while it runs is read as it was, and every placeholder naming
the modifier over the same layers is handed the same object, which a modifier
that writes to it fails on as on any raise), locale
(exactly what the caller passed) and default (the placeholder's fallback,
computed where it is first read). A ModifierInput the modifier keeps
answers, after the resolution returned, what the resolution read of it: a
default or an option value first read then is the empty string, and
resolves, reports and runs nothing. The modifier's answer becomes text the
way a payload value does. None or UNDEFINED is no answer, and so is a
raise: the placeholder takes its fallback chain, and a raise is reported as
failed-modifier. A name registered here is looked up before the format's
own, so a host may replace eq or number.
def name(given):
return (
"".join(word[0] for word in given.value.split())
if given.props.get("short")
else given.value
)
parser = create_parser(custom_modifiers={"name": name}, modifier_defaults={"name": {"short": True}})
parser.resolve("{{who:name}}", {"who": "Ada Lovelace"})
# -> 'AL'
parser.resolve("{{who:name}}", {"who": "Ada Lovelace"}, props={"name": {"short": False}})
# -> 'Ada Lovelace'
Reports
reports = []
parser = create_parser(on_report=reports.append)
parser.resolve("{{n:shout; default:?}}", {"n": "a"}, message_id="greeting")
# -> '?'
reports[0].code, reports[0].origin, reports[0].text, reports[0].message_id
# -> ('unknown-modifier', 'message', '{{n:shout; default:?}}', 'greeting')
on_report is the only channel the parser reports through; nothing is
logged. A Report is read-only and carries code (one of the eight codes of
the specification's section 14.2), origin ("message", "payload" or
"limit"), message (an English sentence), text, message_id and limit
(the limit a limit code reached, else None). text is the placeholder that
reported, escaped as the body of a JSON string (its quotes, backslashes and
C0 control characters too) and, past 120 code points, cut there and ended
with ...: it is message text, never a payload value. It carries none of
the line terminators of section 6's line-term raw, as section 13 asks, and
escapes more than that section asks: also U+0085 and every other code point
the running CPython's str.splitlines breaks on, and every lone surrogate,
so a handler that splits lines Python's way or encodes to UTF-8 meets none.
Which further code points end a line is decided by whatever reads what the
handler writes, and escaping those is the handler's. A handler that raises
loses that report and nothing else.
Describing a message
from curly_message import cst
cst("Hi {{name}}")
# -> {'type': 'message', 'start': 0, 'end': 11, 'nodes': [
# {'type': 'text', 'start': 0, 'end': 3},
# {'type': 'placeholder', 'start': 3, 'end': 11, 'nodes': [
# {'type': 'open', 'start': 3, 'end': 5},
# {'type': 'key', 'start': 5, 'end': 9, 'name': 'name', 'nodes': [{'type': 'text', 'start': 5, 'end': 9}]},
# {'type': 'close', 'start': 9, 'end': 11}]}]}
cst describes a message as it is written: the tree of the specification's
CST.md, as plain
dicts and lists, so json.dumps(cst(message)) is its interchange
encoding. Spans are [start, end) in code points, the unit a Python str
is indexed in, so they index the str the caller holds. The placeholders it
finds are the ones resolution finds, because one scanner finds both.
Levels
With the intl extra installed:
from curly_message import levels
sorted(levels())
# -> ['core', 'extensions', 'intl']
This implementation satisfies Core and Extensions (host-defined
modifiers, props and wrappers) everywhere, and Intl where Babel 2.14 or
later is installed. levels() answers for the installation it runs in.
Without Intl, number, date, ago, currency, plural and ordinal are
modifier names nobody registered: {{n:number; default:-}} resolves to -
and reports unknown-modifier. import curly_message imports no Babel;
the first Intl call does. Where that import fails, as with a Babel missing
what the modifiers import, the placeholder that tried it reports
failed-modifier and takes its fallback chain; from then on the installation
satisfies no Intl, so levels() leaves it out and the six names report
unknown-modifier, as without Babel. A Babel whose installed release cannot
be read counts as not installed. A check or an import that fails to finish,
as on an exhausted stack, answers nothing for later calls, which ask again.
Limits
| Constant | Value | What it bounds |
|---|---|---|
MAX_OUTPUT_LENGTH |
100000 | code points a resolution writes from placeholders |
MAX_READ_LENGTH |
100000 | code points of value text a resolution reads |
MAX_CONVERSION_NODES |
100000 | nodes one conversion of a structured value visits |
MAX_NESTING |
8 | the deepest level at which a placeholder resolves |
Each keeps what a resolution costs bounded by the message rather than by the
payload, and each reports where it stops (section 13). One more bound is this
implementation's own: a serialization that writes more than 10 000 000 code
points is abandoned as one that reached the conversion limit, and its value
reports unserializable-value. The node limit bounds what a serialization
visits, not what it writes, and a list naming one long string many times
visits few nodes. JavaScript's serialization gives up the same way, at its
engine's longest string.
No depth stops a serialization before the node limit does: the serializer
keeps the containers it is inside on a stack of its own rather than
recursing, and each container it enters is a node. A list holding a
list, 100 000 levels deep, serializes (and its 200 000 code points then
reach the output limit); 100 001 levels deep, it reaches the conversion
limit and reports unserializable-value.
None of them bounds str(). A value of any type but dict and list
converts by its own str() (Values), which costs what that type's own
code costs, and its text is read whole before the read limit is tested: a
list subclass holding the one below it twice, twenty levels deep over the
string x, writes 7 340 028 code points. json.loads builds no such
value, so only a type the application built reaches it.
Nor does any of them count the work done on what a modifier is handed before it answers (section 13). Here is what that work grows with:
- Padding around an option's value or an inline default is dropped where the placeholder is parsed. Only the padding is read, from either end, so the cost grows with the padding's length. It is paid once each time the walk reaches the placeholder: a modifier that reads an option twice is answered from one render.
- An option key is converted to a number by
lt,gt,lte,gte,pluralandordinal. Each converts the keys it compares at each call, by stripping the format's whitespace and reading the rest as a number. So the cost grows with the length of each key, once per option and placeholder. - Props are composed once per resolution for each modifier name. A
wrapper whose props configure that name composes once more, with its own
entries laid over that composition rather than copied. The Intl
modifiers read their request off a composition once, and convert each
property text they read as a number then: once, or twice for
minimumFractionDigitsundernumberandpluralwhere the composition names nomaximumFractionDigits. So composing grows with the entries the layers hold under that name, and reading with the length of each such text, at most twice per composition. Both are paid once per composition: one for each name, and one more for each wrapper that configures it, never one per placeholder. Where 200 wrappers each configurenumber, a text of the call props is converted 200 times, or 400 for aminimumFractionDigitswith no maximum named. A host-defined modifier is handed the composition and reads what it reads.
Nor does any of them bound a resolution that reaches itself (section 13).
MAX_REENTRY, 16, does: it is how many resolutions may be in progress at
once on one thread, and it stands in for the interpreter's recursion limit.
A resolution host code asks for while another is in progress on its thread
takes a place until it returns. One asked for while MAX_REENTRY are in
progress there reads nothing and raises ReentryLimitError, a
RecursionError, in the host code that asked. That code may handle it; where
it lets it pass, it is contained as any failure of host code is: a modifier's
placeholder fails as failed-modifier, a value's conversion as
unserializable-value, and either takes its fallback chain. A resolution
asked for on a thread where none is in progress is never refused.
A read of an option value or of a default takes a place too, for as long
as it renders, unless the modifier it was handed to is current: from its call
until it returns, through whatever code runs beneath it (a conversion, a
report handler, a resolution that code asks for), but not while a modifier
called beneath it runs, nor while its placeholder's default or one of its
option values renders, nor while one of another placeholder's option values
or its default, whose production began beneath that modifier's call, is in
progress on that thread. So the modifier's own reads are free, except that
such a read is counted as well. A free read is the walk itself, one level deeper, and
MAX_NESTING bounds it. Any other read (of what a modifier kept from another
placeholder, or handed to other code) renders at the depth of the placeholder
that wrote it, however many such reads stand one inside another, so a flat
message could stack as many as it has placeholders. One that would count past
MAX_REENTRY is refused: it renders nothing and is the empty string, and it
fails nothing, so the modifier, conversion or report handler that made it goes
on with the empty string and what it then answers is taken as any answer is.
The next read of the same option or default renders it afresh. The bound is on
reads in progress at once: reads made one after another each give their place
back.
A read of an option value or of a default that is itself rendering on
the same thread (host code called while it renders asked for it again) is
refused at once, whatever the count: it is the empty string, as above, and
the render in progress goes on to its own answer. One that another thread is
rendering waits for that render and answers what it gave, counting nothing;
a wait host code keeps from ending, by waiting on the reader in turn, is that
code's.
The bound is sized to the interpreter's default recursion limit. A read in
progress stands three frames on the interpreter's stack: the modifier that
made it, the read, and the step of the walk that called the modifier
(CPython 3.11 counts a fourth toward its limit). A resolution in progress
can stand under the MAX_NESTING - 1 reads a modifier makes of what it was
handed, and costs at most seven frames more than a read, so the deepest
chain the two bounds allow stands 16 * (7 * 4 + 7) = 560 frames. What is
guaranteed is this: where the interpreter has 600 frames left when the
caller asks, which the default limit of 1000 leaves a caller up to 400
frames deep, every such chain is answered by MAX_REENTRY and
MAX_NESTING and never by the interpreter's limit, as long as each
modifier in it is one frame deep. The frames a modifier stands beneath
itself, in calls of its own, are added to that for every read or resolution
it has in progress, and are not counted here; nor is the import of Babel
that the first Intl call makes.
The interpreter's own limit may still arrive first, where the host calls
with fewer frames left than that, lowers sys.setrecursionlimit or stands
frames of its own in the chain, and CPython raises
RecursionError. That is contained where it lands: the placeholder whose
modifier or value it reaches fails as failed-modifier or
unserializable-value and takes its fallback chain. Where it lands in the
walk of a resolution host code asked for while another is in progress on the
same thread of execution (a thread or a fiber), that resolution lets it pass,
as it does MemoryError, to the host code that asked, so the placeholder
that called that code takes its fallback chain; where it lands in the
containment's own work, that placeholder answers "". The resolution the
caller asked for, on a thread of execution where none is in progress, never
raises: it answers its text, or "" where its own walk ran out. The report
is made on the same exhausted stack, so it may not reach the handler.
Values
The specification reads every value as text (section 4). In Python:
-
Noneis the host's null: a value, present, which converts to"None". A value nobody supplied is spelled by leaving the entry out, or bycurly_message.UNDEFINED, which means the same. Idiomatic Python hands overNonewhere nothing was meant, so prefercatalogue.get(key, UNDEFINED)tocatalogue.get(key), and leave an entry out rather than setting it toNone:from curly_message import UNDEFINED parser.resolve("{{v; default:none}}", {"v": None}) # -> 'None' parser.resolve("{{v; default:none}}", {"v": UNDEFINED}) # -> 'none' catalogue = {"greeting": "Hello, {{name; default:Guest}}!"} parser.resolve(catalogue.get("farewell")) # -> 'None' parser.resolve(catalogue.get("farewell", UNDEFINED)) # -> ''
-
Plain objects and arrays are exactly
dictandlist, the typesjson.loadsproduces. One converts to compact JSON ({"a":1,"b":[true,null]}), its members serialized byjson's rules, except that a member holdingUNDEFINEDis left out of its object and an element holding it is writtennull, as ECMAScript writes undefined. Any other value converts bystr(): atuple, adictsubclass, a dataclass, adatetime, aDecimal. A value whose conversion raises, or a structurejsoncannot serialize, is undescribable, and reportsunserializable-value. -
Only
dictstorage holds entries. A payload, a props layer, a wrapper and the registry are read throughdict's own methods, so a subclass's__getitem__,getor__missing__never runs, and no entry is ever read as an attribute ({{__class__}}is a missing key). Any other mapping holds no entries: passdict(chain_map), not aChainMapor aMappingProxyType. -
boolis not a number:Trueconverts to"True". -
eqandnelowercase both sides withstr.lower(), the full Unicode mapping of the running CPython's Unicode version: 14.0 on 3.11, 15.0 on 3.12, 15.1 on 3.13, 16.0 on 3.14, 17.0 on 3.15. A code point assigned since compares differently across versions.
Dates
date reads its value as text. Text that is a finite number is
milliseconds since the epoch; any other text is read by the running
CPython's datetime.fromisoformat, which reads more than ISO 8601 and does
not read the same on every release:
- Every supported release reads what
str()writes for adatetimeor adate, and ISO 8601's calendar and week dates, alone or with a time, in the extended or the basic form (2024-03-05T10:00:00.000Z,2024-03-05 10:00+01:00,20240305T100000Z,2024-W10-2): the time may stop at the hour or the minute, the seconds may carry a fraction after a point or a comma, and an offset isZor a sign with hours, then optionally minutes and seconds, with or without colons, its seconds too with a fraction (+01:00:30.5). After a time that ends without a fraction, a space may stand before the offset:2024-03-05 10:00:00 +0100, as git writes it, is 10:00 at+01:00. - Every supported release also reads text that is not ISO 8601, and not
always as it looks. Two cases, among others:
- a date and a time joined by a character other than
T, a space or a digit, a sign among them, so a date followed by a signed offset is a time of that day, in the local zone:2024-03-05x10:00is 10:00, and2024-03-05+01:00is 01:00 local time, not midnight at+01:00(a date followed byZis no date); - an extended week date that names its day, followed directly by a digit,
is that week's Monday, the text from the day on read as its time, and no
date where that text is no time:
2024-W10-201000is the Monday at 20:10,2024-W10-21the Monday at 21:00, and2024-W10-51no date.
- a date and a time joined by a character other than
- Whether other text is a date, and which instant it is, is the running
release's to decide, and releases differ on some of it: from Python 3.14
the hour
24:00is the next day's midnight; before 3.14 a fraction directly after an hour or a minute, of the time or of the offset, is read as a fraction of a second (10.5is 10:00:00.5, not ISO 8601's 10:30), where from 3.14 such text is no date; and a point or a comma before an offset (2024-03-05T10:00:00.+01:00) is read by some releases and not by others, within one minor line too (3.13.0 reads it, 3.13.16 does not). - No release reads a lowercase
zas an offset (2024-03-05T10:00z), an ordinal date (2024-065), a leap second (23:59:60), a month alone (2024-03) or text whose instant depends on the day it is read (next monday). A bare date in the basic form (20240305) is a number, so milliseconds.
A naive date and time, and a bare date, are local time: a bare date is local
midnight, where ECMAScript reads it as UTC. The local zone is the one the C
library reads, and where it comes from is decided once per process, at the
first date: from TZ where it is set, a
zone of the database by its name and anything else, a file or a POSIX rule,
by the C library itself, and otherwise from /etc/localtime, UTC where
there is none. A zone of the database or of /etc/localtime stays the
local zone for the rest of the process; a zone the C library reads in TZ
follows the C library's current setting, so a later time.tzset() moves it.
Babel's babel.localtime names the zone /etc/localtime holds where it is
that zone's own file. On Windows the local zone is Babel's reading of the
registry (below), fixed at the first date.
Python's datetime spans the years 1 to 9999; a value outside them is one
date cannot format, and takes the fallback chain.
Locales
A locale is read with CLDR's aliases and likely subtags (zh-TW is
Traditional Chinese, iw is Hebrew), and a tag Babel holds no data for is
cut back one subtag at a time (en-ZZ reads as English). und reads as the
root locale. A tag nothing of which Babel holds (zz) fails the modifier,
and the placeholder takes its fallback chain: there is no fallback to a
default locale, which would make the output depend on the environment.
A request is judged by ECMA-402's rules before Babel is asked, so what
ECMA-402 refuses fails the modifier however lenient Babel would be, and the
placeholder takes its fallback chain: a tag that is not a structurally valid
Unicode BCP 47 locale identifier, UTS #35's unicode_bcp47_locale_id as
ECMA-402 reads one (en_US, i-klingon, x-private, root), an option an
ECMA-402 constructor refuses (maximumFractionDigits: 200, the unit
style with no unit, a timeZone that names no zone or offset), and, for
currency, a currency code that is not three ASCII letters (US) or no
code at all, which Babel would write as US10.00 or with the generic
currency sign. A well-formed code that names no currency is written as itself
(XYZ10.00), as ECMA-402 writes it, but without ICU's currency spacing (see
What Babel cannot express).
What Babel cannot express
Section 11.2 lets a host's facility lack a property. Babel lacks these, and a request that names one formats with the rest:
| Facility | Properties |
|---|---|
NumberFormat |
numberingSystem |
RelativeTimeFormat |
numberingSystem |
DateTimeFormat |
calendar, numberingSystem, timeZoneName, fractionalSecondDigits |
Every locale renders Latin digits, a locale whose CLDR default is another
numbering system included: ar-EG writes 1,234.5. Every date is written
in the Gregorian calendar, a locale whose CLDR default is another calendar
included: the first day of 1970 is 1970/1/1 in fa and 1/1/1970 in
th, where ICU writes the Persian ۱۳۴۸/۱۰/۱۱ and the Buddhist 1/1/2513.
Babel's locale data
also differs from ICU's in places, which section 11.2 does not count against
an implementation:
- CLDR's
minimumGroupingDigitsis not applied:eswrites 1234 as1.234, where ICU writes1234. - There is no currency spacing: with
currencyDisplay: "code",enwritesEUR12.50where ICU writesEUR 12.50, with a no-break space. - There are no relative-day phrases:
numeric: "auto"writes1 day agowhere ICU writesyesterday. - Long and full date styles with a time join them with the plain glue
(
Tuesday, March 5, 2024, 3:00 PM), not ICU'satform. - The plural operands of a number at or above 1e28 follow its exact digits.
- A zone the locale names nothing for is written in CLDR's localized GMT
format, as ICU writes it (
GMT+1,GMT+5:30,UTC+9infr), but Babel carries no hour format, so every locale writes the offset as an ASCII sign and hours and minutes joined by a colon, inside the format's own text as Babel holds it: the minus sign is ASCII where a locale writes another (frwrites U+2212), the separator is a colon where a locale writes another (fi,da,idandslwrite+5.30), a negative offset follows the format's text directly wherehrwritesGMT -1, and the direction markheandfawrite before the sign is left out, while one the format's text holds is kept (hewritesGMT+1and U+200E, where ICU writesGMT, U+200E,+1and U+200E). The zero offset is the format with nothing in it (GMT). - Babel's metazones carry no dates, so it names a zone by the metazone it
belongs to today at any instant. Before 1970 no metazone names a zone, as
ICU names none there: a zone takes the name the locale gives that zone
itself where it gives one (
British Summer Timefor London in 1938,HSTfor Honolulu,Coordinated Universal Timefor UTC and each of its links), and is written in the localized GMT format otherwise (GMT-4:56:02for New York in 1874). From 1970 a zone takes the name it has today, which can name an offset it did not have: London in 1970, at GMT+1 all year, isGreenwich Mean Timein thefullstyle andGMTin thelongone, where ICU writesGMT+01:00andGMT+1. - Babel names zones ICU does not:
frwritesHNEfor New York where ICU writes the localized GMT format,TUfor UTC where ICU writesUTC, andGMTfor London in winter where ICU writesUTC. - A
TZnaming no zone of the database is read by the C library, as Python'stimemodule reads it: a file (/usr/share/zoneinfo/Asia/Tokyo,Asia//Tokyo) or a POSIX rule, transitions included.CET-1CEST,M3.5.0,M10.5.0/3isGMT+1in winter andGMT+2in summer,JST-9isGMT+9, and a rule naming daylight saving time but no dates takes the C library's (EST5EDT4isGMT-5in winter andGMT-4in summer, on the dates of the United States). ATZthe C library reads nothing from is offset zero, writtenGMT, as ICU writes it: an emptyTZ, a misspelled name (Europe/Pargue), a file that does not exist, and from Python 3.13 a directory of the database (TZ=Europe). An offset of a day or more, which nodatetimeholds, is offset zero at the instants it applies to:ABC-24isGMT, andABC-23DEF,M3.5.0,M10.5.0isGMT+23in winter andGMTin summer. - ICU reads
TZalike for an offset or a file, but reads a rule naming daylight saving time, an offset with minutes (IST-5:30) or a name in angle brackets (<+05>-5) as the zone/etc/localtimeholds, whatever the rule names. It shows an offset of a day or more at that offset with no zone name, and names a few abbreviations at offset zero by a zone's name: in thelongstyle and thefullone (PSTisPSTandPacific Standard Time), or in thefullstyle alone (JSTisJapan Standard Time), where this package writesGMT. - A zone read from a file or a rule, which no identifier names, is written
in the localized GMT format (
GMT+9, andGMT+09:00in thefullstyle). WithTZunset, an/etc/localtimecopied from the database rather than linked to it is named only where Babel finds that zone's name beside it, in/etc/timezone; ICU finds the name by searching the database (Japan Standard Time). An/etc/localtimethat holds no zone, a damaged one included, is UTC, as ICU reads it. - A
TZnaming a file that holds no zone or a directory (TZ=/etc, and on Python 3.11 and 3.12 a directory of the database,TZ=Europe), with Babel before 2.16 aTZthatzoneinforefuses as a key (Asia//Tokyo, or an absolute path to no file), and, withTZunset, an/etc/localtimethat holds no zone where nothing beside it names one, keep Babel from loading any locale data: it reads the local zone asbabel.datesis imported, and its locale data importsbabel.dates. The first Intl placeholder reportsfailed-modifier, and the installation then satisfies no Intl (Levels), where Node formats as ever: inGMTfor a directory, and in UTC for a file that holds no zone. - On Windows
TZis not read, as Babel reads none, and where Babel maps the registry's zone to none, the local zone is the standard offsettime.timezonereads, without daylight saving time.
Supported Pythons
CPython 3.11, 3.12, 3.13, 3.14 and 3.15, on Linux, macOS and Windows. PyPy and free-threaded builds are not claimed.
The package ships py.typed, and its types are checked against the built
wheel as a consumer's checker sees them. They compute nothing over what a
caller passes, so there is no type-level cost to measure.
Status
This package implements curly-message-3, version 3 of the
Curly Message Format, which the
specification states is stable: within that version, what a message resolves
to does not change. The specification is normative: where this
implementation and the specification disagree, this implementation is wrong.
The specification's conformance set holds it to that: the adapter of section
14.3 lives in tests/conformance/adapter.py, and the tests run every case the
set ships against it, at every level and over the tree of CST.md, but the five
that hand over a modifier's layer of props refusing to be read. This package
reads props from a dict, whose entry raises only where a lookup by a name
its key collides with reads it, never where its storage is enumerated. It
looks a layer up in the props by the modifier's name, so the one case whose
props themselves refuse runs, and it enumerates the layer itself, which no
dict entry can refuse, but for the digit entries plural looks up by name
in the number layer. The adapter states 15 as the bound on counted reads:
MAX_REENTRY counts the resolutions in progress with them, and the
resolution a read is made in holds one of its places. It states as well that
the bound counts a resolution asked for inside another, since one asked for
past it raises ReentryLimitError rather than resolving.
Development
From this directory, with uv:
uv sync --locked --extra intl
uv run --no-project tasks.py test # builds, lints, typechecks the source and the wheel, then the suite on both
uv run --no-project tasks.py test-core # the same suite, without the intl extra
uv run --no-project tasks.py test-lowest # the same suite, over Babel 2.14.0
uv run --no-project tasks.py test-sdist # builds, then runs the sdist's own test in the tree it unpacks to
uv run --no-project tasks.py lint-fix # applies what the lint only reports
uv run --no-project tasks.py bench-venv && node bench/harness.mjs # measures what the build costs
node bench/harness.mjs --compare ../other/python # the same, beside another checkout's build
The benchmark needs Node.js 22 or newer.
License
Metadata
Release files for curly-message 1.0.0rc0
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 |
|---|---|---|---|---|
| curly_message-1.0.0rc0.tar.gz | 321.3 kB | With provenance | Details for curly_message-1.0.0rc0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| curly_message-1.0.0rc0-py3-none-any.whl | Python 3 | none | any | Details for curly_message-1.0.0rc0-py3-none-any.whl |
Total release size: 401.1 kB
Release files / curly_message-1.0.0rc0.tar.gz
| Download URL | curly_message-1.0.0rc0.tar.gz |
|---|---|
| Size | 321.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bad39ca1ecd7bbe8e25f0f0f490e2e4a570d1f231fa0ae0bd811e1e62f7b6876
|
|
BLAKE2b-256 checksum How to use checksums |
9ce1fff77e7f2aba25797d8e5f0a986df5ac789451f520f696a9ac217fa81dfc
|
| 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 Nov 24, 2026.
Transparency logRelease files / curly_message-1.0.0rc0-py3-none-any.whl
| Download URL | curly_message-1.0.0rc0-py3-none-any.whl |
|---|---|
| Size | 79.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5ef22f62a93be918954bd3fbb74b1c1482f0e3d96a417367c0b1b139d547b066
|
|
BLAKE2b-256 checksum How to use checksums |
6533b279c571e5b232f06380e86cfd5d9588f11353de002221095beeaa456c18
|
| 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 Nov 24, 2026.
Transparency logSecurity for curly-message 1.0.0rc0
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 curly_message-1.0.0rc0.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 24, 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.