cnice
Formulaic correspondence phrases: salutations and valedictions for every covered locale.
cnice is a facade over two deterministic correspondence libraries:
salutations (cnice.greet, previously the German-only cgreet repo) and
locale-specific valedictions (cnice.farewell, previously cfarewell).
One matcher renders every language from table rows — a new language is a
new row, never new code. Same input always yields the same output:
no models, no I/O.
import { farewell, greet } from '@corbet-labs/cnice';
greet.salutation('de-ch', 'Frau Dr. Müller');
// Sehr geehrte Frau Dr. Müller
greet.salutation('fr', 'Madame Dupont');
// Madame Dupont,
farewell.closing('de-ch');
// Freundliche Grüsse
Install
Version 0.1.0 has not yet been published to registries; the commands below resolve once published. A source manifest alone does not establish publication.
| Environment | Command |
|---|---|
| Rust / Cargo | cargo add cnice |
| Python / pip | python -m pip install cnice |
| Python / uv | uv add cnice |
| Node.js / npm | npm install @corbet-labs/cnice |
| pnpm | pnpm add @corbet-labs/cnice |
| Yarn | yarn add @corbet-labs/cnice |
| Bun | bun add @corbet-labs/cnice |
| Deno | deno add npm:@corbet-labs/cnice |
| Typst | #import "@preview/cnice:0.1.0": * |
The JavaScript distribution includes compiled ESM, CommonJS, TypeScript declarations, and a standalone browser module. Node.js 20+ is supported; no TypeScript loader is required.
// CommonJS
const { greet, farewell } = require('@corbet-labs/cnice');
<script type="module">
import { greet } from 'https://cdn.jsdelivr.net/npm/@corbet-labs/cnice@0.1.0/dist/browser.js';
console.log(greet.salutation('de-ch', 'Frau Dr. Müller'));
</script>
See the installation guide for CLI commands and other distribution options. JSR installation is documented there too.
Rust
use cnice::{farewell, greet};
assert_eq!(greet::salutation("de-ch", "Frau Dr. Müller"), "Sehr geehrte Frau Dr. Müller");
assert_eq!(greet::salutation("fr", "Madame Dupont"), "Madame Dupont,");
assert_eq!(farewell::closing("de-ch", None), "Freundliche Grüsse");
Python
from cnice import farewell, greet
assert greet.salutation("de-ch", "Frau Dr. Müller") == 'Sehr geehrte Frau Dr. Müller'
assert greet.salutation("fr", "Madame Dupont") == 'Madame Dupont,'
assert farewell.closing("de-ch") == 'Freundliche Grüsse'
The Python CLI accepts bare and namespaced function names and writes JSON to stdout:
cnice greet.salutation '["de-ch", "Frau Dr. Müller"]'
cnice closing '["de-ch"]'
python -m cnice --help
API
| Function | Purpose |
|---|---|
greet.salutation / greet.salutation / greet.salutation |
Complete salutation for any covered locale |
greet.salutationHonorific, greet.salutationTitles, greet.salutationSurname |
Parse explicitly supplied recipient details (locale-keyed) |
greet.isSupported / greet.is_supported / greet.is-supported |
Whether a locale has a salutation row |
greet.recipientSalutationWarning, greet.honorificWarning |
Report incomplete input |
farewell.closing(locale, override?) |
Resolve a valediction; even an empty override wins |
farewell.availableLocales() / farewell.available_locales() / farewell.available-locales() |
List the canonical locale codes |
Covered salutation locales: de, de-ch, de-at, de-li, fr, it,
rm, en, en-gb, en-us. Comma behavior, title precedence and formal
fallbacks are row data, identical on every port. A recognized Professor
title takes precedence over Dr. Missing honorifics or surnames produce the
formal fallback. The library does not infer a person’s gender from their
name. Valediction lookups are case-insensitive and resolve the exact
locale, then its base language, then English; an explicit override always
wins.
Correspondence family
| Library | Responsibility |
|---|---|
| cletter | Compose the correspondence helpers |
| cnice | Formulaic salutations and valedictions (this repo: cnice.greet + cnice.farewell) |
| cdate | Calendar-date formatting |
| cink | Handwritten signature images |
| cgrade | Planned correspondence helper |
| cnumber | Number formatting with Swiss amtlich mode |
| cbcp | Planned correspondence helper |
Development
Behavior is defined by the locale tables and shared conformance vectors. Rust, JavaScript, Python, and Typst run the same vectors (74 greet + 57 farewell = 131). Selected CI checks exercise installed JavaScript tarballs, Python wheels and command-line entrypoints, and Typst packages. Release validation records the actual runtime and platform; Linux results do not establish native Windows or macOS coverage. All crates forbid unsafe code in their own source.
See the release guide for generation, verification, and publication commands.
License
Copyright 2026 Julian Y. Richard Corbet. The 0.1.0 release line is licensed
under LGPL-3.0-only
WITH LGPL-3.0-linking-exception,
with the incorporated GPL version 3.
Combined works may link statically or dynamically without relinking duties;
library modifications stay LGPL. Applications can use a different license
subject to the LGPL's conditions.
The cgreet and cfarewell repositories keep their own release grants
untouched; this facade does not relicense them.
See the licensing notes for distribution conditions and retained notices.
Release files for cnice 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 | |
|---|---|---|---|
| cnice-0.1.0.tar.gz | 41.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cnice-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 83.9 kB
Release files / cnice-0.1.0.tar.gz
| Download URL | cnice-0.1.0.tar.gz |
|---|---|
| Size | 41.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6977b8f8855ee7cae2ec7d41d2b2ea70d724a87a5e5fe515ce8b0f2bf4cce420
|
|
BLAKE2b-256 checksum How to use checksums |
68a2b2d038e0a99e42442f56b6f1621ba1bb08319a3bf0a2f405a3cc6b163fde
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.15 {"installer":{"name":"uv","version":"0.12.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"CachyOS Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / cnice-0.1.0-py3-none-any.whl
| Download URL | cnice-0.1.0-py3-none-any.whl |
|---|---|
| Size | 42.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b5b095909811a3bbbd0ae1248f86d007b01c479d4df3f7133e032024256c0f07
|
|
BLAKE2b-256 checksum How to use checksums |
bf6ee14de727e2ee19f49a78a01bdd0fbdb270e300b9b09bc31901351c5b4535
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.15 {"installer":{"name":"uv","version":"0.12.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"CachyOS Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|