problee 0.1.2__tar.gz → 0.2.4__tar.gz

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.
Files changed (37) hide show
  1. problee-0.2.4/LICENSE +21 -0
  2. problee-0.2.4/PKG-INFO +219 -0
  3. problee-0.2.4/README.md +179 -0
  4. problee-0.2.4/problee/__init__.py +43 -0
  5. problee-0.2.4/problee/_generated/__init__.py +4 -0
  6. problee-0.2.4/problee/_generated/client.py +2791 -0
  7. problee-0.2.4/problee/_generated/models/__init__.py +7 -0
  8. problee-0.2.4/problee/api/__init__.py +13 -0
  9. problee-0.2.4/problee/api/markets.py +119 -0
  10. problee-0.2.4/problee/api/positions.py +49 -0
  11. problee-0.2.4/problee/api/quotes.py +93 -0
  12. problee-0.2.4/problee/client.py +283 -0
  13. problee-0.2.4/problee/exceptions.py +103 -0
  14. problee-0.2.4/problee/models/__init__.py +25 -0
  15. problee-0.2.4/problee/models/market.py +156 -0
  16. problee-0.2.4/problee/models/position.py +51 -0
  17. problee-0.2.4/problee/models/quote.py +65 -0
  18. problee-0.2.4/problee/py.typed +1 -0
  19. problee-0.2.4/problee/streaming/__init__.py +11 -0
  20. problee-0.2.4/problee/streaming/sse.py +123 -0
  21. problee-0.2.4/problee/streaming/websocket.py +198 -0
  22. problee-0.2.4/problee.egg-info/PKG-INFO +219 -0
  23. problee-0.2.4/problee.egg-info/SOURCES.txt +29 -0
  24. problee-0.2.4/problee.egg-info/requires.txt +16 -0
  25. problee-0.2.4/pyproject.toml +86 -0
  26. problee-0.2.4/setup.py +6 -0
  27. problee-0.2.4/tests/test_client.py +284 -0
  28. problee-0.2.4/tests/test_generated_client.py +51 -0
  29. problee-0.1.2/PKG-INFO +0 -29
  30. problee-0.1.2/README.md +0 -9
  31. problee-0.1.2/problee/__init__.py +0 -3
  32. problee-0.1.2/problee.egg-info/PKG-INFO +0 -29
  33. problee-0.1.2/problee.egg-info/SOURCES.txt +0 -7
  34. problee-0.1.2/pyproject.toml +0 -30
  35. {problee-0.1.2 → problee-0.2.4}/problee.egg-info/dependency_links.txt +0 -0
  36. {problee-0.1.2 → problee-0.2.4}/problee.egg-info/top_level.txt +0 -0
  37. {problee-0.1.2 → problee-0.2.4}/setup.cfg +0 -0
problee-0.2.4/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Problee
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
problee-0.2.4/PKG-INFO ADDED
@@ -0,0 +1,219 @@
1
+ Metadata-Version: 2.4
2
+ Name: problee
3
+ Version: 0.2.4
4
+ Summary: Python SDK for the Problee Agent API
5
+ Author-email: Problee <dev@problee.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://problee.com
8
+ Project-URL: Documentation, https://api.problee.com/api/agent/v1/openapi.json
9
+ Project-URL: Repository, https://github.com/probleeprotocol/problee/tree/main/sdk/python
10
+ Project-URL: Changelog, https://github.com/probleeprotocol/problee/tree/main/sdk/python
11
+ Keywords: problee,prediction-market,api,sdk,trading,world-chain
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.8
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
+ Classifier: Typing :: Typed
23
+ Requires-Python: >=3.8
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: requests>=2.28.0
27
+ Provides-Extra: websocket
28
+ Requires-Dist: websockets>=10.0; extra == "websocket"
29
+ Provides-Extra: all
30
+ Requires-Dist: websockets>=10.0; extra == "all"
31
+ Provides-Extra: dev
32
+ Requires-Dist: build>=1.2.1; extra == "dev"
33
+ Requires-Dist: pytest>=7.0; extra == "dev"
34
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
35
+ Requires-Dist: mypy>=1.0; extra == "dev"
36
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
37
+ Requires-Dist: responses>=0.23.0; extra == "dev"
38
+ Requires-Dist: twine>=5.1.0; extra == "dev"
39
+ Dynamic: license-file
40
+
41
+ # Problee Python SDK
42
+
43
+ Python client for the Problee Agent API.
44
+
45
+ > The package releases with the lockstep SDK surface. The generated Agent API
46
+ > client lives under `client.generated`; historical `/api/v1` helpers remain
47
+ > for compatibility while new agent-native endpoints track the public Agent API
48
+ > contract.
49
+ >
50
+ > Builder trading status: Python is not the current hosted-checkout/widget
51
+ > distribution path. Browser partners should use `/v3/embed.js`, the generated
52
+ > Builder OpenAPI at `https://api.problee.com/api/builder/v1/openapi.json`, or
53
+ > the lockstep npm packages.
54
+
55
+ ## Installation
56
+
57
+ ```sh
58
+ python -m pip install problee
59
+ ```
60
+
61
+ ## Generated Agent API
62
+
63
+ Every agent-surface route in the shared contract catalog is available through
64
+ the generated namespace:
65
+
66
+ ```python
67
+ from problee import ProbClient
68
+
69
+ client = ProbClient(api_key="pk_...")
70
+
71
+ markets = client.generated.discovery.get_discover_markets(
72
+ query={"search": "world cup", "pageSize": 5}
73
+ )
74
+
75
+ surface = client.generated.content.post_markets_by_address_surface(
76
+ params={"address": "0xabc..."},
77
+ body={"chainId": 480, "kind": "note", "data": {"text": "Liquidity update"}},
78
+ idempotency_key="surface-0xabc-1",
79
+ )
80
+ ```
81
+
82
+ Write operations generated from non-idempotent contracts require an
83
+ `idempotency_key` keyword argument and send `Idempotency-Key`.
84
+
85
+ Regenerate the client from the route contracts:
86
+
87
+ ```sh
88
+ pnpm python:generate
89
+ pnpm python:check-drift
90
+ ```
91
+
92
+ Validate the Python package locally before publishing:
93
+
94
+ ```sh
95
+ pnpm python:smoke
96
+ ```
97
+
98
+ The smoke creates a clean virtualenv, installs pinned build tooling, builds
99
+ sdist + wheel, runs `twine check`, installs the wheel, and verifies
100
+ `problee.__version__`, `py.typed`, User-Agent, and generated-client imports.
101
+
102
+ ## Compatibility Helpers
103
+
104
+ - **Markets API**: legacy list/filter/detail helpers over `/api/v1`
105
+ - **Positions API**: legacy wallet position reads
106
+ - **Quotes API**: legacy quote and transaction-build helpers, not the current
107
+ Builder checkout path
108
+ - **SSE Streaming**: legacy market price stream client
109
+ - **WebSocket**: legacy market update client
110
+
111
+ The compatibility helpers do not expose the current BuilderIntegration model,
112
+ trade-token flow, hosted checkout sessions, widget launcher, or Builder OpenAPI
113
+ contracts.
114
+
115
+ Creator agents can publish semantic market enrichment through the Agent API:
116
+
117
+ ```http
118
+ POST https://api.problee.com/api/agent/v1/markets/{address}/surface
119
+ Authorization: Bearer <api-key>
120
+ Idempotency-Key: <unique-key>
121
+ Content-Type: application/json
122
+
123
+ {
124
+ "chainId": 480,
125
+ "kind": "price_chart",
126
+ "source": "Binance",
127
+ "sourceTimestamp": 1778880000000,
128
+ "data": {
129
+ "symbol": "BTC",
130
+ "latest": { "timestamp": 1778880000000, "value": 103240.12 },
131
+ "unit": "USD"
132
+ }
133
+ }
134
+ ```
135
+
136
+ `note` uses content retention. `price_chart`, `scoreboard`, and `ticker` use
137
+ bounded live-state retention with TTL, source metadata, coalescing, and stale
138
+ update rejection.
139
+
140
+ Creator agents can also read creator funds, including market balance and PRB
141
+ creation bond actions, at:
142
+
143
+ ```http
144
+ GET https://api.problee.com/api/agent/v1/trade/creator-funds
145
+ Authorization: Bearer <api-key>
146
+ ```
147
+
148
+ Omit `chainId` for all enabled trading chains, or pass `?chainId=480` /
149
+ `?chainId=8453`. The response separates market balance from the PRB
150
+ creation bond; market balance is not a guaranteed seed refund.
151
+
152
+ Market creation supports two models on the Agent API:
153
+
154
+ - Auto-priced market is the default; omit `pricingModel`.
155
+ - Order book market is explicit; send `pricingModel: "ORDERBOOK"` for binary
156
+ order book markets with live depth and trader-set prices.
157
+
158
+ Creation payloads must include top-level `resolutionCriteria` (20-4000 chars)
159
+ as the human-readable settlement contract. Keep `resolutionSource` as opaque
160
+ source metadata with a required `type`; deprecated `resolutionSource.rules` may
161
+ mirror `resolutionCriteria`, but conflicting values are rejected.
162
+
163
+ MCP wallet-proof note: tools that require wallet authority use the same
164
+ action-bound challenge as the TypeScript helpers. Build the canonical
165
+ `problee-mcp-auth:...` message yourself (exact field order), including tool name, scope, chain/resource,
166
+ payload hash, timestamp, and single-use `proofNonce` from
167
+ `POST /api/auth/nonce`. Python callers should mirror that exact string until
168
+ the helper is ported into this SDK.
169
+
170
+ Error handling: API Problem Details responses are preserved on exceptions.
171
+ `ProbError.code` is the canonical API code when present, and
172
+ `ProbError.response` carries the full response body including `requestId`,
173
+ field-level `errors`, and public extension fields.
174
+
175
+ ## Current Builder Attribution
176
+
177
+ This Python client is not the public browser-trading attribution model. Current
178
+ builder trading attribution uses
179
+ `BuilderIntegration.publicIntegrationId`, verified origins, nonce-bound trade
180
+ tokens, and hosted checkout sessions. Do not put server API keys or this Python
181
+ client inside a browser application.
182
+
183
+ ## API Documentation
184
+
185
+ Current machine-readable contracts:
186
+
187
+ - Agent/server API: https://api.problee.com/api/agent/v1/openapi.json
188
+ - Builder Trading API: https://api.problee.com/api/builder/v1/openapi.json
189
+ - Public consumer allowlist: https://api.problee.com/api/v1/openapi.json
190
+
191
+ Lifecycle note: current market read contracts expose `lifecycleState` as the
192
+ exact canonical enum from `MarketInstance.lifecycleState` and `phase` as the
193
+ coarse public projection. OpenAPI documents those wire shapes; it does not own
194
+ the lifecycle truth. The legacy `status` field is only a compatibility bucket.
195
+
196
+ Dispute note: current challenge/dispute surfaces expose the required PRB stake
197
+ and returned transaction target. Use the returned `disputeAction` fields as the
198
+ public contract; deprecated stake aliases are compatibility fields only.
199
+
200
+ ## Release
201
+
202
+ Do not publish from an operator laptop. PyPI `problee` is published by the
203
+ canonical release workflow after the Version Packages PR is merged.
204
+
205
+ Local validation:
206
+
207
+ ```sh
208
+ pnpm python:generate
209
+ pnpm python:check-drift
210
+ python3 -m pytest sdk/python/tests
211
+ pnpm python:smoke
212
+ ```
213
+
214
+ `pnpm release:version` synchronizes `pyproject.toml`, source fallback
215
+ versioning, and this package's changelog from the lockstep npm SDK version.
216
+
217
+ ## License
218
+
219
+ MIT License - see LICENSE file for details.
@@ -0,0 +1,179 @@
1
+ # Problee Python SDK
2
+
3
+ Python client for the Problee Agent API.
4
+
5
+ > The package releases with the lockstep SDK surface. The generated Agent API
6
+ > client lives under `client.generated`; historical `/api/v1` helpers remain
7
+ > for compatibility while new agent-native endpoints track the public Agent API
8
+ > contract.
9
+ >
10
+ > Builder trading status: Python is not the current hosted-checkout/widget
11
+ > distribution path. Browser partners should use `/v3/embed.js`, the generated
12
+ > Builder OpenAPI at `https://api.problee.com/api/builder/v1/openapi.json`, or
13
+ > the lockstep npm packages.
14
+
15
+ ## Installation
16
+
17
+ ```sh
18
+ python -m pip install problee
19
+ ```
20
+
21
+ ## Generated Agent API
22
+
23
+ Every agent-surface route in the shared contract catalog is available through
24
+ the generated namespace:
25
+
26
+ ```python
27
+ from problee import ProbClient
28
+
29
+ client = ProbClient(api_key="pk_...")
30
+
31
+ markets = client.generated.discovery.get_discover_markets(
32
+ query={"search": "world cup", "pageSize": 5}
33
+ )
34
+
35
+ surface = client.generated.content.post_markets_by_address_surface(
36
+ params={"address": "0xabc..."},
37
+ body={"chainId": 480, "kind": "note", "data": {"text": "Liquidity update"}},
38
+ idempotency_key="surface-0xabc-1",
39
+ )
40
+ ```
41
+
42
+ Write operations generated from non-idempotent contracts require an
43
+ `idempotency_key` keyword argument and send `Idempotency-Key`.
44
+
45
+ Regenerate the client from the route contracts:
46
+
47
+ ```sh
48
+ pnpm python:generate
49
+ pnpm python:check-drift
50
+ ```
51
+
52
+ Validate the Python package locally before publishing:
53
+
54
+ ```sh
55
+ pnpm python:smoke
56
+ ```
57
+
58
+ The smoke creates a clean virtualenv, installs pinned build tooling, builds
59
+ sdist + wheel, runs `twine check`, installs the wheel, and verifies
60
+ `problee.__version__`, `py.typed`, User-Agent, and generated-client imports.
61
+
62
+ ## Compatibility Helpers
63
+
64
+ - **Markets API**: legacy list/filter/detail helpers over `/api/v1`
65
+ - **Positions API**: legacy wallet position reads
66
+ - **Quotes API**: legacy quote and transaction-build helpers, not the current
67
+ Builder checkout path
68
+ - **SSE Streaming**: legacy market price stream client
69
+ - **WebSocket**: legacy market update client
70
+
71
+ The compatibility helpers do not expose the current BuilderIntegration model,
72
+ trade-token flow, hosted checkout sessions, widget launcher, or Builder OpenAPI
73
+ contracts.
74
+
75
+ Creator agents can publish semantic market enrichment through the Agent API:
76
+
77
+ ```http
78
+ POST https://api.problee.com/api/agent/v1/markets/{address}/surface
79
+ Authorization: Bearer <api-key>
80
+ Idempotency-Key: <unique-key>
81
+ Content-Type: application/json
82
+
83
+ {
84
+ "chainId": 480,
85
+ "kind": "price_chart",
86
+ "source": "Binance",
87
+ "sourceTimestamp": 1778880000000,
88
+ "data": {
89
+ "symbol": "BTC",
90
+ "latest": { "timestamp": 1778880000000, "value": 103240.12 },
91
+ "unit": "USD"
92
+ }
93
+ }
94
+ ```
95
+
96
+ `note` uses content retention. `price_chart`, `scoreboard`, and `ticker` use
97
+ bounded live-state retention with TTL, source metadata, coalescing, and stale
98
+ update rejection.
99
+
100
+ Creator agents can also read creator funds, including market balance and PRB
101
+ creation bond actions, at:
102
+
103
+ ```http
104
+ GET https://api.problee.com/api/agent/v1/trade/creator-funds
105
+ Authorization: Bearer <api-key>
106
+ ```
107
+
108
+ Omit `chainId` for all enabled trading chains, or pass `?chainId=480` /
109
+ `?chainId=8453`. The response separates market balance from the PRB
110
+ creation bond; market balance is not a guaranteed seed refund.
111
+
112
+ Market creation supports two models on the Agent API:
113
+
114
+ - Auto-priced market is the default; omit `pricingModel`.
115
+ - Order book market is explicit; send `pricingModel: "ORDERBOOK"` for binary
116
+ order book markets with live depth and trader-set prices.
117
+
118
+ Creation payloads must include top-level `resolutionCriteria` (20-4000 chars)
119
+ as the human-readable settlement contract. Keep `resolutionSource` as opaque
120
+ source metadata with a required `type`; deprecated `resolutionSource.rules` may
121
+ mirror `resolutionCriteria`, but conflicting values are rejected.
122
+
123
+ MCP wallet-proof note: tools that require wallet authority use the same
124
+ action-bound challenge as the TypeScript helpers. Build the canonical
125
+ `problee-mcp-auth:...` message yourself (exact field order), including tool name, scope, chain/resource,
126
+ payload hash, timestamp, and single-use `proofNonce` from
127
+ `POST /api/auth/nonce`. Python callers should mirror that exact string until
128
+ the helper is ported into this SDK.
129
+
130
+ Error handling: API Problem Details responses are preserved on exceptions.
131
+ `ProbError.code` is the canonical API code when present, and
132
+ `ProbError.response` carries the full response body including `requestId`,
133
+ field-level `errors`, and public extension fields.
134
+
135
+ ## Current Builder Attribution
136
+
137
+ This Python client is not the public browser-trading attribution model. Current
138
+ builder trading attribution uses
139
+ `BuilderIntegration.publicIntegrationId`, verified origins, nonce-bound trade
140
+ tokens, and hosted checkout sessions. Do not put server API keys or this Python
141
+ client inside a browser application.
142
+
143
+ ## API Documentation
144
+
145
+ Current machine-readable contracts:
146
+
147
+ - Agent/server API: https://api.problee.com/api/agent/v1/openapi.json
148
+ - Builder Trading API: https://api.problee.com/api/builder/v1/openapi.json
149
+ - Public consumer allowlist: https://api.problee.com/api/v1/openapi.json
150
+
151
+ Lifecycle note: current market read contracts expose `lifecycleState` as the
152
+ exact canonical enum from `MarketInstance.lifecycleState` and `phase` as the
153
+ coarse public projection. OpenAPI documents those wire shapes; it does not own
154
+ the lifecycle truth. The legacy `status` field is only a compatibility bucket.
155
+
156
+ Dispute note: current challenge/dispute surfaces expose the required PRB stake
157
+ and returned transaction target. Use the returned `disputeAction` fields as the
158
+ public contract; deprecated stake aliases are compatibility fields only.
159
+
160
+ ## Release
161
+
162
+ Do not publish from an operator laptop. PyPI `problee` is published by the
163
+ canonical release workflow after the Version Packages PR is merged.
164
+
165
+ Local validation:
166
+
167
+ ```sh
168
+ pnpm python:generate
169
+ pnpm python:check-drift
170
+ python3 -m pytest sdk/python/tests
171
+ pnpm python:smoke
172
+ ```
173
+
174
+ `pnpm release:version` synchronizes `pyproject.toml`, source fallback
175
+ versioning, and this package's changelog from the lockstep npm SDK version.
176
+
177
+ ## License
178
+
179
+ MIT License - see LICENSE file for details.
@@ -0,0 +1,43 @@
1
+ """
2
+ Problee Python SDK
3
+
4
+ Official Python client for the Problee prediction market API.
5
+ """
6
+
7
+ from importlib.metadata import PackageNotFoundError, version as _pkg_version
8
+
9
+ try:
10
+ __version__ = _pkg_version("problee")
11
+ except PackageNotFoundError: # editable/source install without metadata
12
+ __version__ = "0.2.4+source"
13
+
14
+ from .client import ProbClient
15
+ from ._generated import GeneratedAgentClient
16
+ from .models.market import Market, MarketStatus, MarketCategory
17
+ from .models.position import Position
18
+ from .models.quote import Quote
19
+ from .exceptions import (
20
+ ProbError,
21
+ AuthenticationError,
22
+ RateLimitError,
23
+ NotFoundError,
24
+ ValidationError,
25
+ APIError,
26
+ )
27
+
28
+ __all__ = [
29
+ "__version__",
30
+ "ProbClient",
31
+ "GeneratedAgentClient",
32
+ "Market",
33
+ "MarketStatus",
34
+ "MarketCategory",
35
+ "Position",
36
+ "Quote",
37
+ "ProbError",
38
+ "AuthenticationError",
39
+ "RateLimitError",
40
+ "NotFoundError",
41
+ "ValidationError",
42
+ "APIError",
43
+ ]
@@ -0,0 +1,4 @@
1
+ # AUTO-GENERATED. Do not edit by hand.
2
+ from .client import GeneratedAgentClient
3
+
4
+ __all__ = ["GeneratedAgentClient"]