Skip to content

feat: add comprehensive tests, examples, and documentation#2

Merged
chaholl merged 1 commit intomainfrom
feature/tests-and-examples
Jan 21, 2026
Merged

feat: add comprehensive tests, examples, and documentation#2
chaholl merged 1 commit intomainfrom
feature/tests-and-examples

Conversation

@chaholl
Copy link
Contributor

@chaholl chaholl commented Jan 21, 2026

Summary

  • Add examples directory with practical usage examples demonstrating PromptPack Python functionality
  • Add comprehensive unit tests for multimodal, template, and validator functionality
  • Update CI pipeline with Python 3.13 support, linting, and coverage reporting
  • Add documentation for examples in Astro/Starlight docs site

Changes

Examples (examples/)

  • basic_usage.py - Loading packs, creating templates, formatting prompts with variables and fragments
  • tools_example.py - Tool conversion, handler binding, and LangChain integration
  • validation_example.py - Output validation with banned words, length limits, and regex patterns
  • packs/ - Example PromptPack JSON files (customer-support, sales-assistant)

Tests

  • test_multimodal.py - 19 new tests for multimodal content conversion (images, audio, video)
  • test_template.py - 11 new tests for model overrides, defaults, async support
  • test_validators.py - 10 new tests for multiple validators, edge cases

CI Pipeline (.github/workflows/ci.yml)

  • Add Python 3.13 to test matrix
  • Add linting for examples directory
  • Add coverage reporting with Codecov
  • Add examples verification job

Documentation (docs/)

  • Add Examples section with 4 detailed guides
  • Update quickstart with validation examples
  • Add Output Validation feature card to home page

Test plan

  • All 131 tests pass (60 promptpack + 71 promptpack-langchain)
  • Linting passes (ruff check and ruff format --check)
  • Type checking passes (mypy)
  • All examples run successfully
  • Docs build successfully

- Add examples directory with practical usage examples:
  - basic_usage.py: Loading packs, templates, and formatting
  - tools_example.py: Tool conversion and LangChain integration
  - validation_example.py: Output validation with various validators
  - Example PromptPack JSON files (customer-support, sales-assistant)

- Add comprehensive unit tests:
  - test_multimodal.py: 19 tests for multimodal content conversion
  - Enhanced test_template.py: Model overrides, defaults, async support
  - Enhanced test_validators.py: Multiple validators, edge cases

- Update CI pipeline (.github/workflows/ci.yml):
  - Add Python 3.13 to test matrix
  - Add linting for examples directory
  - Add coverage reporting with Codecov
  - Add examples verification job

- Update documentation (Astro/Starlight):
  - Add Examples section with 4 detailed guides
  - Update quickstart with validation examples
  - Add Output Validation feature card

- Configure ruff to allow print statements in examples

Test count: 131 tests (60 promptpack + 71 promptpack-langchain)
@chaholl chaholl merged commit b593dd4 into main Jan 21, 2026
6 checks passed
@chaholl chaholl deleted the feature/tests-and-examples branch January 21, 2026 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant