pixie-prompts 0.1.3__py3-none-any.whl → 0.1.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
pixie/prompts/server.py CHANGED
@@ -4,11 +4,15 @@ import argparse
4
4
  import os
5
5
  import colorlog
6
6
  import logging
7
- from urllib.parse import quote
7
+ import webbrowser
8
+ import threading
9
+ import time
10
+
8
11
 
9
12
  import dotenv
10
- from fastapi import FastAPI
13
+ from fastapi import FastAPI, Request, Response
11
14
  from fastapi.middleware.cors import CORSMiddleware
15
+ import httpx
12
16
  from strawberry.fastapi import GraphQLRouter
13
17
  import uvicorn
14
18
 
@@ -120,13 +124,41 @@ def create_app() -> FastAPI:
120
124
 
121
125
  app.include_router(graphql_app, prefix="/graphql")
122
126
 
123
- @app.get("/")
124
- async def root():
125
- return {
126
- "message": "Pixie Prompts Dev Server",
127
- "graphiql": "/graphql",
128
- "version": "0.1.0",
129
- }
127
+ REMOTE_URL = "https://gopixie.ai"
128
+
129
+ @app.api_route("/{path:path}", methods=["GET", "POST", "PUT", "DELETE", "PATCH"])
130
+ async def proxy_all(request: Request, path: str):
131
+ url = f"{REMOTE_URL}/{path}"
132
+ if request.url.query:
133
+ url += f"?{request.url.query}"
134
+
135
+ logger.debug("Proxying request to: %s", url)
136
+
137
+ async with httpx.AsyncClient(follow_redirects=True, timeout=30.0) as client:
138
+ response = await client.request(
139
+ method=request.method,
140
+ url=url,
141
+ headers={
142
+ k: v
143
+ for k, v in request.headers.items()
144
+ if k.lower() not in ["host"]
145
+ },
146
+ content=await request.body(),
147
+ )
148
+
149
+ # Explicitly remove compression-related headers
150
+ headers = {
151
+ k: v
152
+ for k, v in response.headers.items()
153
+ if k.lower()
154
+ not in ["content-encoding", "content-length", "transfer-encoding"]
155
+ }
156
+
157
+ return Response(
158
+ content=response.content,
159
+ status_code=response.status_code,
160
+ headers=headers,
161
+ )
130
162
 
131
163
  return app
132
164
 
@@ -163,18 +195,25 @@ def start_server(
163
195
  logger.info("GraphQL: %s/graphql", server_url)
164
196
 
165
197
  # Display gopixie.ai web link
166
- encoded_url = quote(f"{server_url}/graphql", safe="")
167
- pixie_web_url = f"https://gopixie.ai?url={encoded_url}"
198
+ # encoded_url = quote(f"{server_url}/graphql", safe="")
199
+ # pixie_web_url = f"https://gopixie.ai?url={encoded_url}"
168
200
  logger.info("")
169
201
  logger.info("=" * 60)
170
202
  logger.info("")
171
- logger.info("🎨 Open Pixie Web UI:")
203
+ logger.info("🎨 Pixie Web UI:")
172
204
  logger.info("")
173
- logger.info(" %s", pixie_web_url)
205
+ logger.info(" %s", server_url)
174
206
  logger.info("")
175
207
  logger.info("=" * 60)
176
208
  logger.info("")
177
209
 
210
+ # Open browser after a short delay (in a separate thread)
211
+ def open_browser():
212
+ time.sleep(1.5) # Wait for server to start
213
+ webbrowser.open(server_url)
214
+
215
+ threading.Thread(target=open_browser, daemon=True).start()
216
+
178
217
  uvicorn.run(
179
218
  "pixie.prompts.server:create_app",
180
219
  host=host,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pixie-prompts
3
- Version: 0.1.3
3
+ Version: 0.1.5
4
4
  Summary: Code-first, type-safe prompt management
5
5
  License: MIT
6
6
  License-File: LICENSE
@@ -15,6 +15,7 @@ Classifier: Programming Language :: Python :: 3.12
15
15
  Classifier: Programming Language :: Python :: 3.13
16
16
  Classifier: Programming Language :: Python :: 3.14
17
17
  Provides-Extra: server
18
+ Requires-Dist: brotli (>=1.2.0,<2.0.0) ; extra == "server"
18
19
  Requires-Dist: colorlog (>=6.10.1) ; extra == "server"
19
20
  Requires-Dist: dotenv (>=0.9.9) ; extra == "server"
20
21
  Requires-Dist: fastapi (>=0.128.0) ; extra == "server"
@@ -3,11 +3,11 @@ pixie/prompts/file_watcher.py,sha256=YujSP6vo6clkKY_Bwh5faS_EtIupNOZDzEwrOgIwjew
3
3
  pixie/prompts/graphql.py,sha256=SG0u9rZxxv7yseuk1s3c_iyiCv_Sg3gF5f20G4DzuBw,11801
4
4
  pixie/prompts/prompt.py,sha256=7nBn1PCXNOVL6OflHak7MG9rlZ4Ooa14eTamYk2mE3I,11472
5
5
  pixie/prompts/prompt_management.py,sha256=gq5Eklqy2_Sq8jATVae4eANNmyFE8s8a9cedxWs2P_Y,2816
6
- pixie/prompts/server.py,sha256=_BsPfE_VJTvqNOaJPf14LXT-ubYRWbNi1NPFvAgXi5s,6433
6
+ pixie/prompts/server.py,sha256=VXUxOjt7MQA6G06fRLXdFu0fyBkRXbO4RP4xtO7F_AU,7758
7
7
  pixie/prompts/storage.py,sha256=syVHO5IWZXtN20ozPoBq_Anbu0NAH056EWbvlNNWLGU,14448
8
8
  pixie/prompts/utils.py,sha256=ssAb4HdwZX__Fq50i2-DFsYXD5vpsYEliA_XI8GPx3Y,21929
9
- pixie_prompts-0.1.3.dist-info/METADATA,sha256=BY2OjQDH2ccZlihWIzVaRAB79h9zsZ8WntLr3vW98Y4,1541
10
- pixie_prompts-0.1.3.dist-info/WHEEL,sha256=3ny-bZhpXrU6vSQ1UPG34FoxZBp3lVcvK0LkgUz6VLk,88
11
- pixie_prompts-0.1.3.dist-info/entry_points.txt,sha256=SWOSFuUXDxkJMmf28u7E0Go_LcEpofz7NAlV70Cp8Es,48
12
- pixie_prompts-0.1.3.dist-info/licenses/LICENSE,sha256=nZoehBpdSXe6iTF2ZWzM-fgXdXECUZ0J8LrW_1tBwyk,1064
13
- pixie_prompts-0.1.3.dist-info/RECORD,,
9
+ pixie_prompts-0.1.5.dist-info/METADATA,sha256=tQnHw7ZMAuuaCYla0CT2h_RMOuiiDCkYQQWxICQFzuQ,1600
10
+ pixie_prompts-0.1.5.dist-info/WHEEL,sha256=3ny-bZhpXrU6vSQ1UPG34FoxZBp3lVcvK0LkgUz6VLk,88
11
+ pixie_prompts-0.1.5.dist-info/entry_points.txt,sha256=SWOSFuUXDxkJMmf28u7E0Go_LcEpofz7NAlV70Cp8Es,48
12
+ pixie_prompts-0.1.5.dist-info/licenses/LICENSE,sha256=nZoehBpdSXe6iTF2ZWzM-fgXdXECUZ0J8LrW_1tBwyk,1064
13
+ pixie_prompts-0.1.5.dist-info/RECORD,,