Skip to main content

Generate memorable, rhyming passphrases with an interactive terminal picker.

Project description

rhymepass

Generate memorable, rhyming passphrases from the CMU Pronouncing Dictionary, with an interactive terminal picker.

The underground parade / an undelivered accolade / 38
My yearning tailor / its xenial whaler / 67
Those nimble amyloid / such gentle android / 16

Each passphrase is a rhyming couplet built from real English words, padded with light filler words, plus two random digits. Readable, pronounceable, easy to transcribe, and awkward to guess.

Need raw entropy instead - say, for a legacy field that caps at 8 characters, or anywhere a memorable phrase is overkill? Press m in the picker to flip into random mode: the same UX in violet, generating fixed-length passwords drawn from a curated, shell-/HTTP-safe character set.

KvR3@m,Lp9-T_eXq.j2bA:cN8
H§p.7-eR4z@nQ,sB

Install

From PyPI:

pip install rhymepass

With uv:

uv pip install rhymepass

Or as a development checkout:

git clone https://github.com/synmux/rhymepass.git
cd rhymepass
uv sync
uv run rhymepass

Requires Python 3.11 or newer. Clipboard copy works on macOS (via pbcopy), Linux (via wl-copy, xclip, or xsel — install one through your package manager if none are present), and Windows (via clip).

Usage

Two commands land the same tool on your $PATH:

  • rhymepass - the canonical name.
  • rp - a short alias.

In a terminal

rhymepass            # picker, 5 rhyming phrases (default)
rhymepass -n 10      # picker with 10 phrases
rhymepass 24         # picker, rhymes no longer than 24 chars
rhymepass --help     # full option summary
rhymepass --version  # print the installed version

Every interactive picker control is also reachable as a CLI flag. The flags become the opening state of the picker (or the configuration of the one-shot pipe path); inside the picker, the same controls remain available as key bindings.

Option What it does
LIMIT Length constraint (positional form of -l). Rhyme mode: maximum total length, must be 0 (no limit) or ≥ 9. Random mode: exact length, must be 0 (default 24) or the number of enabled classes.
-n, --count N How many passphrases to generate. Default 5, must be ≥ 1.
-m, --mode {rhyme,random} Generation mode. rhyme (default) builds memorable couplets; random builds fixed-length passwords from a curated character set.
-l, --limit N Length constraint. Rhyme mode: maximum total length, must be 0 (no limit) or ≥ 9. Random mode: exact length, must be 0 (default 24) or the number of enabled classes.
--spaces / --no-spaces Show or hide interior spaces in rhyme output. Defaults to showing spaces. No-op in random mode.
-c, --classes CSV Comma-separated random-mode character classes. Choose any non-empty subset of upper,lower,digits,safe,all. Defaults to upper,lower,digits,safe. Rejected in rhyme mode.
--interactive / --no-interactive Force the picker on or off. By default the picker is shown when stdout is a TTY.
-v, --version Print the installed version and exit.
-h, --help Print the help summary and exit.

A few common one-liners:

rhymepass --mode random -n 1                       # one 24-char random password
rhymepass -m random -l 16 -n 5                     # five 16-char random passwords
rhymepass -m random -c upper,digits -n 8           # eight uppercase+digit passwords
rhymepass -m random -c upper,lower,digits,all -n 1 # one max-entropy password
rhymepass -n 3 --no-spaces | pbcopy                # rhymes with no interior spaces
rhymepass -l 24 -n 5                               # five rhymes, each ≤ 24 chars
rhymepass 24 -n 5                                  # five rhymes, each ≤ 24 chars (positional limit)
rhymepass -m random 16                             # five 16-char random passwords (positional limit)

In the picker

When stdout is a TTY (and --no-interactive is not set), rhymepass opens an interactive picker. Use the arrow keys to highlight a passphrase, then press enter - the selected passphrase is copied to your clipboard and the tool exits. CLI flags become the opening state, so rhymepass --mode random --limit 32 --classes upper,digits opens directly in random mode at limit 32 with that charset; the keys below still mutate the state interactively.

Key What it does
/ Move the highlight.
enter Copy the highlighted passphrase and exit.
x Toggle whether spaces are shown (rhyme mode only). The per-row character count and the strength indicator both update to reflect the displayed form, since that is the password you would actually copy. The character limit, however, is always enforced against the spaced form, so toggling is safe.
l Prompt for a character limit. 0 means no limit (the default). In rhyme mode the minimum is 9 characters ("Abcd / 12"); in random mode the minimum drops to 4. The batch regenerates so every passphrase fits the new limit.
m Toggle between rhyme mode (memorable couplets, the default) and random mode (fixed-length passwords from a–z A–Z 0–9 @-_.,:§). Random mode flips the accent colour to violet so it is always obvious which mode is active.
15 Random mode only. Toggle character classes used by the random generator. [1] Upper, [2] Lower, [3] Digits, [4] Safe symbols (@-_.,:§), [5] All symbols (the safe set plus more dangerous symbols). Enabling 5 auto-enables 4; disabling 4 auto-disables 5. The charset bar at the top shows the current state and the batch regenerates instantly on every toggle.
r Regenerate the batch with the current settings.
esc / q Exit without copying anything.

Each row in the picker ends with a strength indicator built from zxcvbn. The score (04) is rendered as an emoji followed by " | " and a one-to-five star run:

Score Indicator
0 🤮 | ⭐
1 ☹️ | ⭐⭐
2 🫤 | ⭐⭐⭐
3 😀 | ⭐⭐⭐⭐
4 🥳 | ⭐⭐⭐⭐⭐

Under a tight character budget the picker first drops filler words from the rhyming couplet, then (below ~16 characters) falls back to a single-statement form like Half dally / 17. The " / NN" two-digit suffix is always preserved.

In random mode the limit is interpreted as the exact length (with 0 meaning the default of 24). Every output is guaranteed to contain at least one character from each currently-enabled class, with the remaining slots drawn uniformly from the union of those classes and the final order shuffled with secrets.SystemRandom. The "safe symbols" set is @-_.,:§ - characters that have no special meaning in shells, URLs, regex, or common form-validation rules - so generated passwords paste cleanly into command lines, web forms, and config files without quoting. The "all symbols" toggle extends that with every other ASCII punctuation character (! " # $ % & ' ( ) * + / ; < = > ? [ \ ] ^ \ { | } ~`) for cases where the receiving system accepts the full set and you want maximum entropy.

The minimum length the modal accepts in random mode is the number of currently-enabled character classes (since each one contributes a guaranteed character): one class lets you go as low as 1. Because the "safe symbols" and "all symbols" sets share a single slot (enabling 5 supersedes 4), the most distinct classes you can have active at once is four, so the minimum tops out at 4.

Weak-strength warning. When a character limit is active in rhyme mode, the generator walks progressively shorter output forms to fit each couplet under the cap, narrowing the phonetic and lexical choices at each step. If any passphrase in the current batch scores 4 stars or below (zxcvbn score ≤ 3), the picker shows a warning toast suggesting you switch to random mode (press m). In random mode the limit is the exact output length, so every character position contributes uniformly to entropy and the tradeoff disappears.

In a pipe

When stdout is not a TTY, rhymepass skips the picker and just prints one passphrase per line. The interactive Textual dependency is never imported on this path, so pipe invocations start fast and stay light.

The strength indicator is written to stderr, one line per passphrase, while passphrases themselves go to stdout. Pipes and redirections that consume stdout therefore receive only the password, while an attached terminal still sees the indicators interleaved. If stderr is also redirected away from a TTY (for example rhymepass -n 5 > file 2>/dev/null), scoring is skipped entirely - no wasted zxcvbn work for output nobody will see.

When --limit is active in rhyme mode and any passphrase in the batch scores 4 stars or below, an additional warning line is written to stderr (unconditionally - not gated on whether stderr is a TTY) suggesting --mode random as an alternative. stdout is unaffected; the passphrase lines remain clean.

rhymepass -n 3 | cat
# stdout (visible to cat):
#   Those nimble amyloid / such gentle android / 16
#   Our bold missourian / some hopeful centurion / 84
#   Any tactile contemn / much calm condemn / 84
# stderr (visible only on the terminal):
#   🥳 | ⭐⭐⭐⭐⭐
#   🥳 | ⭐⭐⭐⭐⭐
#   🥳 | ⭐⭐⭐⭐⭐

stdout therefore contains exactly count lines (the value of --count / -n), each a complete passphrase, with no header, blank lines, or other metadata. rhymepass -n 5 | head -1 is guaranteed to return the first passphrase.

You can also use the positional form to constrain length while piping, e.g. rhymepass 24 | cat (up to 5 rhymes each ≤24 chars).

As a library

from rhymepass import (
    ALL_SYMBOLS,
    DEFAULT_RANDOM_LEN,
    DIGITS,
    LOWERCASE,
    SAFE_SYMBOLS,
    UPPERCASE,
    build_anchor_pool,
    format_strength,
    generate,
    generate_random,
    load_real_words,
    score_passphrase,
)

# Rhyming flavour
real_words = load_real_words()
pool = build_anchor_pool(real_words)

phrase = generate(pool, real_words)              # no length limit
print(generate(pool, real_words, limit=24))      # fit under 24 characters

score = score_passphrase(phrase)                 # 0..4 from zxcvbn
print(phrase, "|", format_strength(score))       # "<phrase> | 🥳 | ⭐⭐⭐⭐⭐"

# Random flavour - default classes (a-z, A-Z, 0-9, SAFE_SYMBOLS)
print(SAFE_SYMBOLS)                              # "@-_.,:§"
print(generate_random())                         # DEFAULT_RANDOM_LEN (24) chars
print(generate_random(length=12))                # exactly 12 chars

# Custom classes - pick any non-empty subset
print(generate_random(length=8, classes=(UPPERCASE, DIGITS)))   # uppercase + digits only
print(generate_random(length=24, classes=(LOWERCASE, UPPERCASE, DIGITS, ALL_SYMBOLS)))

load_real_words and build_anchor_pool are comparatively expensive; call them once per process and reuse the result for as many generate calls as you need. score_passphrase is fast (a few milliseconds per call) and safe to invoke per generation.

How it works

Anchor words come from the intersection of two dictionaries:

  • the CMU Pronouncing Dictionary (via pronouncing) for phonetic rhymes and syllable counts,
  • the GNU Collaborative International Dictionary of English (via english-words) to exclude proper nouns, abbreviations, and obscure entries.

For every passphrase, rhymepass picks a random anchor, looks up phonetic rhymes, filters them through the same quality checks, and assembles two phrases by wrapping each anchor in zero, one, or two filler words drawn from a hand-curated list of determiners (the, some, every, …) and adjectives (nimble, radiant, zesty, …). A two-digit suffix (1099) is appended to each passphrase.

All random choices use secrets rather than random, so the output is suitable for use as an actual passphrase - though you should still pair it with whatever additional entropy your threat model demands.

When a character limit is set, the generator descends through progressively shorter output forms for the same anchor before giving up and drawing a new one, so common limits (20–30 characters) succeed in a few attempts. See AGENTS.md for the exact descent strategy.

Dependencies

  • pronouncing ≥ 0.3.0 - CMU Pronouncing Dictionary bindings.
  • english-words ≥ 2.0.2 - GCIDE word set for filtering.
  • textual ≥ 0.80 - terminal UI. Only imported on the interactive path.
  • zxcvbn ≥ 4.5.0 - realistic password-strength scoring used by the indicator.

See pyproject.toml for the exact pin set; the lock file covers transitive dependencies.

Limitations

  • Clipboard requires a platform helper binary. macOS ships pbcopy out of the box and Windows ships clip since Vista, so both work without extra setup. On Linux you need one of wl-copy (from the wl-clipboard package, preferred on Wayland), xclip, or xsel. If none are available, the picker raises RuntimeError with a message naming the options; the generator itself (and the pipe/library paths) work without any clipboard tool.
  • No history. Each run produces a fresh batch; nothing is persisted between invocations.

Contributing

For architecture, internal conventions, and the complete list of gotchas, see AGENTS.md. Run the test suite with:

uv sync --extra dev
uv run pytest

Bug reports, feature ideas, and pull requests are welcome at https://github.com/synmux/rhymepass.

Licence

MIT - see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rhymepass-0.1.2.tar.gz (73.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rhymepass-0.1.2-py3-none-any.whl (42.0 kB view details)

Uploaded Python 3

File details

Details for the file rhymepass-0.1.2.tar.gz.

File metadata

  • Download URL: rhymepass-0.1.2.tar.gz
  • Upload date:
  • Size: 73.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for rhymepass-0.1.2.tar.gz
Algorithm Hash digest
SHA256 e461c0b9770e270bc6c02db0710657fb66ef1870987287964e30e5c19afa2b41
MD5 c2a1b4f00315847b420315a75de1f570
BLAKE2b-256 4e237b6102f5f587f9775510d19961c4781a3eaade6e6b00d3de5bee7729cca7

See more details on using hashes here.

File details

Details for the file rhymepass-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: rhymepass-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 42.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for rhymepass-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 23302eb327e3c1db40cbea44d03f1ff4da056f4ab871446561d8a57d69cb2392
MD5 c5913db107e990fbf53fba0df88f1b54
BLAKE2b-256 ed8bc7598ae5124b97f7c2f3c71593f361a510532f669cd964b3463d6ed3d608

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page