Our take
- Activity
- 19
- Community
- 4
- Issues
- 21
- Pull requests
- 20
+1 stars in the last 30 days
- Fewer contributors than 91% of the projects we track
Project history
Daily GitHub snapshots since Oct 7, 2026. History covers stars and forks; health signals are not tracked historically.
Stars
66Forks
2Change since Nov 17, 2026: 0 stars·0 forks
Overview
PyPriompt is a Python port of Priompt, a prompt-design library inspired by component-based web frameworks. It lets developers build prompts as reusable Python components and uses priorities to decide which content to include when a prompt must fit a token budget.
It is most useful when prompt contents have different levels of importance, such as in long conversations or prompts assembled from files. It renders chat messages or a string, with tokenization configured for the target model.
Key Features
- Build prompts from custom components and standard system, user, and assistant message components.
- Set absolute or relative priorities for content so lower-priority sections can be omitted to meet a token limit.
- Use
Firstto provide priority-based fallbacks, andEmptyto reserve space for generation. - Add images and tool schemas to prompts with
ImageandToolscomponents. - Isolate sections with their own token limits, or force token breaks with
Br. - Capture and parse rendered output, and configure common generation properties with
Config. - Use inclusion and exclusion callbacks or source maps to inspect which prompt components were rendered.
Use Cases
- Chat application developers can keep system instructions and the latest user message while trimming older conversation history.
- AI application developers can include long files or other context selectively, favoring the most relevant sections when the token budget is tight.
- Prompt designers can reserve tokens for generated responses and provide fallback text when larger content does not fit.
- Teams debugging prompt changes can use source maps to trace rendered text back to its component, including when investigating cache misses.
Getting Started
Install the package with pip install priompt. See the README for usage examples and details.
Alternatives
- POML: POML uses markup to structure and integrate prompt content, rather than selecting reusable components by priority to fit a token limit.
| Project | Language | License | Stars | Status |
|---|---|---|---|---|
| py-priompt | Python | Other | 65 | Not checked yet |
| poml | TypeScript | MIT | 5k | Quiet |
Considerations
The README notes that the original test suite passes, but this port was produced in a day with AI assistance and may contain bugs. It also lists Capture, Tool, and Tools behavior and compatibility with priompt-preview as items to verify. The renderer may not always find the exact optimal priority cutoff, and performance is described as reasonable for around 10K scopes. Prompts built with many priorities can also be difficult to cache effectively.
Found this useful?
Share it with someone who would like py-priompt.