promptkit 🧠
A lightweight Python toolkit for cleaning and preparing text before sending it to any LLM (GPT, Claude, Gemini, etc.)
Every AI developer copy-pastes these utilities across projects. Now you don't have to.
Installation
pip install promptkit
Functions
| Function | What it does |
|---|---|
clean(text) |
Removes extra spaces, repeated punctuation |
truncate_tokens(text, max_words) |
Trims text to stay within token limits |
remove_pii(text) |
Masks emails, phone numbers, URLs |
format_prompt(template, **kwargs) |
Safely fills prompt templates |
word_count(text) |
Returns word count of a string |
Usage
from promptkit import clean, truncate_tokens, remove_pii, format_prompt, word_count
# Clean messy input
clean(" Hello!!! World??? ")
# → "Hello! World?"
# Truncate to token budget
truncate_tokens("one two three four five", max_words=3)
# → "one two three..."
# Remove sensitive info before sending to external APIs
remove_pii("My email is john@gmail.com and number is 9876543210")
# → "My email is [EMAIL] and number is [PHONE]"
# Fill prompt templates safely
format_prompt("Summarize: {text}", text="Hello world")
# → "Summarize: Hello world"
# Quick word count
word_count("Hello world foo bar")
# → 4
Why promptkit?
- ✅ Zero dependencies — pure Python
- ✅ Works with any LLM — OpenAI, Anthropic, Google, local models
- ✅ PII removal keeps your users' data safe
- ✅ Token truncation saves API costs
License
MIT — free to use, modify, and distribute.
Release files for promptkit-1 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| promptkit_1-0.1.1.tar.gz | 3.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| promptkit_1-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.1 kB
Release files / promptkit_1-0.1.1.tar.gz
| Download URL | promptkit_1-0.1.1.tar.gz |
|---|---|
| Size | 3.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dae67f40cf86cfda1ef7677a93ef6d8f148c916965481a02562b70e9edbc5651
|
|
BLAKE2b-256 checksum How to use checksums |
a6fd36caf3f3bead65e3cef59098ab17638b71f45d6d71841f9dc28ec7d071ce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 4, 2026.
Transparency logRelease files / promptkit_1-0.1.1-py3-none-any.whl
| Download URL | promptkit_1-0.1.1-py3-none-any.whl |
|---|---|
| Size | 3.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
af538b3be3dfdc4309118b95d028b7052c41057e0985963c2bb6680c940cd224
|
|
BLAKE2b-256 checksum How to use checksums |
93e4b71cc09289c790166e66e0e3ccf333d096344a0ea4f95d4dd3be8425c103
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 4, 2026.
Transparency log