Repository navigation
Description
Summary
PromptClient has no publish() method. PublishPrompt is available from the priompt CLI (priompt publish), promptctl and priompt/js-sdk (client.publish), and the generated Python stub already includes it, but Python users have to drop down to client._stub.PublishPrompt and build the request (including the slot list) by hand.
Impact
Python pipelines (evaluation jobs, notebooks, LangChain/LangGraph tooling) that want to publish a prompt version must use a private attribute and repeat promptctl's slot-derivation logic. Getting slots wrong fails server-side validation with template uses undeclared slots: ....
Steps to reproduce
pip install priompt-sdk- Run:
from priompt_sdk import PromptClient c = PromptClient(host="localhost:8443") c.publish("priompt://acme/onboarding/welcome", "Hi {name}, welcome to {org}!")
Actual: AttributeError: 'PromptClient' object has no attribute 'publish'
Expected behavior
resp = c.publish("priompt://acme/onboarding/welcome", "Hi {name}, welcome to {org}!",
message="friendlier greeting") # slots derived: ["name", "org"]
print(resp.version_hash)publish() sends PublishPromptRequest (uri, template, slots, message, branch), derives slots from {placeholders} when not given, and invalidates the client cache entry for that URI.
Where to look
priompt_sdk/client.py#L100-L150existingget/list/diffwrappers to followpriompt_sdk/client.py#L92-L97cache to invalidate after a publishpriompt_sdk/v1/prompt_pb2_grpc.py#L29-L33PublishPromptstub already generated- priompt/proto
proto/priompt/v1/prompt.proto#L157-L163PublishPromptRequestfields (message,branchoptional) - priompt/proto
validate/validate.go#L109the "undeclared slots" check - priompt/cli
cmd/promptctl/main.go#L373-L388deriveSlots(regex\{(\w+)\}, first-seen order, de-duplicated) - priompt/js-sdk
client.js#L181-L183the JS equivalent
Suggested approach
- Add
publish(self, uri, template, slots=None, message="", branch=""). - When
slots is None, derive them withre.findall(r"\{(\w+)\}", template)de-duplicated in order, matching promptctl. - Call
self._stub.PublishPrompt(...)with the client's metadata (and timeout, if one exists by then), thenself._cache.pop(uri, None)and drop any cachedlist()entries whose prefix matches the URI. - Document it in the README API list and the priompt-dot-com Python SDK page (which currently lists Publish as "No").
Acceptance criteria
-
PromptClient.publish()exists withslots,messageandbranchparameters and returns thePublishPromptResponse. - Slots are derived from the template when not passed; tests cover duplicates and no placeholders.
- A cached
get()for the URI is invalidated after publish (test with the fake stub intests/test_client.py). - README lists
publish().
Activity
techkayacodes commentedon Nov 15, 2026
Hi @sujal-maheshwari2004! Following up on your note on priompt/js-sdk#31, I'd love to take this help wanted issue on and implement publish() on PromptClient (along with unit tests in ests/). Could you assign this to me?
sujal-maheshwari2004 commentedon Nov 16, 2026
Hey @techkayacodes sure you can have it, can you please share your approach to solve the issue on a high level?
techkayacodes commentedon Nov 19, 2026
Thanks @sujal-maheshwari2004! Here's the high-level approach I have in mind for
PromptClient.publish():Method & gRPC wiring (
priompt_sdk/client.py)publish(self, uri, template, slots=None, message="", branch="")returningPublishPromptResponse.prompt_pb2.PublishPromptRequest(uri=uri, template=template, slots=..., message=message, branch=branch)and callself._stub.PublishPrompt(req, metadata=self._md).Slot derivation (
slots is None)slots is None(if an explicit list likeslots=[]is passed, forward it as-is).{{/}}) to matchvalidate.Slotsinpriompt/proto(so{{name}}isn't treated as a slot).Cache invalidation
urifromself._cacheand drop any cached("list", prefix)entries whereuri.startswith(prefix).get()andlist()servemain, would you prefer invalidating only whenbranch in ("", "main"), or unconditionally on everypublish()?Tests & Docs
FakeStubintests/test_client.pywithPublishPromptand add tests covering slot derivation (normal, duplicates, no placeholders, escaped{{...}}, explicitslots), request/metadata forwarding, and cache invalidation for bothget()andlist().publish()inREADME.md.Let me know if this looks good (and your preference on branch cache invalidation) and I'll get the PR ready once assigned!
sujal-maheshwari2004 commentedon Nov 19, 2026
@techkayacodes the issue is yours, The former would be much better suited for the service! (invalidating only when branch in ("", "main"))