Skip to main content

Cowser

Logo

A fun, cross-platform command-line tool that greets you with ASCII art animals. Inspired by cowsay, written in Python.

Features

  • 35+ animals across categories: cows, cats, dogs, birds, sea life, robots, mythical creatures and more
  • Greet users with a random animal, or pick one by name/index/prefix
  • Custom messages and piping from stdin
  • Configurable eyes (--eyes) and tongues (--tongue) on token-based art
  • cowsay-style modes (--mode dead, --think, ...)
  • Word wrapping for long messages (-W/--wrap, -n/--no-wrap)
  • Color themes: rainbow, bold, plus plain colored output
  • Fortune mode (--fortune) and two animals at once (--and)
  • Interactive REPL (--interactive)
  • Colored output (ANSI, works on modern Windows terminals)
  • Legacy-console fallback — output is automatically made printable for cp437/cmd.exe and other old codepages
  • Windows wrappers (cowser.cmd, cowser.ps1) and single-file binaries built with PyInstaller for Linux/macOS/Windows
  • Config file at ~/.config/neostore/cowser/config.toml
  • Usable as a library in your own Python code

Installation

Requires Python 3.8+.

pip install cowser

For color support on legacy Windows consoles (cmd.exe pre-Windows 10):

pip install cowser[color]

From source:

git clone https://github.com/rkriad585/Cowser
cd Cowser
pip install .

Usage

cowser Alice                 # greet with a random animal
cowser --cow owl Bob         # pick a specific animal
cowser --message "Hello!"    # custom message
echo "From stdin" | cowser   # pipe a message
cowser --mode dead --cow pig # mood preset (eyes + tongue)
cowser --think --cow owl "Where am I?"
cowser --rainbow --bold --message "Party time!"
cowser --fortune             # random fortune
cowser --cow dog --and cat "Best friends"
cowser --list                # show all animals
cowser --search mythical     # search by name, category, or tag
cowser --interactive         # chat REPL
 _________
/ Hi Bob! \
\__________/
   _____
  / o o \
 (   V   )
  \_____/

Options

Option Description
-c, --cow NAME_OR_INDEX Choose an animal by name, prefix, or index.
-e, --eyes CHARS Replace the {eyes} token in the art.
--mode MODE Preset style: borg, dead, greedy, paranoid, stoned, drunk, wired, youthful.
--tongue CHARS Replace the {tongue} token in the art.
--think Use a thought bubble instead of a speech bubble.
-W, --wrap WIDTH Word-wrap the message to WIDTH columns.
-n, --no-wrap Disable word wrapping.
--rainbow Colorize output line by line in rainbow order.
--bold Make the output bold.
--fortune Show a random fortune instead of a message.
--and NAME_OR_INDEX Render a second animal next to the first.
--interactive Start an interactive REPL session.
--seed INT Seed random selection for reproducible output.
-m, --message TEXT Show a custom message instead of a greeting.
-l, --list List all available animals.
--search TEXT List animals matching name, category, or tag.
--color COLOR Output color (default: cyan).
--no-color Disable colored output.
-V, --version Show version.
-h, --help Show help.

Legacy commands

Backwards-compatible with the original script:

python main.py Alice
python main.py help
python main.py list
./cowset Alice

Windows wrappers

On Windows, if python is on your PATH, use the bundled wrappers instead of installing anything extra:

cowser.cmd Alice
cowser.cmd --cow owl --message "Hello"
.\cowser.ps1 Alice
.\cowser.ps1 --think --cow owl "Where am I?"

Single-file binaries

Optional standalone binaries (no Python needed) are built with PyInstaller:

pip install -e ".[binary]"
python scripts/build_binary.py

The binary lands in dist/ (cowser.exe on Windows). CI also builds and attaches Linux/macOS/Windows binaries to every v* git tag.

Legacy consoles

When output cannot be encoded by the current console (e.g. cp437 cmd.exe), Cowser automatically replaces unsupported characters with readable ASCII — smart quotes, dashes, accents, and emoji all get a safe fallback.

Configuration

Defaults are read from ~/.config/neostore/cowser/config.toml. Command-line flags always win. See config.example.toml.

# ~/.config/neostore/cowser/config.toml
color = "green"
cow = "fish"
eyes = "o o"
# seed = 42

Using Cowser as a library

cowser (and its stable surface, cowser.api) exposes a pure, side-effect free API — no I/O — so it is safe to embed in other tools. All public functions are fully type-hinted and documented with examples.

from cowser import COWS, render, render_pair, register_cow, search_cows, Cow

print(render("Hello from my app", cow="owl", eyes="0.0"))
print(render("moo", cow="pig", mode="dead", think=True))
print(render_pair("best friends", "dog", "cat", rainbow=True))

for cow in search_cows(category="mythical"):
    print(cow.name, cow.tags)

register_cow(Cow("my-dragon", "   ~\n  (o.o)", category="mythical"))

The stable public surface is listed in cowser.api.__all__: Cow, COWS, render, render_pair, render_cow, build_speech_bubble, resolve_cow, search_cows, register_cow, substitute_eyes, substitute_tongue, and wrap_text. These names are covered by a backwards-compatibility guarantee.

Adding more animals

Open cowser/cows.py and add a Cow to the COWS list. Art may include an {eyes} token that --eyes replaces, and a {tongue|default} token that --tongue (or --mode) replaces:

Cow("my-cow", r"""   /\
  /  \
 | oo |
  ~~   ~~""", "misc", ("new",)),

Development

pip install -e ".[dev]"
python -m pytest
python -m mypy cowser

Tests and type checks run on Linux, macOS, and Windows via GitHub Actions.

License

MIT © 2026 rkriad585

Download files

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

Source Distribution

cowser-1.4.0.tar.gz (23.3 kB view details)

Uploaded Source

Built Distribution

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

cowser-1.4.0-py3-none-any.whl (18.2 kB view details)

Uploaded Python 3

File details

Details for the file cowser-1.4.0.tar.gz.

File metadata

  • Download URL: cowser-1.4.0.tar.gz
  • Upload date:
  • Size: 23.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.7

File hashes

Hashes for cowser-1.4.0.tar.gz
Algorithm Hash digest
SHA256 6692fb4dbee18fe66ed1778d9cd9b75ae2200b98b22b58df886db1ec0663e024
MD5 c6fef3d1de2fe74865010e86cab5100f
BLAKE2b-256 51ba42b2bb946ee4aa5272c3effb52d2315daaddaaa6fc0d815894a49850fccf

See more details on using hashes here.

File details

Details for the file cowser-1.4.0-py3-none-any.whl.

File metadata

  • Download URL: cowser-1.4.0-py3-none-any.whl
  • Upload date:
  • Size: 18.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.7

File hashes

Hashes for cowser-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4e7d8a8a7b7f582667bd6cc060d679a77f43303bec48d600b36f5bb6aed16abb
MD5 c9e9adcf2ff4b64b350476ff26d169d8
BLAKE2b-256 280e5088d8fd81659ae3c2f1b7486ea9bd217c6257e52948571166887b9b3a5e

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