Development

Set up a working copy, run tests, and keep the codebase green.

Table of Contents

Clone and install

git clone https://github.com/rkriad585/Cowser
cd Cowser
pip install -e ".[dev]"

Running tests

python -m pytest

The suite covers the CLI, core rendering, config parsing, the animal registry (including an art linter), plugins/art packs, and a speech-bubble fuzz test.

Type checks

python -m mypy cowser

All public functions are fully type-hinted and must stay mypy-clean.

Docs site

pip install -e ".[docs]"
mkdocs serve

Open http://127.0.0.1:8000/ to preview. The site is also deployed automatically on every push to main by the docs.yml GitHub Actions workflow.

Adding an animal

Add a Cow to the COWS list in cowser/cows.py. Art may contain:

  • {eyes} — replaced by --eyes (default o o).
  • {tongue|default} — replaced by --tongue or a mode's preset.
Cow("my-cow", r"""   /\
  /  \
 | oo |
  ~~   ~~""", "misc", ("new",)),

Keep names lowercase slugs and give every cow a category and optional tags so --search works. The art linter in tests/test_library.py checks shape and token validity automatically.

Adding an art pack

No code needed — create a directory of art files:

my-cows/
├── dragon.art
└── sloth.txt
cowser --cow-dir ./my-cows "hello from my pack"

Each file becomes a cow named after its file stem. Classic cowsay .cow cowfiles are supported too. See configuration.md.

Building binaries

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

The single-file binary lands in dist/ (cowser.exe on Windows). See deployment.md.


← Back to README