Add files using upload-large-folder tool
Browse files- .cache/claude-cli-nodejs/-data-data-com-termux-files-home-AGENTclone1/mcp-logs-spf-smart-gate/2026-02-26T06-25-57-524Z.jsonl +13 -0
- .cache/claude-cli-nodejs/-data-data-com-termux-files-home-AGENTclone1/mcp-logs-spf-smart-gate/2026-02-26T08-26-10-781Z.jsonl +9 -0
- .cache/claude-cli-nodejs/-data-data-com-termux-files-home-SPFsmartGATE-LIVE-BIN-spf-smart-gate/mcp-logs-spf-smart-gate/2026-02-26T18-33-21-542Z.jsonl +3 -0
- .cache/claude-cli-nodejs/-data-data-com-termux-files-home-SPFsmartGATE-LIVE-BIN-spf-smart-gate/mcp-logs-spf-smart-gate/2026-02-26T22-51-38-412Z.jsonl +3 -0
- .cache/claude-cli-nodejs/-data-data-com-termux-files-home-SPFsmartGATE-LIVE-BIN-spf-smart-gate/mcp-logs-spf-smart-gate/2026-02-26T22-52-03-692Z.jsonl +5 -0
- .cache/claude-cli-nodejs/-data-data-com-termux-files-home-SPFsmartGATE-LIVE-BIN-spf-smart-gate/mcp-logs-spf-smart-gate/2026-02-27T01-19-38-245Z.jsonl +3 -0
- .cache/claude-cli-nodejs/-data-data-com-termux-files-home-SPFsmartGATE-LIVE-BIN-spf-smart-gate/mcp-logs-spf-smart-gate/2026-02-28T09-05-50-893Z.jsonl +3 -0
- .cache/claude-cli-nodejs/-data-data-com-termux-files-home-SPFsmartGATE/mcp-logs-spf-smart-gate/2026-02-16T03-30-04-283Z.jsonl +3 -0
- .cache/claude-cli-nodejs/-data-data-com-termux-files-home-SPFsmartGATE/mcp-logs-spf-smart-gate/2026-02-20T06-33-56-083Z.jsonl +4 -0
- .cache/claude-cli-nodejs/-data-data-com-termux-files-home-SPFsmartGATE/mcp-logs-spf-smart-gate/2026-02-20T09-11-19-856Z.jsonl +33 -0
- .cache/pip/http-v2/5/2/3/f/f/523ff132ae8b533a32374201305af5d98433a0069c34efef8ee4975c.body +0 -0
- .cache/pip/http-v2/5/9/d/9/f/59d9f659e48ec0730ba0bb7a7dd00a671396b786d79d8d5788a07a59 +0 -0
- .cache/pip/http-v2/5/9/d/9/f/59d9f659e48ec0730ba0bb7a7dd00a671396b786d79d8d5788a07a59.body +48 -0
- .cache/pip/http-v2/6/1/b/e/5/61be51d9e3846a9e54b8840e72ddf514b2429c5292881254b289f5a8 +0 -0
- .cache/pip/http-v2/6/2/e/2/c/62e2caaadb9fd2d0a88b65a7d2043b2c343936491ef44dc753aa91e0 +0 -0
- .cache/pip/http-v2/6/2/e/2/c/62e2caaadb9fd2d0a88b65a7d2043b2c343936491ef44dc753aa91e0.body +0 -0
- .cache/pip/http-v2/6/5/a/f/8/65af88561e8b18ff500b9fe7d5ad34c1636e3423202d926b9e18a96f +0 -0
- .cache/pip/http-v2/6/5/a/f/8/65af88561e8b18ff500b9fe7d5ad34c1636e3423202d926b9e18a96f.body +204 -0
- .cache/pip/http-v2/6/6/d/c/a/66dca7bbc71fbb8945b23750a7adc3b26c5b4522cea5aa217a9904f2 +0 -0
- .cache/pip/http-v2/6/6/d/c/a/66dca7bbc71fbb8945b23750a7adc3b26c5b4522cea5aa217a9904f2.body +0 -0
- .cache/pip/http-v2/6/6/e/c/7/66ec76a7b6ed4081044f5c7821af293b63c17bc2ac523ff93d5ca7d5 +0 -0
- .cache/pip/http-v2/6/a/0/8/8/6a088fc192b69f4692b96903e0d1df2f92839b402221a47a2ca3b5be +0 -0
- .cache/pip/http-v2/6/a/0/8/8/6a088fc192b69f4692b96903e0d1df2f92839b402221a47a2ca3b5be.body +82 -0
- .cache/pip/http-v2/6/d/9/b/b/6d9bb16a8c20d3783bba80b903556e9537f366b232ea15e3fef0a8a6 +0 -0
- .cache/pip/http-v2/6/d/9/b/b/6d9bb16a8c20d3783bba80b903556e9537f366b232ea15e3fef0a8a6.body +2085 -0
- .cache/pip/http-v2/6/e/b/2/9/6eb29acc74a7b2a4fa9d02eaa2d7b3d6780e701cba01a5f9b1bc28ad +0 -0
- .cache/pip/http-v2/6/e/b/2/9/6eb29acc74a7b2a4fa9d02eaa2d7b3d6780e701cba01a5f9b1bc28ad.body +141 -0
- .cache/pip/http-v2/a/2/6/7/f/a267f54c19667a20e6416d2dc2a1df4a525eed802f0f2b538b654da1 +0 -0
- .cache/pip/http-v2/c/0/4/0/0/c0400f4849a16bb7ec1db13ba6d964327b0869995ab53c54f6668654 +0 -0
- .cache/pip/http-v2/c/0/4/0/0/c0400f4849a16bb7ec1db13ba6d964327b0869995ab53c54f6668654.body +0 -0
- .cache/pip/http-v2/c/5/2/e/2/c52e2f1dd5b9608ced10cc1a661cb4850330552cdc6801105598d8e4 +0 -0
- .cache/pip/http-v2/c/5/2/e/2/c52e2f1dd5b9608ced10cc1a661cb4850330552cdc6801105598d8e4.body +356 -0
- .cache/pip/http-v2/c/6/f/3/1/c6f3192810e6b78a08fee1da61557cd4bdd93a63331b9d474bca9d38 +0 -0
- .cache/pip/http-v2/c/6/f/3/1/c6f3192810e6b78a08fee1da61557cd4bdd93a63331b9d474bca9d38.body +0 -0
- .cache/pip/http-v2/c/7/8/8/7/c78874231318158a294dd5b68c42610cc1c0c99d6a1453dfec26706e +0 -0
- .cache/pip/http-v2/c/7/8/8/7/c78874231318158a294dd5b68c42610cc1c0c99d6a1453dfec26706e.body +819 -0
- .cache/pip/http-v2/c/9/4/0/b/c940b2250e62326f26b47c7a80ee830db74434095fb11c383a444ac9 +0 -0
- .cache/pip/http-v2/c/9/a/6/c/c9a6cf900bd08e59c5c1f2ac1e9a3c7d81a890e4ebba0a7410e78b89 +0 -0
- .cache/pip/http-v2/c/9/a/6/c/c9a6cf900bd08e59c5c1f2ac1e9a3c7d81a890e4ebba0a7410e78b89.body +446 -0
- .cache/pip/http-v2/c/c/1/3/3/cc133da5701a066bc3777b2575e0daa601596f19871db4608ca98b97 +0 -0
- .cache/pip/http-v2/d/2/b/c/5/d2bc54a4365aeb9214dc95d9e8c9d2636f8c537f2c9e8a1e5753b8a8 +0 -0
- .cache/pip/http-v2/d/2/b/c/5/d2bc54a4365aeb9214dc95d9e8c9d2636f8c537f2c9e8a1e5753b8a8.body +0 -0
- .cache/pip/http-v2/d/6/c/9/b/d6c9b0bb18a1a2203fdd091226d79bdd9c086219632c1af537a3cec4 +0 -0
- .cache/pip/http-v2/d/6/c/9/b/d6c9b0bb18a1a2203fdd091226d79bdd9c086219632c1af537a3cec4.body +268 -0
- .cache/pip/http-v2/d/8/e/0/9/d8e09aa7b92b4e0dca0973688684cc242bd7a4215af30cdeca5554a3 +0 -0
- .cache/pip/http-v2/d/8/e/0/9/d8e09aa7b92b4e0dca0973688684cc242bd7a4215af30cdeca5554a3.body +43 -0
- .cache/pip/http-v2/d/9/d/5/f/d9d5f2d642db317afc4dbf47caf66f462f28670a2eafad11d17a25d5 +0 -0
- .cache/pip/http-v2/d/9/d/5/f/d9d5f2d642db317afc4dbf47caf66f462f28670a2eafad11d17a25d5.body +0 -0
- .cache/pip/http-v2/d/a/1/7/8/da1780e4b38e99fc7d98c9695282deb3a6238d5b858e1394f07be68b +0 -0
- .cache/pip/http-v2/d/a/1/7/8/da1780e4b38e99fc7d98c9695282deb3a6238d5b858e1394f07be68b.body +40 -0
.cache/claude-cli-nodejs/-data-data-com-termux-files-home-AGENTclone1/mcp-logs-spf-smart-gate/2026-02-26T06-25-57-524Z.jsonl
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"debug":"Starting connection with timeout of 30000ms","timestamp":"2026-02-26T06:25:58.102Z","sessionId":"4ec566cb-326b-4dd2-8ee2-3e984e7c00cd","cwd":"/data/data/com.termux/files/home/AGENTclone1"}
|
| 2 |
+
{"debug":"Successfully connected to stdio server in 427ms","timestamp":"2026-02-26T06:25:58.518Z","sessionId":"4ec566cb-326b-4dd2-8ee2-3e984e7c00cd","cwd":"/data/data/com.termux/files/home/AGENTclone1"}
|
| 3 |
+
{"debug":"Connection established with capabilities: {\"hasTools\":true,\"hasPrompts\":false,\"hasResources\":false,\"serverVersion\":{\"name\":\"spf-smart-gate\",\"version\":\"3.0.0\"}}","timestamp":"2026-02-26T06:25:58.519Z","sessionId":"4ec566cb-326b-4dd2-8ee2-3e984e7c00cd","cwd":"/data/data/com.termux/files/home/AGENTclone1"}
|
| 4 |
+
{"debug":"Calling MCP tool: spf_mesh_status","timestamp":"2026-02-26T06:27:45.807Z","sessionId":"4ec566cb-326b-4dd2-8ee2-3e984e7c00cd","cwd":"/data/data/com.termux/files/home/AGENTclone1"}
|
| 5 |
+
{"debug":"Tool 'spf_mesh_status' completed successfully in 61ms","timestamp":"2026-02-26T06:27:45.868Z","sessionId":"4ec566cb-326b-4dd2-8ee2-3e984e7c00cd","cwd":"/data/data/com.termux/files/home/AGENTclone1"}
|
| 6 |
+
{"debug":"Calling MCP tool: spf_mesh_peers","timestamp":"2026-02-26T06:27:46.616Z","sessionId":"4ec566cb-326b-4dd2-8ee2-3e984e7c00cd","cwd":"/data/data/com.termux/files/home/AGENTclone1"}
|
| 7 |
+
{"debug":"Tool 'spf_mesh_peers' completed successfully in 57ms","timestamp":"2026-02-26T06:27:46.673Z","sessionId":"4ec566cb-326b-4dd2-8ee2-3e984e7c00cd","cwd":"/data/data/com.termux/files/home/AGENTclone1"}
|
| 8 |
+
{"debug":"Calling MCP tool: spf_mesh_call","timestamp":"2026-02-26T06:29:32.049Z","sessionId":"4ec566cb-326b-4dd2-8ee2-3e984e7c00cd","cwd":"/data/data/com.termux/files/home/AGENTclone1"}
|
| 9 |
+
{"debug":"Tool 'spf_mesh_call' completed successfully in 54ms","timestamp":"2026-02-26T06:29:32.103Z","sessionId":"4ec566cb-326b-4dd2-8ee2-3e984e7c00cd","cwd":"/data/data/com.termux/files/home/AGENTclone1"}
|
| 10 |
+
{"debug":"Calling MCP tool: spf_mesh_status","timestamp":"2026-02-26T06:31:29.912Z","sessionId":"4ec566cb-326b-4dd2-8ee2-3e984e7c00cd","cwd":"/data/data/com.termux/files/home/AGENTclone1"}
|
| 11 |
+
{"debug":"Tool 'spf_mesh_status' completed successfully in 45ms","timestamp":"2026-02-26T06:31:29.957Z","sessionId":"4ec566cb-326b-4dd2-8ee2-3e984e7c00cd","cwd":"/data/data/com.termux/files/home/AGENTclone1"}
|
| 12 |
+
{"debug":"Calling MCP tool: spf_mesh_peers","timestamp":"2026-02-26T06:31:31.027Z","sessionId":"4ec566cb-326b-4dd2-8ee2-3e984e7c00cd","cwd":"/data/data/com.termux/files/home/AGENTclone1"}
|
| 13 |
+
{"debug":"Tool 'spf_mesh_peers' completed successfully in 55ms","timestamp":"2026-02-26T06:31:31.082Z","sessionId":"4ec566cb-326b-4dd2-8ee2-3e984e7c00cd","cwd":"/data/data/com.termux/files/home/AGENTclone1"}
|
.cache/claude-cli-nodejs/-data-data-com-termux-files-home-AGENTclone1/mcp-logs-spf-smart-gate/2026-02-26T08-26-10-781Z.jsonl
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"debug":"Starting connection with timeout of 30000ms","timestamp":"2026-02-26T08:26:11.402Z","sessionId":"9af67c89-21fc-4b2d-957a-0ad154a1603e","cwd":"/data/data/com.termux/files/home/AGENTclone1"}
|
| 2 |
+
{"debug":"Successfully connected to stdio server in 425ms","timestamp":"2026-02-26T08:26:11.816Z","sessionId":"9af67c89-21fc-4b2d-957a-0ad154a1603e","cwd":"/data/data/com.termux/files/home/AGENTclone1"}
|
| 3 |
+
{"debug":"Connection established with capabilities: {\"hasTools\":true,\"hasPrompts\":false,\"hasResources\":false,\"serverVersion\":{\"name\":\"spf-smart-gate\",\"version\":\"3.0.0\"}}","timestamp":"2026-02-26T08:26:11.816Z","sessionId":"9af67c89-21fc-4b2d-957a-0ad154a1603e","cwd":"/data/data/com.termux/files/home/AGENTclone1"}
|
| 4 |
+
{"debug":"Calling MCP tool: spf_status","timestamp":"2026-02-26T08:26:39.036Z","sessionId":"4ec566cb-326b-4dd2-8ee2-3e984e7c00cd","cwd":"/data/data/com.termux/files/home/AGENTclone1"}
|
| 5 |
+
{"debug":"Tool 'spf_status' completed successfully in 47ms","timestamp":"2026-02-26T08:26:39.082Z","sessionId":"4ec566cb-326b-4dd2-8ee2-3e984e7c00cd","cwd":"/data/data/com.termux/files/home/AGENTclone1"}
|
| 6 |
+
{"debug":"Calling MCP tool: spf_mesh_status","timestamp":"2026-02-26T08:26:40.694Z","sessionId":"4ec566cb-326b-4dd2-8ee2-3e984e7c00cd","cwd":"/data/data/com.termux/files/home/AGENTclone1"}
|
| 7 |
+
{"debug":"Tool 'spf_mesh_status' completed successfully in 50ms","timestamp":"2026-02-26T08:26:40.743Z","sessionId":"4ec566cb-326b-4dd2-8ee2-3e984e7c00cd","cwd":"/data/data/com.termux/files/home/AGENTclone1"}
|
| 8 |
+
{"debug":"Calling MCP tool: spf_mesh_peers","timestamp":"2026-02-26T08:26:41.326Z","sessionId":"4ec566cb-326b-4dd2-8ee2-3e984e7c00cd","cwd":"/data/data/com.termux/files/home/AGENTclone1"}
|
| 9 |
+
{"debug":"Tool 'spf_mesh_peers' completed successfully in 41ms","timestamp":"2026-02-26T08:26:41.368Z","sessionId":"4ec566cb-326b-4dd2-8ee2-3e984e7c00cd","cwd":"/data/data/com.termux/files/home/AGENTclone1"}
|
.cache/claude-cli-nodejs/-data-data-com-termux-files-home-SPFsmartGATE-LIVE-BIN-spf-smart-gate/mcp-logs-spf-smart-gate/2026-02-26T18-33-21-542Z.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"debug":"Starting connection with timeout of 30000ms","timestamp":"2026-02-26T18:33:22.168Z","sessionId":"46f4042b-f013-47b9-9a48-4ac0e3224e0c","cwd":"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/BIN/spf-smart-gate"}
|
| 2 |
+
{"debug":"Successfully connected to stdio server in 418ms","timestamp":"2026-02-26T18:33:22.575Z","sessionId":"46f4042b-f013-47b9-9a48-4ac0e3224e0c","cwd":"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/BIN/spf-smart-gate"}
|
| 3 |
+
{"debug":"Connection established with capabilities: {\"hasTools\":true,\"hasPrompts\":false,\"hasResources\":false,\"serverVersion\":{\"name\":\"spf-smart-gate\",\"version\":\"3.0.0\"}}","timestamp":"2026-02-26T18:33:22.575Z","sessionId":"46f4042b-f013-47b9-9a48-4ac0e3224e0c","cwd":"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/BIN/spf-smart-gate"}
|
.cache/claude-cli-nodejs/-data-data-com-termux-files-home-SPFsmartGATE-LIVE-BIN-spf-smart-gate/mcp-logs-spf-smart-gate/2026-02-26T22-51-38-412Z.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"debug":"Starting connection with timeout of 30000ms","timestamp":"2026-02-26T22:51:39.081Z","sessionId":"43ad1046-ec2d-4a55-92e3-90a543fc7628","cwd":"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/BIN/spf-smart-gate"}
|
| 2 |
+
{"debug":"Successfully connected to stdio server in 414ms","timestamp":"2026-02-26T22:51:39.483Z","sessionId":"43ad1046-ec2d-4a55-92e3-90a543fc7628","cwd":"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/BIN/spf-smart-gate"}
|
| 3 |
+
{"debug":"Connection established with capabilities: {\"hasTools\":true,\"hasPrompts\":false,\"hasResources\":false,\"serverVersion\":{\"name\":\"spf-smart-gate\",\"version\":\"3.0.0\"}}","timestamp":"2026-02-26T22:51:39.484Z","sessionId":"43ad1046-ec2d-4a55-92e3-90a543fc7628","cwd":"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/BIN/spf-smart-gate"}
|
.cache/claude-cli-nodejs/-data-data-com-termux-files-home-SPFsmartGATE-LIVE-BIN-spf-smart-gate/mcp-logs-spf-smart-gate/2026-02-26T22-52-03-692Z.jsonl
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"debug":"Starting connection with timeout of 30000ms","timestamp":"2026-02-26T22:52:04.445Z","sessionId":"2532867a-c80d-48bd-96b4-63502e292e63","cwd":"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/BIN/spf-smart-gate"}
|
| 2 |
+
{"debug":"Successfully connected to stdio server in 422ms","timestamp":"2026-02-26T22:52:04.856Z","sessionId":"2532867a-c80d-48bd-96b4-63502e292e63","cwd":"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/BIN/spf-smart-gate"}
|
| 3 |
+
{"debug":"Connection established with capabilities: {\"hasTools\":true,\"hasPrompts\":false,\"hasResources\":false,\"serverVersion\":{\"name\":\"spf-smart-gate\",\"version\":\"3.0.0\"}}","timestamp":"2026-02-26T22:52:04.856Z","sessionId":"2532867a-c80d-48bd-96b4-63502e292e63","cwd":"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/BIN/spf-smart-gate"}
|
| 4 |
+
{"debug":"Calling MCP tool: spf_brain_store","timestamp":"2026-02-27T00:29:24.644Z","sessionId":"2532867a-c80d-48bd-96b4-63502e292e63","cwd":"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/BIN/spf-smart-gate"}
|
| 5 |
+
{"debug":"Tool 'spf_brain_store' completed successfully in 20s","timestamp":"2026-02-27T00:29:45.492Z","sessionId":"2532867a-c80d-48bd-96b4-63502e292e63","cwd":"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/BIN/spf-smart-gate"}
|
.cache/claude-cli-nodejs/-data-data-com-termux-files-home-SPFsmartGATE-LIVE-BIN-spf-smart-gate/mcp-logs-spf-smart-gate/2026-02-27T01-19-38-245Z.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"debug":"Starting connection with timeout of 30000ms","timestamp":"2026-02-27T01:19:38.896Z","sessionId":"09d90852-fc22-4cb0-810e-5165d4115010","cwd":"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/BIN/spf-smart-gate"}
|
| 2 |
+
{"debug":"Successfully connected to stdio server in 431ms","timestamp":"2026-02-27T01:19:39.316Z","sessionId":"09d90852-fc22-4cb0-810e-5165d4115010","cwd":"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/BIN/spf-smart-gate"}
|
| 3 |
+
{"debug":"Connection established with capabilities: {\"hasTools\":true,\"hasPrompts\":false,\"hasResources\":false,\"serverVersion\":{\"name\":\"spf-smart-gate\",\"version\":\"3.0.0\"}}","timestamp":"2026-02-27T01:19:39.316Z","sessionId":"09d90852-fc22-4cb0-810e-5165d4115010","cwd":"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/BIN/spf-smart-gate"}
|
.cache/claude-cli-nodejs/-data-data-com-termux-files-home-SPFsmartGATE-LIVE-BIN-spf-smart-gate/mcp-logs-spf-smart-gate/2026-02-28T09-05-50-893Z.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"debug":"Starting connection with timeout of 30000ms","timestamp":"2026-02-28T09:05:51.567Z","sessionId":"4cf969dd-81b5-45f9-a4e2-56fe226e849c","cwd":"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/BIN/spf-smart-gate"}
|
| 2 |
+
{"debug":"Successfully connected to stdio server in 422ms","timestamp":"2026-02-28T09:05:51.980Z","sessionId":"4cf969dd-81b5-45f9-a4e2-56fe226e849c","cwd":"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/BIN/spf-smart-gate"}
|
| 3 |
+
{"debug":"Connection established with capabilities: {\"hasTools\":true,\"hasPrompts\":false,\"hasResources\":false,\"serverVersion\":{\"name\":\"spf-smart-gate\",\"version\":\"3.0.0\"}}","timestamp":"2026-02-28T09:05:51.981Z","sessionId":"4cf969dd-81b5-45f9-a4e2-56fe226e849c","cwd":"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/BIN/spf-smart-gate"}
|
.cache/claude-cli-nodejs/-data-data-com-termux-files-home-SPFsmartGATE/mcp-logs-spf-smart-gate/2026-02-16T03-30-04-283Z.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"debug":"Starting connection with timeout of 30000ms","timestamp":"2026-02-16T03:30:05.029Z","sessionId":"5f5e016a-7a25-4ef7-ac66-8e8c0947da4d","cwd":"/data/data/com.termux/files/home/SPFsmartGATE"}
|
| 2 |
+
{"debug":"Connection failed after 123ms: spawn /data/data/com.termux/files/home/SPFsmartGATE/LIVE/BIN/spf-smart-gate EACCES","timestamp":"2026-02-16T03:30:05.138Z","sessionId":"5f5e016a-7a25-4ef7-ac66-8e8c0947da4d","cwd":"/data/data/com.termux/files/home/SPFsmartGATE"}
|
| 3 |
+
{"error":"Connection failed: spawn /data/data/com.termux/files/home/SPFsmartGATE/LIVE/BIN/spf-smart-gate EACCES","timestamp":"2026-02-16T03:30:05.138Z","sessionId":"5f5e016a-7a25-4ef7-ac66-8e8c0947da4d","cwd":"/data/data/com.termux/files/home/SPFsmartGATE"}
|
.cache/claude-cli-nodejs/-data-data-com-termux-files-home-SPFsmartGATE/mcp-logs-spf-smart-gate/2026-02-20T06-33-56-083Z.jsonl
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"debug":"Starting connection with timeout of 30000ms","timestamp":"2026-02-20T06:33:57.816Z","sessionId":"90aa9b43-44e1-41b7-ae5a-cdb185eb2405","cwd":"/data/data/com.termux/files/home/SPFsmartGATE"}
|
| 2 |
+
{"error":"Server stderr: [2026-02-20T06:33:57Z INFO spf_smart_gate::config_db] SPF Config LMDB opened at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/CONFIG/CONFIG.DB\"\n[2026-02-20T06:33:57Z INFO spf_smart_gate::storage] SPF LMDB opened at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/SESSION/SESSION.DB\"\n[spf-smart-gate] Starting spf-smart-gate v3.0.0\n[spf-smart-gate] Mode: Max\n[spf-smart-gate] SPF_CONFIG LMDB active (passed from main)\n[spf-smart-gate] PROJECTS path: \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/PROJECTS/PROJECTS.DB\"\n[2026-02-20T06:33:57Z INFO spf_smart_gate::projects_db] PROJECTS LMDB opened at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/PROJECTS/PROJECTS.DB\"\n[2026-02-20T06:33:57Z INFO spf_smart_gate::projects_db] PROJECTS LMDB initialized\n[spf-smart-gate] PROJECTS LMDB initialized at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/PROJECTS/PROJECTS.DB\"\n[spf-smart-gate] TMP_DB path: \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/TMP/TMP.DB\"\n[2026-02-20T06:33:57Z INFO spf_smart_gate::tmp_db] TMP_DB LMDB opened at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/TMP/TMP.DB\"\n[spf-smart-gate] TMP_DB LMDB initialized at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/TMP/TMP.DB\"\n[spf-smart-gate] AGENT_STATE path: \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/LMDB5/LMDB5.DB\"\n[2026-02-20T06:33:57Z INFO spf_smart_gate::agent_state] Agent State LMDB opened at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/LMDB5/LMDB5.DB\"\n[spf-smart-gate] AGENT_STATE LMDB initialized at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/LMDB5/LMDB5.DB\"\n[spf-smart-gate] SPF_FS path: \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/SPF_FS\"\n[2026-02-20T06:33:57Z INFO spf_smart_gate::fs] SPF FS opened at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/SPF_FS/SPF_FS.DB\"\n[spf-smart-gate] SPF_FS LMDB initialized at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/SPF_FS\"/SPF_FS.DB/\n[spf-smart-gate] Identity: 97e9dfc7c2aa858d4dcdc241ddd0f2d3a3c046f0fcf04ca527eb0eaf751fb5c2\n[spf-smart-gate] HTTPS API started on 0.0.0.0:3900\n\nthread '<unnamed>' (22495) panicked at src/http.rs:224:35:\nFailed to start HTTPS server: Os { code: 98, kind: AddrInUse, message: \"Address already in use\" }\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n","timestamp":"2026-02-20T06:33:57.931Z","sessionId":"90aa9b43-44e1-41b7-ae5a-cdb185eb2405","cwd":"/data/data/com.termux/files/home/SPFsmartGATE"}
|
| 3 |
+
{"debug":"Connection failed after 125ms: MCP error -32000: Connection closed","timestamp":"2026-02-20T06:33:57.931Z","sessionId":"90aa9b43-44e1-41b7-ae5a-cdb185eb2405","cwd":"/data/data/com.termux/files/home/SPFsmartGATE"}
|
| 4 |
+
{"error":"Connection failed: MCP error -32000: Connection closed","timestamp":"2026-02-20T06:33:57.932Z","sessionId":"90aa9b43-44e1-41b7-ae5a-cdb185eb2405","cwd":"/data/data/com.termux/files/home/SPFsmartGATE"}
|
.cache/claude-cli-nodejs/-data-data-com-termux-files-home-SPFsmartGATE/mcp-logs-spf-smart-gate/2026-02-20T09-11-19-856Z.jsonl
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"debug":"Starting connection with timeout of 30000ms","timestamp":"2026-02-20T09:11:20.016Z","sessionId":"b97f33d6-d80c-4361-b2ce-3bd12c7e6230","cwd":"/data/data/com.termux/files/home/SPFsmartGATE"}
|
| 2 |
+
{"debug":"Successfully connected to stdio server in 103ms","timestamp":"2026-02-20T09:11:20.112Z","sessionId":"b97f33d6-d80c-4361-b2ce-3bd12c7e6230","cwd":"/data/data/com.termux/files/home/SPFsmartGATE"}
|
| 3 |
+
{"debug":"Connection established with capabilities: {\"hasTools\":true,\"hasPrompts\":false,\"hasResources\":false,\"serverVersion\":{\"name\":\"spf-smart-gate\",\"version\":\"3.0.0\"}}","timestamp":"2026-02-20T09:11:20.112Z","sessionId":"b97f33d6-d80c-4361-b2ce-3bd12c7e6230","cwd":"/data/data/com.termux/files/home/SPFsmartGATE"}
|
| 4 |
+
{"debug":"STDIO connection closed after 0s (cleanly)","timestamp":"2026-02-20T09:11:20.130Z","sessionId":"b97f33d6-d80c-4361-b2ce-3bd12c7e6230","cwd":"/data/data/com.termux/files/home/SPFsmartGATE"}
|
| 5 |
+
{"debug":"Cleared connection cache for reconnection","timestamp":"2026-02-20T09:11:20.130Z","sessionId":"b97f33d6-d80c-4361-b2ce-3bd12c7e6230","cwd":"/data/data/com.termux/files/home/SPFsmartGATE"}
|
| 6 |
+
{"debug":"Starting connection with timeout of 30000ms","timestamp":"2026-02-20T09:11:20.569Z","sessionId":"b97f33d6-d80c-4361-b2ce-3bd12c7e6230","cwd":"/data/data/com.termux/files/home/SPFsmartGATE"}
|
| 7 |
+
{"error":"Server stderr: [2026-02-20T09:11:20Z INFO spf_smart_gate::config_db] SPF Config LMDB opened at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/CONFIG/CONFIG.DB\"\n[2026-02-20T09:11:20Z INFO spf_smart_gate::storage] SPF LMDB opened at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/SESSION/SESSION.DB\"\n[spf-smart-gate] Starting spf-smart-gate v3.0.0\n[spf-smart-gate] Mode: Max\n[spf-smart-gate] SPF_CONFIG LMDB active (passed from main)\n[spf-smart-gate] PROJECTS path: \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/PROJECTS/PROJECTS.DB\"\n[2026-02-20T09:11:20Z INFO spf_smart_gate::projects_db] PROJECTS LMDB opened at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/PROJECTS/PROJECTS.DB\"\n[2026-02-20T09:11:20Z INFO spf_smart_gate::projects_db] PROJECTS LMDB initialized\n[spf-smart-gate] PROJECTS LMDB initialized at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/PROJECTS/PROJECTS.DB\"\n[spf-smart-gate] TMP_DB path: \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/TMP/TMP.DB\"\n[2026-02-20T09:11:20Z INFO spf_smart_gate::tmp_db] TMP_DB LMDB opened at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/TMP/TMP.DB\"\n[spf-smart-gate] TMP_DB LMDB initialized at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/TMP/TMP.DB\"\n[spf-smart-gate] AGENT_STATE path: \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/LMDB5/LMDB5.DB\"\n[2026-02-20T09:11:20Z INFO spf_smart_gate::agent_state] Agent State LMDB opened at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/LMDB5/LMDB5.DB\"\n[spf-smart-gate] AGENT_STATE LMDB initialized at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/LMDB5/LMDB5.DB\"\n[spf-smart-gate] SPF_FS path: \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/SPF_FS\"\n[2026-02-20T09:11:20Z INFO spf_smart_gate::fs] SPF FS opened at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/SPF_FS/SPF_FS.DB\"\n[spf-smart-gate] SPF_FS LMDB initialized at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/SPF_FS\"/SPF_FS.DB/\n[spf-smart-gate] Identity: 97e9dfc7c2aa858d4dcdc241ddd0f2d3a3c046f0fcf04ca527eb0eaf751fb5c2\n[spf-smart-gate] HTTPS API started on 0.0.0.0:3900\n\nthread '<unnamed>' (24573) panicked at src/http.rs:224:35:\nFailed to start HTTPS server: Os { code: 98, kind: AddrInUse, message: \"Address already in use\" }\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n","timestamp":"2026-02-20T09:11:20.668Z","sessionId":"b97f33d6-d80c-4361-b2ce-3bd12c7e6230","cwd":"/data/data/com.termux/files/home/SPFsmartGATE"}
|
| 8 |
+
{"debug":"Connection failed after 101ms: MCP error -32000: Connection closed","timestamp":"2026-02-20T09:11:20.668Z","sessionId":"b97f33d6-d80c-4361-b2ce-3bd12c7e6230","cwd":"/data/data/com.termux/files/home/SPFsmartGATE"}
|
| 9 |
+
{"error":"Connection failed: MCP error -32000: Connection closed","timestamp":"2026-02-20T09:11:20.668Z","sessionId":"b97f33d6-d80c-4361-b2ce-3bd12c7e6230","cwd":"/data/data/com.termux/files/home/SPFsmartGATE"}
|
| 10 |
+
{"debug":"Starting connection with timeout of 30000ms","timestamp":"2026-02-20T09:11:36.250Z","sessionId":"90aa9b43-44e1-41b7-ae5a-cdb185eb2405","cwd":"/data/data/com.termux/files/home/SPFsmartGATE"}
|
| 11 |
+
{"error":"Server stderr: [2026-02-20T09:11:36Z INFO spf_smart_gate::config_db] SPF Config LMDB opened at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/CONFIG/CONFIG.DB\"\n[2026-02-20T09:11:36Z INFO spf_smart_gate::storage] SPF LMDB opened at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/SESSION/SESSION.DB\"\n[spf-smart-gate] Starting spf-smart-gate v3.0.0\n[spf-smart-gate] Mode: Max\n[spf-smart-gate] SPF_CONFIG LMDB active (passed from main)\n[spf-smart-gate] PROJECTS path: \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/PROJECTS/PROJECTS.DB\"\n[2026-02-20T09:11:36Z INFO spf_smart_gate::projects_db] PROJECTS LMDB opened at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/PROJECTS/PROJECTS.DB\"\n[2026-02-20T09:11:36Z INFO spf_smart_gate::projects_db] PROJECTS LMDB initialized\n[spf-smart-gate] PROJECTS LMDB initialized at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/PROJECTS/PROJECTS.DB\"\n[spf-smart-gate] TMP_DB path: \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/TMP/TMP.DB\"\n[2026-02-20T09:11:36Z INFO spf_smart_gate::tmp_db] TMP_DB LMDB opened at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/TMP/TMP.DB\"\n[spf-smart-gate] TMP_DB LMDB initialized at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/TMP/TMP.DB\"\n[spf-smart-gate] AGENT_STATE path: \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/LMDB5/LMDB5.DB\"\n[2026-02-20T09:11:36Z INFO spf_smart_gate::agent_state] Agent State LMDB opened at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/LMDB5/LMDB5.DB\"\n[spf-smart-gate] AGENT_STATE LMDB initialized at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/LMDB5/LMDB5.DB\"\n[spf-smart-gate] SPF_FS path: \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/SPF_FS\"\n[2026-02-20T09:11:36Z INFO spf_smart_gate::fs] SPF FS opened at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/SPF_FS/SPF_FS.DB\"\n[spf-smart-gate] SPF_FS LMDB initialized at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/SPF_FS\"/SPF_FS.DB/\n[spf-smart-gate] Identity: 97e9dfc7c2aa858d4dcdc241ddd0f2d3a3c046f0fcf04ca527eb0eaf751fb5c2\n[spf-smart-gate] HTTPS API started on 0.0.0.0:3900\n[spf-smart-gate] Received: initialize\n","timestamp":"2026-02-20T09:11:36.287Z","sessionId":"90aa9b43-44e1-41b7-ae5a-cdb185eb2405","cwd":"/data/data/com.termux/files/home/SPFsmartGATE"}
|
| 12 |
+
{"debug":"Successfully connected to stdio server in 42ms","timestamp":"2026-02-20T09:11:36.287Z","sessionId":"90aa9b43-44e1-41b7-ae5a-cdb185eb2405","cwd":"/data/data/com.termux/files/home/SPFsmartGATE"}
|
| 13 |
+
{"debug":"Connection established with capabilities: {\"hasTools\":true,\"hasPrompts\":false,\"hasResources\":false,\"serverVersion\":{\"name\":\"spf-smart-gate\",\"version\":\"3.0.0\"}}","timestamp":"2026-02-20T09:11:36.287Z","sessionId":"90aa9b43-44e1-41b7-ae5a-cdb185eb2405","cwd":"/data/data/com.termux/files/home/SPFsmartGATE"}
|
| 14 |
+
{"debug":"Starting connection with timeout of 30000ms","timestamp":"2026-02-20T09:11:53.167Z","sessionId":"90aa9b43-44e1-41b7-ae5a-cdb185eb2405","cwd":"/data/data/com.termux/files/home/SPFsmartGATE"}
|
| 15 |
+
{"debug":"Successfully connected to stdio server in 50ms","timestamp":"2026-02-20T09:11:53.212Z","sessionId":"90aa9b43-44e1-41b7-ae5a-cdb185eb2405","cwd":"/data/data/com.termux/files/home/SPFsmartGATE"}
|
| 16 |
+
{"debug":"Connection established with capabilities: {\"hasTools\":true,\"hasPrompts\":false,\"hasResources\":false,\"serverVersion\":{\"name\":\"spf-smart-gate\",\"version\":\"3.0.0\"}}","timestamp":"2026-02-20T09:11:53.212Z","sessionId":"90aa9b43-44e1-41b7-ae5a-cdb185eb2405","cwd":"/data/data/com.termux/files/home/SPFsmartGATE"}
|
| 17 |
+
{"debug":"Sending SIGINT to MCP server process","timestamp":"2026-02-20T09:11:53.213Z","sessionId":"90aa9b43-44e1-41b7-ae5a-cdb185eb2405","cwd":"/data/data/com.termux/files/home/SPFsmartGATE"}
|
| 18 |
+
{"debug":"STDIO connection closed after 0s (cleanly)","timestamp":"2026-02-20T09:11:53.216Z","sessionId":"90aa9b43-44e1-41b7-ae5a-cdb185eb2405","cwd":"/data/data/com.termux/files/home/SPFsmartGATE"}
|
| 19 |
+
{"debug":"Cleared connection cache for reconnection","timestamp":"2026-02-20T09:11:53.217Z","sessionId":"90aa9b43-44e1-41b7-ae5a-cdb185eb2405","cwd":"/data/data/com.termux/files/home/SPFsmartGATE"}
|
| 20 |
+
{"debug":"MCP server process exited cleanly","timestamp":"2026-02-20T09:11:53.269Z","sessionId":"90aa9b43-44e1-41b7-ae5a-cdb185eb2405","cwd":"/data/data/com.termux/files/home/SPFsmartGATE"}
|
| 21 |
+
{"debug":"Starting connection with timeout of 30000ms","timestamp":"2026-02-20T09:11:53.271Z","sessionId":"90aa9b43-44e1-41b7-ae5a-cdb185eb2405","cwd":"/data/data/com.termux/files/home/SPFsmartGATE"}
|
| 22 |
+
{"error":"Server stderr: [2026-02-20T09:11:53Z INFO spf_smart_gate::config_db] SPF Config LMDB opened at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/CONFIG/CONFIG.DB\"\n[2026-02-20T09:11:53Z INFO spf_smart_gate::storage] SPF LMDB opened at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/SESSION/SESSION.DB\"\n[spf-smart-gate] Starting spf-smart-gate v3.0.0\n[spf-smart-gate] Mode: Max\n[spf-smart-gate] SPF_CONFIG LMDB active (passed from main)\n[spf-smart-gate] PROJECTS path: \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/PROJECTS/PROJECTS.DB\"\n[2026-02-20T09:11:53Z INFO spf_smart_gate::projects_db] PROJECTS LMDB opened at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/PROJECTS/PROJECTS.DB\"\n[2026-02-20T09:11:53Z INFO spf_smart_gate::projects_db] PROJECTS LMDB initialized\n[spf-smart-gate] PROJECTS LMDB initialized at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/PROJECTS/PROJECTS.DB\"\n[spf-smart-gate] TMP_DB path: \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/TMP/TMP.DB\"\n[2026-02-20T09:11:53Z INFO spf_smart_gate::tmp_db] TMP_DB LMDB opened at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/TMP/TMP.DB\"\n[spf-smart-gate] TMP_DB LMDB initialized at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/TMP/TMP.DB\"\n[spf-smart-gate] AGENT_STATE path: \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/LMDB5/LMDB5.DB\"\n[2026-02-20T09:11:53Z INFO spf_smart_gate::agent_state] Agent State LMDB opened at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/LMDB5/LMDB5.DB\"\n[spf-smart-gate] AGENT_STATE LMDB initialized at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/LMDB5/LMDB5.DB\"\n[spf-smart-gate] SPF_FS path: \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/SPF_FS\"\n[2026-02-20T09:11:53Z INFO spf_smart_gate::fs] SPF FS opened at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/SPF_FS/SPF_FS.DB\"\n[spf-smart-gate] SPF_FS LMDB initialized at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/SPF_FS\"/SPF_FS.DB/\n[spf-smart-gate] Identity: 97e9dfc7c2aa858d4dcdc241ddd0f2d3a3c046f0fcf04ca527eb0eaf751fb5c2\n[spf-smart-gate] HTTPS API started on 0.0.0.0:3900\n[spf-smart-gate] Received: initialize\n","timestamp":"2026-02-20T09:11:53.301Z","sessionId":"90aa9b43-44e1-41b7-ae5a-cdb185eb2405","cwd":"/data/data/com.termux/files/home/SPFsmartGATE"}
|
| 23 |
+
{"debug":"Successfully connected to stdio server in 32ms","timestamp":"2026-02-20T09:11:53.301Z","sessionId":"90aa9b43-44e1-41b7-ae5a-cdb185eb2405","cwd":"/data/data/com.termux/files/home/SPFsmartGATE"}
|
| 24 |
+
{"debug":"Connection established with capabilities: {\"hasTools\":true,\"hasPrompts\":false,\"hasResources\":false,\"serverVersion\":{\"name\":\"spf-smart-gate\",\"version\":\"3.0.0\"}}","timestamp":"2026-02-20T09:11:53.301Z","sessionId":"90aa9b43-44e1-41b7-ae5a-cdb185eb2405","cwd":"/data/data/com.termux/files/home/SPFsmartGATE"}
|
| 25 |
+
{"debug":"Starting connection with timeout of 30000ms","timestamp":"2026-02-20T09:30:56.200Z","sessionId":"90aa9b43-44e1-41b7-ae5a-cdb185eb2405","cwd":"/data/data/com.termux/files/home/SPFsmartGATE"}
|
| 26 |
+
{"debug":"Connection timeout triggered after 30029ms (limit: 30000ms)","timestamp":"2026-02-20T09:31:26.223Z","sessionId":"90aa9b43-44e1-41b7-ae5a-cdb185eb2405","cwd":"/data/data/com.termux/files/home/SPFsmartGATE"}
|
| 27 |
+
{"error":"Server stderr: [2026-02-20T09:30:56Z INFO spf_smart_gate::config_db] SPF Config LMDB opened at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/CONFIG/CONFIG.DB\"\n[2026-02-20T09:30:56Z INFO spf_smart_gate::storage] SPF LMDB opened at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/SESSION/SESSION.DB\"\n[spf-smart-gate] Starting spf-smart-gate v3.0.0\n[spf-smart-gate] Mode: Max\n[spf-smart-gate] SPF_CONFIG LMDB active (passed from main)\n[spf-smart-gate] PROJECTS path: \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/PROJECTS/PROJECTS.DB\"\n[2026-02-20T09:30:56Z INFO spf_smart_gate::projects_db] PROJECTS LMDB opened at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/PROJECTS/PROJECTS.DB\"\n[2026-02-20T09:30:56Z INFO spf_smart_gate::projects_db] PROJECTS LMDB initialized\n[spf-smart-gate] PROJECTS LMDB initialized at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/PROJECTS/PROJECTS.DB\"\n[spf-smart-gate] TMP_DB path: \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/TMP/TMP.DB\"\n[2026-02-20T09:30:56Z INFO spf_smart_gate::tmp_db] TMP_DB LMDB opened at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/TMP/TMP.DB\"\n[spf-smart-gate] TMP_DB LMDB initialized at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/TMP/TMP.DB\"\n[spf-smart-gate] AGENT_STATE path: \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/LMDB5/LMDB5.DB\"\n[2026-02-20T09:30:56Z INFO spf_smart_gate::agent_state] Agent State LMDB opened at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/LMDB5/LMDB5.DB\"\n[spf-smart-gate] AGENT_STATE LMDB initialized at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/LMDB5/LMDB5.DB\"\n[spf-smart-gate] SPF_FS path: \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/SPF_FS\"\n[2026-02-20T09:30:56Z INFO spf_smart_gate::fs] SPF FS opened at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/SPF_FS/SPF_FS.DB\"\n[spf-smart-gate] SPF_FS LMDB initialized at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/SPF_FS\"/SPF_FS.DB/\n[spf-smart-gate] Identity: 97e9dfc7c2aa858d4dcdc241ddd0f2d3a3c046f0fcf04ca527eb0eaf751fb5c2\n[spf-smart-gate] HTTPS API started on 0.0.0.0:3900\n[spf-smart-gate] Received: initialize\n\nthread '<unnamed>' (27506) panicked at src/http.rs:224:35:\nFailed to start HTTPS server: Os { code: 98, kind: AddrInUse, message: \"Address already in use\" }\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n","timestamp":"2026-02-20T09:31:26.224Z","sessionId":"90aa9b43-44e1-41b7-ae5a-cdb185eb2405","cwd":"/data/data/com.termux/files/home/SPFsmartGATE"}
|
| 28 |
+
{"debug":"Connection failed after 30030ms: MCP server \"spf-smart-gate\" connection timed out after 30000ms","timestamp":"2026-02-20T09:31:26.224Z","sessionId":"90aa9b43-44e1-41b7-ae5a-cdb185eb2405","cwd":"/data/data/com.termux/files/home/SPFsmartGATE"}
|
| 29 |
+
{"error":"Connection failed: MCP server \"spf-smart-gate\" connection timed out after 30000ms","timestamp":"2026-02-20T09:31:26.224Z","sessionId":"90aa9b43-44e1-41b7-ae5a-cdb185eb2405","cwd":"/data/data/com.termux/files/home/SPFsmartGATE"}
|
| 30 |
+
{"debug":"Starting connection with timeout of 30000ms","timestamp":"2026-02-20T09:33:29.448Z","sessionId":"90aa9b43-44e1-41b7-ae5a-cdb185eb2405","cwd":"/data/data/com.termux/files/home/SPFsmartGATE"}
|
| 31 |
+
{"error":"Server stderr: [2026-02-20T09:33:29Z INFO spf_smart_gate::config_db] SPF Config LMDB opened at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/CONFIG/CONFIG.DB\"\n[2026-02-20T09:33:29Z INFO spf_smart_gate::storage] SPF LMDB opened at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/SESSION/SESSION.DB\"\n[spf-smart-gate] Starting spf-smart-gate v3.0.0\n[spf-smart-gate] Mode: Max\n[spf-smart-gate] SPF_CONFIG LMDB active (passed from main)\n[spf-smart-gate] PROJECTS path: \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/PROJECTS/PROJECTS.DB\"\n[2026-02-20T09:33:29Z INFO spf_smart_gate::projects_db] PROJECTS LMDB opened at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/PROJECTS/PROJECTS.DB\"\n[2026-02-20T09:33:29Z INFO spf_smart_gate::projects_db] PROJECTS LMDB initialized\n[spf-smart-gate] PROJECTS LMDB initialized at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/PROJECTS/PROJECTS.DB\"\n[spf-smart-gate] TMP_DB path: \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/TMP/TMP.DB\"\n[2026-02-20T09:33:29Z INFO spf_smart_gate::tmp_db] TMP_DB LMDB opened at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/TMP/TMP.DB\"\n[spf-smart-gate] TMP_DB LMDB initialized at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/TMP/TMP.DB\"\n[spf-smart-gate] AGENT_STATE path: \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/LMDB5/LMDB5.DB\"\n[2026-02-20T09:33:29Z INFO spf_smart_gate::agent_state] Agent State LMDB opened at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/LMDB5/LMDB5.DB\"\n[spf-smart-gate] AGENT_STATE LMDB initialized at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/LMDB5/LMDB5.DB\"\n[spf-smart-gate] SPF_FS path: \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/SPF_FS\"\n[2026-02-20T09:33:29Z INFO spf_smart_gate::fs] SPF FS opened at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/SPF_FS/SPF_FS.DB\"\n[spf-smart-gate] SPF_FS LMDB initialized at \"/data/data/com.termux/files/home/SPFsmartGATE/LIVE/SPF_FS\"/SPF_FS.DB/\n[spf-smart-gate] Identity: 97e9dfc7c2aa858d4dcdc241ddd0f2d3a3c046f0fcf04ca527eb0eaf751fb5c2\n[spf-smart-gate] HTTPS API started on 0.0.0.0:3900\n[spf-smart-gate] Received: initialize\n","timestamp":"2026-02-20T09:33:29.494Z","sessionId":"90aa9b43-44e1-41b7-ae5a-cdb185eb2405","cwd":"/data/data/com.termux/files/home/SPFsmartGATE"}
|
| 32 |
+
{"debug":"Successfully connected to stdio server in 56ms","timestamp":"2026-02-20T09:33:29.494Z","sessionId":"90aa9b43-44e1-41b7-ae5a-cdb185eb2405","cwd":"/data/data/com.termux/files/home/SPFsmartGATE"}
|
| 33 |
+
{"debug":"Connection established with capabilities: {\"hasTools\":true,\"hasPrompts\":false,\"hasResources\":false,\"serverVersion\":{\"name\":\"spf-smart-gate\",\"version\":\"3.0.0\"}}","timestamp":"2026-02-20T09:33:29.494Z","sessionId":"90aa9b43-44e1-41b7-ae5a-cdb185eb2405","cwd":"/data/data/com.termux/files/home/SPFsmartGATE"}
|
.cache/pip/http-v2/5/2/3/f/f/523ff132ae8b533a32374201305af5d98433a0069c34efef8ee4975c.body
ADDED
|
Binary file (22 kB). View file
|
|
|
.cache/pip/http-v2/5/9/d/9/f/59d9f659e48ec0730ba0bb7a7dd00a671396b786d79d8d5788a07a59
ADDED
|
Binary file (1.2 kB). View file
|
|
|
.cache/pip/http-v2/5/9/d/9/f/59d9f659e48ec0730ba0bb7a7dd00a671396b786d79d8d5788a07a59.body
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.4
|
| 2 |
+
Name: meson-python
|
| 3 |
+
Version: 0.19.0
|
| 4 |
+
Summary: Meson Python build backend (PEP 517)
|
| 5 |
+
Keywords: meson,build,backend,pep517,package
|
| 6 |
+
Maintainer-Email: Ralf Gommers <ralf.gommers@gmail.com>, Daniele Nicolodi <daniele@grinta.net>, Henry Schreiner <HenrySchreinerIII@gmail.com>
|
| 7 |
+
License-Expression: MIT
|
| 8 |
+
License-File: LICENSES/MIT.txt
|
| 9 |
+
Classifier: Development Status :: 5 - Production/Stable
|
| 10 |
+
Classifier: Programming Language :: Python
|
| 11 |
+
Classifier: Topic :: Software Development :: Build Tools
|
| 12 |
+
Project-URL: homepage, https://github.com/mesonbuild/meson-python
|
| 13 |
+
Project-URL: repository, https://github.com/mesonbuild/meson-python
|
| 14 |
+
Project-URL: documentation, https://mesonbuild.com/meson-python/
|
| 15 |
+
Project-URL: changelog, https://mesonbuild.com/meson-python/changelog.html
|
| 16 |
+
Requires-Python: >=3.9
|
| 17 |
+
Requires-Dist: meson>=0.64.0; python_version < "3.12"
|
| 18 |
+
Requires-Dist: meson>=1.2.3; python_version >= "3.12"
|
| 19 |
+
Requires-Dist: packaging>=23.2; sys_platform != "ios"
|
| 20 |
+
Requires-Dist: packaging>=24.2; sys_platform == "ios"
|
| 21 |
+
Requires-Dist: pyproject-metadata>=0.9.0
|
| 22 |
+
Requires-Dist: tomli>=1.0.0; python_version < "3.11"
|
| 23 |
+
Description-Content-Type: text/x-rst
|
| 24 |
+
|
| 25 |
+
.. SPDX-FileCopyrightText: 2021 The meson-python developers
|
| 26 |
+
|
| 27 |
+
.. SPDX-License-Identifier: MIT
|
| 28 |
+
|
| 29 |
+
meson-python
|
| 30 |
+
============
|
| 31 |
+
|
| 32 |
+
``meson-python`` is a Python build back-end built on top of the Meson__
|
| 33 |
+
build system. It enables using Meson for the configuration and build
|
| 34 |
+
steps of Python packages. Meson is an open source build system meant
|
| 35 |
+
to be both extremely fast, and, even more importantly, as user
|
| 36 |
+
friendly as possible. ``meson-python`` is best suited for building
|
| 37 |
+
Python packages containing extension modules implemented in languages
|
| 38 |
+
such as C, C++, Cython, Fortran, Pythran, or Rust. Consult the
|
| 39 |
+
documentation__ for more details.
|
| 40 |
+
|
| 41 |
+
Questions regarding the use of ``meson-python`` can be directed to the
|
| 42 |
+
discussions__ space on GitHub. Bug reports and feature requests can be
|
| 43 |
+
filed as GitHub issues__.
|
| 44 |
+
|
| 45 |
+
__ https://mesonbuild.com/
|
| 46 |
+
__ https://mesonbuild.com/meson-python/
|
| 47 |
+
__ https://github.com/mesonbuild/meson-python/discussions/
|
| 48 |
+
__ https://github.com/mesonbuild/meson-python/issues/
|
.cache/pip/http-v2/6/1/b/e/5/61be51d9e3846a9e54b8840e72ddf514b2429c5292881254b289f5a8
ADDED
|
Binary file (1.12 kB). View file
|
|
|
.cache/pip/http-v2/6/2/e/2/c/62e2caaadb9fd2d0a88b65a7d2043b2c343936491ef44dc753aa91e0
ADDED
|
Binary file (1.78 kB). View file
|
|
|
.cache/pip/http-v2/6/2/e/2/c/62e2caaadb9fd2d0a88b65a7d2043b2c343936491ef44dc753aa91e0.body
ADDED
|
Binary file (21 kB). View file
|
|
|
.cache/pip/http-v2/6/5/a/f/8/65af88561e8b18ff500b9fe7d5ad34c1636e3423202d926b9e18a96f
ADDED
|
Binary file (1.19 kB). View file
|
|
|
.cache/pip/http-v2/6/5/a/f/8/65af88561e8b18ff500b9fe7d5ad34c1636e3423202d926b9e18a96f.body
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.1
|
| 2 |
+
Name: python-dateutil
|
| 3 |
+
Version: 2.9.0.post0
|
| 4 |
+
Summary: Extensions to the standard Python datetime module
|
| 5 |
+
Home-page: https://github.com/dateutil/dateutil
|
| 6 |
+
Author: Gustavo Niemeyer
|
| 7 |
+
Author-email: gustavo@niemeyer.net
|
| 8 |
+
Maintainer: Paul Ganssle
|
| 9 |
+
Maintainer-email: dateutil@python.org
|
| 10 |
+
License: Dual License
|
| 11 |
+
Project-URL: Documentation, https://dateutil.readthedocs.io/en/stable/
|
| 12 |
+
Project-URL: Source, https://github.com/dateutil/dateutil
|
| 13 |
+
Classifier: Development Status :: 5 - Production/Stable
|
| 14 |
+
Classifier: Intended Audience :: Developers
|
| 15 |
+
Classifier: License :: OSI Approved :: BSD License
|
| 16 |
+
Classifier: License :: OSI Approved :: Apache Software License
|
| 17 |
+
Classifier: Programming Language :: Python
|
| 18 |
+
Classifier: Programming Language :: Python :: 2
|
| 19 |
+
Classifier: Programming Language :: Python :: 2.7
|
| 20 |
+
Classifier: Programming Language :: Python :: 3
|
| 21 |
+
Classifier: Programming Language :: Python :: 3.3
|
| 22 |
+
Classifier: Programming Language :: Python :: 3.4
|
| 23 |
+
Classifier: Programming Language :: Python :: 3.5
|
| 24 |
+
Classifier: Programming Language :: Python :: 3.6
|
| 25 |
+
Classifier: Programming Language :: Python :: 3.7
|
| 26 |
+
Classifier: Programming Language :: Python :: 3.8
|
| 27 |
+
Classifier: Programming Language :: Python :: 3.9
|
| 28 |
+
Classifier: Programming Language :: Python :: 3.10
|
| 29 |
+
Classifier: Programming Language :: Python :: 3.11
|
| 30 |
+
Classifier: Programming Language :: Python :: 3.12
|
| 31 |
+
Classifier: Topic :: Software Development :: Libraries
|
| 32 |
+
Requires-Python: !=3.0.*,!=3.1.*,!=3.2.*,>=2.7
|
| 33 |
+
Description-Content-Type: text/x-rst
|
| 34 |
+
License-File: LICENSE
|
| 35 |
+
Requires-Dist: six >=1.5
|
| 36 |
+
|
| 37 |
+
dateutil - powerful extensions to datetime
|
| 38 |
+
==========================================
|
| 39 |
+
|
| 40 |
+
|pypi| |support| |licence|
|
| 41 |
+
|
| 42 |
+
|gitter| |readthedocs|
|
| 43 |
+
|
| 44 |
+
|travis| |appveyor| |pipelines| |coverage|
|
| 45 |
+
|
| 46 |
+
.. |pypi| image:: https://img.shields.io/pypi/v/python-dateutil.svg?style=flat-square
|
| 47 |
+
:target: https://pypi.org/project/python-dateutil/
|
| 48 |
+
:alt: pypi version
|
| 49 |
+
|
| 50 |
+
.. |support| image:: https://img.shields.io/pypi/pyversions/python-dateutil.svg?style=flat-square
|
| 51 |
+
:target: https://pypi.org/project/python-dateutil/
|
| 52 |
+
:alt: supported Python version
|
| 53 |
+
|
| 54 |
+
.. |travis| image:: https://img.shields.io/travis/dateutil/dateutil/master.svg?style=flat-square&label=Travis%20Build
|
| 55 |
+
:target: https://travis-ci.org/dateutil/dateutil
|
| 56 |
+
:alt: travis build status
|
| 57 |
+
|
| 58 |
+
.. |appveyor| image:: https://img.shields.io/appveyor/ci/dateutil/dateutil/master.svg?style=flat-square&logo=appveyor
|
| 59 |
+
:target: https://ci.appveyor.com/project/dateutil/dateutil
|
| 60 |
+
:alt: appveyor build status
|
| 61 |
+
|
| 62 |
+
.. |pipelines| image:: https://dev.azure.com/pythondateutilazure/dateutil/_apis/build/status/dateutil.dateutil?branchName=master
|
| 63 |
+
:target: https://dev.azure.com/pythondateutilazure/dateutil/_build/latest?definitionId=1&branchName=master
|
| 64 |
+
:alt: azure pipelines build status
|
| 65 |
+
|
| 66 |
+
.. |coverage| image:: https://codecov.io/gh/dateutil/dateutil/branch/master/graphs/badge.svg?branch=master
|
| 67 |
+
:target: https://codecov.io/gh/dateutil/dateutil?branch=master
|
| 68 |
+
:alt: Code coverage
|
| 69 |
+
|
| 70 |
+
.. |gitter| image:: https://badges.gitter.im/dateutil/dateutil.svg
|
| 71 |
+
:alt: Join the chat at https://gitter.im/dateutil/dateutil
|
| 72 |
+
:target: https://gitter.im/dateutil/dateutil
|
| 73 |
+
|
| 74 |
+
.. |licence| image:: https://img.shields.io/pypi/l/python-dateutil.svg?style=flat-square
|
| 75 |
+
:target: https://pypi.org/project/python-dateutil/
|
| 76 |
+
:alt: licence
|
| 77 |
+
|
| 78 |
+
.. |readthedocs| image:: https://img.shields.io/readthedocs/dateutil/latest.svg?style=flat-square&label=Read%20the%20Docs
|
| 79 |
+
:alt: Read the documentation at https://dateutil.readthedocs.io/en/latest/
|
| 80 |
+
:target: https://dateutil.readthedocs.io/en/latest/
|
| 81 |
+
|
| 82 |
+
The `dateutil` module provides powerful extensions to
|
| 83 |
+
the standard `datetime` module, available in Python.
|
| 84 |
+
|
| 85 |
+
Installation
|
| 86 |
+
============
|
| 87 |
+
`dateutil` can be installed from PyPI using `pip` (note that the package name is
|
| 88 |
+
different from the importable name)::
|
| 89 |
+
|
| 90 |
+
pip install python-dateutil
|
| 91 |
+
|
| 92 |
+
Download
|
| 93 |
+
========
|
| 94 |
+
dateutil is available on PyPI
|
| 95 |
+
https://pypi.org/project/python-dateutil/
|
| 96 |
+
|
| 97 |
+
The documentation is hosted at:
|
| 98 |
+
https://dateutil.readthedocs.io/en/stable/
|
| 99 |
+
|
| 100 |
+
Code
|
| 101 |
+
====
|
| 102 |
+
The code and issue tracker are hosted on GitHub:
|
| 103 |
+
https://github.com/dateutil/dateutil/
|
| 104 |
+
|
| 105 |
+
Features
|
| 106 |
+
========
|
| 107 |
+
|
| 108 |
+
* Computing of relative deltas (next month, next year,
|
| 109 |
+
next Monday, last week of month, etc);
|
| 110 |
+
* Computing of relative deltas between two given
|
| 111 |
+
date and/or datetime objects;
|
| 112 |
+
* Computing of dates based on very flexible recurrence rules,
|
| 113 |
+
using a superset of the `iCalendar <https://www.ietf.org/rfc/rfc2445.txt>`_
|
| 114 |
+
specification. Parsing of RFC strings is supported as well.
|
| 115 |
+
* Generic parsing of dates in almost any string format;
|
| 116 |
+
* Timezone (tzinfo) implementations for tzfile(5) format
|
| 117 |
+
files (/etc/localtime, /usr/share/zoneinfo, etc), TZ
|
| 118 |
+
environment string (in all known formats), iCalendar
|
| 119 |
+
format files, given ranges (with help from relative deltas),
|
| 120 |
+
local machine timezone, fixed offset timezone, UTC timezone,
|
| 121 |
+
and Windows registry-based time zones.
|
| 122 |
+
* Internal up-to-date world timezone information based on
|
| 123 |
+
Olson's database.
|
| 124 |
+
* Computing of Easter Sunday dates for any given year,
|
| 125 |
+
using Western, Orthodox or Julian algorithms;
|
| 126 |
+
* A comprehensive test suite.
|
| 127 |
+
|
| 128 |
+
Quick example
|
| 129 |
+
=============
|
| 130 |
+
Here's a snapshot, just to give an idea about the power of the
|
| 131 |
+
package. For more examples, look at the documentation.
|
| 132 |
+
|
| 133 |
+
Suppose you want to know how much time is left, in
|
| 134 |
+
years/months/days/etc, before the next easter happening on a
|
| 135 |
+
year with a Friday 13th in August, and you want to get today's
|
| 136 |
+
date out of the "date" unix system command. Here is the code:
|
| 137 |
+
|
| 138 |
+
.. code-block:: python3
|
| 139 |
+
|
| 140 |
+
>>> from dateutil.relativedelta import *
|
| 141 |
+
>>> from dateutil.easter import *
|
| 142 |
+
>>> from dateutil.rrule import *
|
| 143 |
+
>>> from dateutil.parser import *
|
| 144 |
+
>>> from datetime import *
|
| 145 |
+
>>> now = parse("Sat Oct 11 17:13:46 UTC 2003")
|
| 146 |
+
>>> today = now.date()
|
| 147 |
+
>>> year = rrule(YEARLY,dtstart=now,bymonth=8,bymonthday=13,byweekday=FR)[0].year
|
| 148 |
+
>>> rdelta = relativedelta(easter(year), today)
|
| 149 |
+
>>> print("Today is: %s" % today)
|
| 150 |
+
Today is: 2003-10-11
|
| 151 |
+
>>> print("Year with next Aug 13th on a Friday is: %s" % year)
|
| 152 |
+
Year with next Aug 13th on a Friday is: 2004
|
| 153 |
+
>>> print("How far is the Easter of that year: %s" % rdelta)
|
| 154 |
+
How far is the Easter of that year: relativedelta(months=+6)
|
| 155 |
+
>>> print("And the Easter of that year is: %s" % (today+rdelta))
|
| 156 |
+
And the Easter of that year is: 2004-04-11
|
| 157 |
+
|
| 158 |
+
Being exactly 6 months ahead was **really** a coincidence :)
|
| 159 |
+
|
| 160 |
+
Contributing
|
| 161 |
+
============
|
| 162 |
+
|
| 163 |
+
We welcome many types of contributions - bug reports, pull requests (code, infrastructure or documentation fixes). For more information about how to contribute to the project, see the ``CONTRIBUTING.md`` file in the repository.
|
| 164 |
+
|
| 165 |
+
|
| 166 |
+
Author
|
| 167 |
+
======
|
| 168 |
+
The dateutil module was written by Gustavo Niemeyer <gustavo@niemeyer.net>
|
| 169 |
+
in 2003.
|
| 170 |
+
|
| 171 |
+
It is maintained by:
|
| 172 |
+
|
| 173 |
+
* Gustavo Niemeyer <gustavo@niemeyer.net> 2003-2011
|
| 174 |
+
* Tomi Pieviläinen <tomi.pievilainen@iki.fi> 2012-2014
|
| 175 |
+
* Yaron de Leeuw <me@jarondl.net> 2014-2016
|
| 176 |
+
* Paul Ganssle <paul@ganssle.io> 2015-
|
| 177 |
+
|
| 178 |
+
Starting with version 2.4.1 and running until 2.8.2, all source and binary
|
| 179 |
+
distributions will be signed by a PGP key that has, at the very least, been
|
| 180 |
+
signed by the key which made the previous release. A table of release signing
|
| 181 |
+
keys can be found below:
|
| 182 |
+
|
| 183 |
+
=========== ============================
|
| 184 |
+
Releases Signing key fingerprint
|
| 185 |
+
=========== ============================
|
| 186 |
+
2.4.1-2.8.2 `6B49 ACBA DCF6 BD1C A206 67AB CD54 FCE3 D964 BEFB`_
|
| 187 |
+
=========== ============================
|
| 188 |
+
|
| 189 |
+
New releases *may* have signed tags, but binary and source distributions
|
| 190 |
+
uploaded to PyPI will no longer have GPG signatures attached.
|
| 191 |
+
|
| 192 |
+
Contact
|
| 193 |
+
=======
|
| 194 |
+
Our mailing list is available at `dateutil@python.org <https://mail.python.org/mailman/listinfo/dateutil>`_. As it is hosted by the PSF, it is subject to the `PSF code of
|
| 195 |
+
conduct <https://www.python.org/psf/conduct/>`_.
|
| 196 |
+
|
| 197 |
+
License
|
| 198 |
+
=======
|
| 199 |
+
|
| 200 |
+
All contributions after December 1, 2017 released under dual license - either `Apache 2.0 License <https://www.apache.org/licenses/LICENSE-2.0>`_ or the `BSD 3-Clause License <https://opensource.org/licenses/BSD-3-Clause>`_. Contributions before December 1, 2017 - except those those explicitly relicensed - are released only under the BSD 3-Clause License.
|
| 201 |
+
|
| 202 |
+
|
| 203 |
+
.. _6B49 ACBA DCF6 BD1C A206 67AB CD54 FCE3 D964 BEFB:
|
| 204 |
+
https://pgp.mit.edu/pks/lookup?op=vindex&search=0xCD54FCE3D964BEFB
|
.cache/pip/http-v2/6/6/d/c/a/66dca7bbc71fbb8945b23750a7adc3b26c5b4522cea5aa217a9904f2
ADDED
|
Binary file (1.78 kB). View file
|
|
|
.cache/pip/http-v2/6/6/d/c/a/66dca7bbc71fbb8945b23750a7adc3b26c5b4522cea5aa217a9904f2.body
ADDED
|
Binary file (32.3 kB). View file
|
|
|
.cache/pip/http-v2/6/6/e/c/7/66ec76a7b6ed4081044f5c7821af293b63c17bc2ac523ff93d5ca7d5
ADDED
|
Binary file (1.87 kB). View file
|
|
|
.cache/pip/http-v2/6/a/0/8/8/6a088fc192b69f4692b96903e0d1df2f92839b402221a47a2ca3b5be
ADDED
|
Binary file (1.23 kB). View file
|
|
|
.cache/pip/http-v2/6/a/0/8/8/6a088fc192b69f4692b96903e0d1df2f92839b402221a47a2ca3b5be.body
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.4
|
| 2 |
+
Name: trove-classifiers
|
| 3 |
+
Version: 2026.1.14.14
|
| 4 |
+
Summary: Canonical source for classifiers on PyPI (pypi.org).
|
| 5 |
+
Home-page: https://github.com/pypa/trove-classifiers
|
| 6 |
+
Author: The PyPI Admins
|
| 7 |
+
Author-email: admin@pypi.org
|
| 8 |
+
Keywords: classifiers
|
| 9 |
+
Classifier: Development Status :: 5 - Production/Stable
|
| 10 |
+
Classifier: Intended Audience :: Developers
|
| 11 |
+
Classifier: License :: OSI Approved :: Apache Software License
|
| 12 |
+
Classifier: Programming Language :: Python :: 3
|
| 13 |
+
Classifier: Typing :: Typed
|
| 14 |
+
Description-Content-Type: text/markdown
|
| 15 |
+
License-File: LICENSE
|
| 16 |
+
Dynamic: author
|
| 17 |
+
Dynamic: author-email
|
| 18 |
+
Dynamic: classifier
|
| 19 |
+
Dynamic: description
|
| 20 |
+
Dynamic: description-content-type
|
| 21 |
+
Dynamic: home-page
|
| 22 |
+
Dynamic: keywords
|
| 23 |
+
Dynamic: license-file
|
| 24 |
+
Dynamic: summary
|
| 25 |
+
|
| 26 |
+
Canonical source for [classifiers][1] on [PyPI][2].
|
| 27 |
+
|
| 28 |
+
Classifiers [categorize projects][3] per [PEP 301][4]. Use this package to
|
| 29 |
+
validate classifiers in packages for PyPI upload or download.
|
| 30 |
+
|
| 31 |
+
## Usage
|
| 32 |
+
|
| 33 |
+
To install [from PyPI][5]:
|
| 34 |
+
|
| 35 |
+
```
|
| 36 |
+
$ pip install trove-classifiers
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
This package can be invoked as a module to print a list of classifiers:
|
| 40 |
+
|
| 41 |
+
```
|
| 42 |
+
$ python -m trove_classifiers | grep -Ei pyramid
|
| 43 |
+
Framework :: Pyramid
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
In addition, this package's API is two importable objects:
|
| 47 |
+
|
| 48 |
+
### Classifiers (`trove_classifiers.classifiers`)
|
| 49 |
+
A `set` containing classifiers (as strings). Useful for determining membership.
|
| 50 |
+
|
| 51 |
+
Example - determine if a classifier is valid:
|
| 52 |
+
|
| 53 |
+
```python
|
| 54 |
+
>>> from trove_classifiers import classifiers
|
| 55 |
+
>>> 'License :: OSI Approved' in classifiers
|
| 56 |
+
True
|
| 57 |
+
>>> 'Fuzzy :: Wuzzy :: Was :: A :: Bear' in classifiers
|
| 58 |
+
False
|
| 59 |
+
>>>
|
| 60 |
+
```
|
| 61 |
+
|
| 62 |
+
### Deprecated classifiers (`trove_classifiers.deprecated_classifiers`)
|
| 63 |
+
A `dict`, mapping a deprecated classifier (string) to a list of classifiers
|
| 64 |
+
which replaces it (strings).
|
| 65 |
+
|
| 66 |
+
Example - determine if a classifier is deprecated:
|
| 67 |
+
|
| 68 |
+
```python
|
| 69 |
+
>>> from trove_classifiers import deprecated_classifiers
|
| 70 |
+
>>> 'License :: OSI Approved' in deprecated_classifiers
|
| 71 |
+
False
|
| 72 |
+
>>> 'Natural Language :: Ukranian' in deprecated_classifiers
|
| 73 |
+
True
|
| 74 |
+
>>> deprecated_classifiers["Natural Language :: Ukranian"]
|
| 75 |
+
['Natural Language :: Ukrainian']
|
| 76 |
+
```
|
| 77 |
+
|
| 78 |
+
[1]: https://pypi.org/classifiers/
|
| 79 |
+
[2]: https://pypi.org
|
| 80 |
+
[3]: https://packaging.python.org/specifications/core-metadata/#classifier-multiple-use
|
| 81 |
+
[4]: https://www.python.org/dev/peps/pep-0301/
|
| 82 |
+
[5]: https://pypi.org/project/trove-classifiers/
|
.cache/pip/http-v2/6/d/9/b/b/6d9bb16a8c20d3783bba80b903556e9537f366b232ea15e3fef0a8a6
ADDED
|
Binary file (1.22 kB). View file
|
|
|
.cache/pip/http-v2/6/d/9/b/b/6d9bb16a8c20d3783bba80b903556e9537f366b232ea15e3fef0a8a6.body
ADDED
|
@@ -0,0 +1,2085 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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: Apache-2.0
|
| 7 |
+
Project-URL: Homepage, https://github.com/googleapis/python-genai
|
| 8 |
+
Classifier: Intended Audience :: Developers
|
| 9 |
+
Classifier: Operating System :: OS Independent
|
| 10 |
+
Classifier: Programming Language :: Python
|
| 11 |
+
Classifier: Programming Language :: Python :: 3
|
| 12 |
+
Classifier: Programming Language :: Python :: 3.10
|
| 13 |
+
Classifier: Programming Language :: Python :: 3.11
|
| 14 |
+
Classifier: Programming Language :: Python :: 3.12
|
| 15 |
+
Classifier: Programming Language :: Python :: 3.13
|
| 16 |
+
Classifier: Programming Language :: Python :: 3.14
|
| 17 |
+
Classifier: Topic :: Internet
|
| 18 |
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
| 19 |
+
Requires-Python: >=3.10
|
| 20 |
+
Description-Content-Type: text/markdown
|
| 21 |
+
License-File: LICENSE
|
| 22 |
+
Requires-Dist: anyio<5.0.0,>=4.8.0
|
| 23 |
+
Requires-Dist: google-auth[requests]<3.0.0,>=2.47.0
|
| 24 |
+
Requires-Dist: httpx<1.0.0,>=0.28.1
|
| 25 |
+
Requires-Dist: pydantic<3.0.0,>=2.9.0
|
| 26 |
+
Requires-Dist: requests<3.0.0,>=2.28.1
|
| 27 |
+
Requires-Dist: tenacity<9.2.0,>=8.2.3
|
| 28 |
+
Requires-Dist: websockets<15.1.0,>=13.0.0
|
| 29 |
+
Requires-Dist: typing-extensions<5.0.0,>=4.11.0
|
| 30 |
+
Requires-Dist: distro<2,>=1.7.0
|
| 31 |
+
Requires-Dist: sniffio
|
| 32 |
+
Requires-Dist: aiohttp>=3.10.11
|
| 33 |
+
Provides-Extra: aiohttp
|
| 34 |
+
Requires-Dist: aiohttp<3.13.3; extra == "aiohttp"
|
| 35 |
+
Provides-Extra: local-tokenizer
|
| 36 |
+
Requires-Dist: sentencepiece>=0.2.0; extra == "local-tokenizer"
|
| 37 |
+
Requires-Dist: protobuf; extra == "local-tokenizer"
|
| 38 |
+
Dynamic: license-file
|
| 39 |
+
|
| 40 |
+
# Google Gen AI SDK
|
| 41 |
+
|
| 42 |
+
[](https://pypi.org/project/google-genai/)
|
| 43 |
+

|
| 44 |
+
[](https://pypistats.org/packages/google-genai)
|
| 45 |
+
|
| 46 |
+
--------
|
| 47 |
+
**Documentation:** https://googleapis.github.io/python-genai/
|
| 48 |
+
|
| 49 |
+
-----
|
| 50 |
+
|
| 51 |
+
Google Gen AI Python SDK provides an interface for developers to integrate
|
| 52 |
+
Google's generative models into their Python applications. It supports the
|
| 53 |
+
[Gemini Developer API](https://ai.google.dev/gemini-api/docs) and
|
| 54 |
+
[Vertex AI](https://cloud.google.com/vertex-ai/generative-ai/docs/learn/overview)
|
| 55 |
+
APIs.
|
| 56 |
+
|
| 57 |
+
## Code Generation
|
| 58 |
+
|
| 59 |
+
Generative models are often unaware of recent API and SDK updates and may suggest outdated or legacy code.
|
| 60 |
+
|
| 61 |
+
We recommend using our Code Generation instructions [`codegen_instructions.md`](https://raw.githubusercontent.com/googleapis/python-genai/refs/heads/main/codegen_instructions.md) when generating Google Gen AI SDK code to guide your model towards using the more recent SDK features. Copy and paste the instructions into your development environment to provide the model with the necessary context.
|
| 62 |
+
|
| 63 |
+
## Installation
|
| 64 |
+
|
| 65 |
+
```sh
|
| 66 |
+
pip install google-genai
|
| 67 |
+
```
|
| 68 |
+
|
| 69 |
+
<small>With `uv`:</small>
|
| 70 |
+
|
| 71 |
+
```sh
|
| 72 |
+
uv pip install google-genai
|
| 73 |
+
```
|
| 74 |
+
|
| 75 |
+
## Imports
|
| 76 |
+
|
| 77 |
+
```python
|
| 78 |
+
from google import genai
|
| 79 |
+
from google.genai import types
|
| 80 |
+
```
|
| 81 |
+
|
| 82 |
+
## Create a client
|
| 83 |
+
|
| 84 |
+
Please run one of the following code blocks to create a client for
|
| 85 |
+
different services ([Gemini Developer API](https://ai.google.dev/gemini-api/docs) or [Vertex AI](https://cloud.google.com/vertex-ai/generative-ai/docs/learn/overview)).
|
| 86 |
+
|
| 87 |
+
```python
|
| 88 |
+
from google import genai
|
| 89 |
+
|
| 90 |
+
# Only run this block for Gemini Developer API
|
| 91 |
+
client = genai.Client(api_key='GEMINI_API_KEY')
|
| 92 |
+
```
|
| 93 |
+
|
| 94 |
+
```python
|
| 95 |
+
from google import genai
|
| 96 |
+
|
| 97 |
+
# Only run this block for Vertex AI API
|
| 98 |
+
client = genai.Client(
|
| 99 |
+
vertexai=True, project='your-project-id', location='us-central1'
|
| 100 |
+
)
|
| 101 |
+
```
|
| 102 |
+
|
| 103 |
+
## Using types
|
| 104 |
+
|
| 105 |
+
All API methods support Pydantic types and dictionaries, which you can access
|
| 106 |
+
from `google.genai.types`. You can import the types module with the following:
|
| 107 |
+
|
| 108 |
+
```python
|
| 109 |
+
from google.genai import types
|
| 110 |
+
```
|
| 111 |
+
|
| 112 |
+
Below is an example `generate_content()` call using types from the types module:
|
| 113 |
+
|
| 114 |
+
```python
|
| 115 |
+
response = client.models.generate_content(
|
| 116 |
+
model='gemini-2.5-flash',
|
| 117 |
+
contents=types.Part.from_text(text='Why is the sky blue?'),
|
| 118 |
+
config=types.GenerateContentConfig(
|
| 119 |
+
temperature=0,
|
| 120 |
+
top_p=0.95,
|
| 121 |
+
top_k=20,
|
| 122 |
+
),
|
| 123 |
+
)
|
| 124 |
+
```
|
| 125 |
+
|
| 126 |
+
Alternatively, you can accomplish the same request using dictionaries instead of
|
| 127 |
+
types:
|
| 128 |
+
|
| 129 |
+
```python
|
| 130 |
+
response = client.models.generate_content(
|
| 131 |
+
model='gemini-2.5-flash',
|
| 132 |
+
contents={'text': 'Why is the sky blue?'},
|
| 133 |
+
config={
|
| 134 |
+
'temperature': 0,
|
| 135 |
+
'top_p': 0.95,
|
| 136 |
+
'top_k': 20,
|
| 137 |
+
},
|
| 138 |
+
)
|
| 139 |
+
```
|
| 140 |
+
|
| 141 |
+
**(Optional) Using environment variables:**
|
| 142 |
+
|
| 143 |
+
You can create a client by configuring the necessary environment variables.
|
| 144 |
+
Configuration setup instructions depends on whether you're using the Gemini
|
| 145 |
+
Developer API or the Gemini API in Vertex AI.
|
| 146 |
+
|
| 147 |
+
**Gemini Developer API:** Set the `GEMINI_API_KEY` or `GOOGLE_API_KEY`.
|
| 148 |
+
It will automatically be picked up by the client. It's recommended that you
|
| 149 |
+
set only one of those variables, but if both are set, `GOOGLE_API_KEY` takes
|
| 150 |
+
precedence.
|
| 151 |
+
|
| 152 |
+
```bash
|
| 153 |
+
export GEMINI_API_KEY='your-api-key'
|
| 154 |
+
```
|
| 155 |
+
|
| 156 |
+
**Gemini API on Vertex AI:** Set `GOOGLE_GENAI_USE_VERTEXAI`,
|
| 157 |
+
`GOOGLE_CLOUD_PROJECT` and `GOOGLE_CLOUD_LOCATION`, as shown below:
|
| 158 |
+
|
| 159 |
+
```bash
|
| 160 |
+
export GOOGLE_GENAI_USE_VERTEXAI=true
|
| 161 |
+
export GOOGLE_CLOUD_PROJECT='your-project-id'
|
| 162 |
+
export GOOGLE_CLOUD_LOCATION='us-central1'
|
| 163 |
+
```
|
| 164 |
+
|
| 165 |
+
```python
|
| 166 |
+
from google import genai
|
| 167 |
+
|
| 168 |
+
client = genai.Client()
|
| 169 |
+
```
|
| 170 |
+
|
| 171 |
+
## Close a client
|
| 172 |
+
|
| 173 |
+
Explicitly close the sync client to ensure that resources, such as the
|
| 174 |
+
underlying HTTP connections, are properly cleaned up and closed.
|
| 175 |
+
|
| 176 |
+
```python
|
| 177 |
+
from google.genai import Client
|
| 178 |
+
|
| 179 |
+
client = Client()
|
| 180 |
+
response_1 = client.models.generate_content(
|
| 181 |
+
model=MODEL_ID,
|
| 182 |
+
contents='Hello',
|
| 183 |
+
)
|
| 184 |
+
response_2 = client.models.generate_content(
|
| 185 |
+
model=MODEL_ID,
|
| 186 |
+
contents='Ask a question',
|
| 187 |
+
)
|
| 188 |
+
# Close the sync client to release resources.
|
| 189 |
+
client.close()
|
| 190 |
+
```
|
| 191 |
+
|
| 192 |
+
To explicitly close the async client:
|
| 193 |
+
|
| 194 |
+
```python
|
| 195 |
+
from google.genai import Client
|
| 196 |
+
|
| 197 |
+
aclient = Client(
|
| 198 |
+
vertexai=True, project='my-project-id', location='us-central1'
|
| 199 |
+
).aio
|
| 200 |
+
response_1 = await aclient.models.generate_content(
|
| 201 |
+
model=MODEL_ID,
|
| 202 |
+
contents='Hello',
|
| 203 |
+
)
|
| 204 |
+
response_2 = await aclient.models.generate_content(
|
| 205 |
+
model=MODEL_ID,
|
| 206 |
+
contents='Ask a question',
|
| 207 |
+
)
|
| 208 |
+
# Close the async client to release resources.
|
| 209 |
+
await aclient.aclose()
|
| 210 |
+
```
|
| 211 |
+
|
| 212 |
+
## Client context managers
|
| 213 |
+
|
| 214 |
+
By using the sync client context manager, it will close the underlying
|
| 215 |
+
sync client when exiting the with block and avoid httpx "client has been closed" error like [issues#1763](https://github.com/googleapis/python-genai/issues/1763).
|
| 216 |
+
|
| 217 |
+
```python
|
| 218 |
+
from google.genai import Client
|
| 219 |
+
|
| 220 |
+
with Client() as client:
|
| 221 |
+
response_1 = client.models.generate_content(
|
| 222 |
+
model=MODEL_ID,
|
| 223 |
+
contents='Hello',
|
| 224 |
+
)
|
| 225 |
+
response_2 = client.models.generate_content(
|
| 226 |
+
model=MODEL_ID,
|
| 227 |
+
contents='Ask a question',
|
| 228 |
+
)
|
| 229 |
+
```
|
| 230 |
+
|
| 231 |
+
By using the async client context manager, it will close the underlying
|
| 232 |
+
async client when exiting the with block.
|
| 233 |
+
|
| 234 |
+
```python
|
| 235 |
+
from google.genai import Client
|
| 236 |
+
|
| 237 |
+
async with Client().aio as aclient:
|
| 238 |
+
response_1 = await aclient.models.generate_content(
|
| 239 |
+
model=MODEL_ID,
|
| 240 |
+
contents='Hello',
|
| 241 |
+
)
|
| 242 |
+
response_2 = await aclient.models.generate_content(
|
| 243 |
+
model=MODEL_ID,
|
| 244 |
+
contents='Ask a question',
|
| 245 |
+
)
|
| 246 |
+
```
|
| 247 |
+
|
| 248 |
+
### API Selection
|
| 249 |
+
|
| 250 |
+
By default, the SDK uses the beta API endpoints provided by Google to support
|
| 251 |
+
preview features in the APIs. The stable API endpoints can be selected by
|
| 252 |
+
setting the API version to `v1`.
|
| 253 |
+
|
| 254 |
+
To set the API version use `http_options`. For example, to set the API version
|
| 255 |
+
to `v1` for Vertex AI:
|
| 256 |
+
|
| 257 |
+
```python
|
| 258 |
+
from google import genai
|
| 259 |
+
from google.genai import types
|
| 260 |
+
|
| 261 |
+
client = genai.Client(
|
| 262 |
+
vertexai=True,
|
| 263 |
+
project='your-project-id',
|
| 264 |
+
location='us-central1',
|
| 265 |
+
http_options=types.HttpOptions(api_version='v1')
|
| 266 |
+
)
|
| 267 |
+
```
|
| 268 |
+
|
| 269 |
+
To set the API version to `v1alpha` for the Gemini Developer API:
|
| 270 |
+
|
| 271 |
+
```python
|
| 272 |
+
from google import genai
|
| 273 |
+
from google.genai import types
|
| 274 |
+
|
| 275 |
+
client = genai.Client(
|
| 276 |
+
api_key='GEMINI_API_KEY',
|
| 277 |
+
http_options=types.HttpOptions(api_version='v1alpha')
|
| 278 |
+
)
|
| 279 |
+
```
|
| 280 |
+
|
| 281 |
+
### Faster async client option: Aiohttp
|
| 282 |
+
|
| 283 |
+
By default we use httpx for both sync and async client implementations. In order
|
| 284 |
+
to have faster performance, you may install `google-genai[aiohttp]`. In Gen AI
|
| 285 |
+
SDK we configure `trust_env=True` to match with the default behavior of httpx.
|
| 286 |
+
Additional args of `aiohttp.ClientSession.request()` ([see `_RequestOptions` args](https://github.com/aio-libs/aiohttp/blob/v3.12.13/aiohttp/client.py#L170)) can be passed
|
| 287 |
+
through the following way:
|
| 288 |
+
|
| 289 |
+
```python
|
| 290 |
+
http_options = types.HttpOptions(
|
| 291 |
+
async_client_args={'cookies': ..., 'ssl': ...},
|
| 292 |
+
)
|
| 293 |
+
|
| 294 |
+
client=Client(..., http_options=http_options)
|
| 295 |
+
```
|
| 296 |
+
|
| 297 |
+
### Proxy
|
| 298 |
+
|
| 299 |
+
Both httpx and aiohttp libraries use `urllib.request.getproxies` from
|
| 300 |
+
environment variables. Before client initialization, you may set proxy (and
|
| 301 |
+
optional `SSL_CERT_FILE`) by setting the environment variables:
|
| 302 |
+
|
| 303 |
+
```bash
|
| 304 |
+
export HTTPS_PROXY='http://username:password@proxy_uri:port'
|
| 305 |
+
export SSL_CERT_FILE='client.pem'
|
| 306 |
+
```
|
| 307 |
+
|
| 308 |
+
If you need `socks5` proxy, httpx [supports](https://www.python-httpx.org/advanced/proxies/#socks) `socks5` proxy if you pass it via
|
| 309 |
+
args to `httpx.Client()`. You may install `httpx[socks]` to use it.
|
| 310 |
+
Then, you can pass it through the following way:
|
| 311 |
+
|
| 312 |
+
```python
|
| 313 |
+
http_options = types.HttpOptions(
|
| 314 |
+
client_args={'proxy': 'socks5://user:pass@host:port'},
|
| 315 |
+
async_client_args={'proxy': 'socks5://user:pass@host:port'},
|
| 316 |
+
)
|
| 317 |
+
|
| 318 |
+
client=Client(..., http_options=http_options)
|
| 319 |
+
```
|
| 320 |
+
|
| 321 |
+
### Custom base url
|
| 322 |
+
|
| 323 |
+
In some cases you might need a custom base url (for example, API gateway proxy
|
| 324 |
+
server) and bypass some authentication checks for project, location, or API key.
|
| 325 |
+
You may pass the custom base url like this:
|
| 326 |
+
|
| 327 |
+
```python
|
| 328 |
+
base_url = 'https://test-api-gateway-proxy.com'
|
| 329 |
+
client = Client(
|
| 330 |
+
vertexai=True, # Currently only vertexai=True is supported
|
| 331 |
+
http_options={
|
| 332 |
+
'base_url': base_url,
|
| 333 |
+
'headers': {'Authorization': 'Bearer test_token'},
|
| 334 |
+
},
|
| 335 |
+
)
|
| 336 |
+
```
|
| 337 |
+
|
| 338 |
+
## Types
|
| 339 |
+
|
| 340 |
+
Parameter types can be specified as either dictionaries(`TypedDict`) or
|
| 341 |
+
[Pydantic Models](https://pydantic.readthedocs.io/en/stable/model.html).
|
| 342 |
+
Pydantic model types are available in the `types` module.
|
| 343 |
+
|
| 344 |
+
## Models
|
| 345 |
+
|
| 346 |
+
The `client.models` module exposes model inferencing and model getters.
|
| 347 |
+
See the 'Create a client' section above to initialize a client.
|
| 348 |
+
|
| 349 |
+
### Generate Content
|
| 350 |
+
|
| 351 |
+
#### with text content input (text output)
|
| 352 |
+
|
| 353 |
+
```python
|
| 354 |
+
response = client.models.generate_content(
|
| 355 |
+
model='gemini-2.5-flash', contents='Why is the sky blue?'
|
| 356 |
+
)
|
| 357 |
+
print(response.text)
|
| 358 |
+
```
|
| 359 |
+
|
| 360 |
+
#### with text content input (image output)
|
| 361 |
+
|
| 362 |
+
```python
|
| 363 |
+
from google.genai import types
|
| 364 |
+
|
| 365 |
+
response = client.models.generate_content(
|
| 366 |
+
model='gemini-2.5-flash-image',
|
| 367 |
+
contents='A cartoon infographic for flying sneakers',
|
| 368 |
+
config=types.GenerateContentConfig(
|
| 369 |
+
response_modalities=["IMAGE"],
|
| 370 |
+
image_config=types.ImageConfig(
|
| 371 |
+
aspect_ratio="9:16",
|
| 372 |
+
),
|
| 373 |
+
),
|
| 374 |
+
)
|
| 375 |
+
|
| 376 |
+
for part in response.parts:
|
| 377 |
+
if part.inline_data:
|
| 378 |
+
generated_image = part.as_image()
|
| 379 |
+
generated_image.show()
|
| 380 |
+
```
|
| 381 |
+
|
| 382 |
+
#### with uploaded file (Gemini Developer API only)
|
| 383 |
+
|
| 384 |
+
Download the file in console.
|
| 385 |
+
|
| 386 |
+
```sh
|
| 387 |
+
!wget -q https://storage.googleapis.com/generativeai-downloads/data/a11.txt
|
| 388 |
+
```
|
| 389 |
+
|
| 390 |
+
python code.
|
| 391 |
+
|
| 392 |
+
```python
|
| 393 |
+
file = client.files.upload(file='a11.txt')
|
| 394 |
+
response = client.models.generate_content(
|
| 395 |
+
model='gemini-2.5-flash',
|
| 396 |
+
contents=['Could you summarize this file?', file]
|
| 397 |
+
)
|
| 398 |
+
print(response.text)
|
| 399 |
+
```
|
| 400 |
+
|
| 401 |
+
#### How to structure `contents` argument for `generate_content`
|
| 402 |
+
|
| 403 |
+
The SDK always converts the inputs to the `contents` argument into
|
| 404 |
+
`list[types.Content]`.
|
| 405 |
+
The following shows some common ways to provide your inputs.
|
| 406 |
+
|
| 407 |
+
##### Provide a `list[types.Content]`
|
| 408 |
+
|
| 409 |
+
This is the canonical way to provide contents, SDK will not do any conversion.
|
| 410 |
+
|
| 411 |
+
##### Provide a `types.Content` instance
|
| 412 |
+
|
| 413 |
+
```python
|
| 414 |
+
from google.genai import types
|
| 415 |
+
|
| 416 |
+
contents = types.Content(
|
| 417 |
+
role='user',
|
| 418 |
+
parts=[types.Part.from_text(text='Why is the sky blue?')]
|
| 419 |
+
)
|
| 420 |
+
```
|
| 421 |
+
|
| 422 |
+
SDK converts this to
|
| 423 |
+
|
| 424 |
+
```python
|
| 425 |
+
[
|
| 426 |
+
types.Content(
|
| 427 |
+
role='user',
|
| 428 |
+
parts=[types.Part.from_text(text='Why is the sky blue?')]
|
| 429 |
+
)
|
| 430 |
+
]
|
| 431 |
+
```
|
| 432 |
+
|
| 433 |
+
##### Provide a string
|
| 434 |
+
|
| 435 |
+
```python
|
| 436 |
+
contents='Why is the sky blue?'
|
| 437 |
+
```
|
| 438 |
+
|
| 439 |
+
The SDK will assume this is a text part, and it converts this into the following:
|
| 440 |
+
|
| 441 |
+
```python
|
| 442 |
+
[
|
| 443 |
+
types.UserContent(
|
| 444 |
+
parts=[
|
| 445 |
+
types.Part.from_text(text='Why is the sky blue?')
|
| 446 |
+
]
|
| 447 |
+
)
|
| 448 |
+
]
|
| 449 |
+
```
|
| 450 |
+
|
| 451 |
+
Where a `types.UserContent` is a subclass of `types.Content`, it sets the
|
| 452 |
+
`role` field to be `user`.
|
| 453 |
+
|
| 454 |
+
##### Provide a list of strings
|
| 455 |
+
|
| 456 |
+
```python
|
| 457 |
+
contents=['Why is the sky blue?', 'Why is the cloud white?']
|
| 458 |
+
```
|
| 459 |
+
|
| 460 |
+
The SDK assumes these are 2 text parts, it converts this into a single content,
|
| 461 |
+
like the following:
|
| 462 |
+
|
| 463 |
+
```python
|
| 464 |
+
[
|
| 465 |
+
types.UserContent(
|
| 466 |
+
parts=[
|
| 467 |
+
types.Part.from_text(text='Why is the sky blue?'),
|
| 468 |
+
types.Part.from_text(text='Why is the cloud white?'),
|
| 469 |
+
]
|
| 470 |
+
)
|
| 471 |
+
]
|
| 472 |
+
```
|
| 473 |
+
|
| 474 |
+
Where a `types.UserContent` is a subclass of `types.Content`, the
|
| 475 |
+
`role` field in `types.UserContent` is fixed to be `user`.
|
| 476 |
+
|
| 477 |
+
##### Provide a function call part
|
| 478 |
+
|
| 479 |
+
```python
|
| 480 |
+
from google.genai import types
|
| 481 |
+
|
| 482 |
+
contents = types.Part.from_function_call(
|
| 483 |
+
name='get_weather_by_location',
|
| 484 |
+
args={'location': 'Boston'}
|
| 485 |
+
)
|
| 486 |
+
```
|
| 487 |
+
|
| 488 |
+
The SDK converts a function call part to a content with a `model` role:
|
| 489 |
+
|
| 490 |
+
```python
|
| 491 |
+
[
|
| 492 |
+
types.ModelContent(
|
| 493 |
+
parts=[
|
| 494 |
+
types.Part.from_function_call(
|
| 495 |
+
name='get_weather_by_location',
|
| 496 |
+
args={'location': 'Boston'}
|
| 497 |
+
)
|
| 498 |
+
]
|
| 499 |
+
)
|
| 500 |
+
]
|
| 501 |
+
```
|
| 502 |
+
|
| 503 |
+
Where a `types.ModelContent` is a subclass of `types.Content`, the
|
| 504 |
+
`role` field in `types.ModelContent` is fixed to be `model`.
|
| 505 |
+
|
| 506 |
+
##### Provide a list of function call parts
|
| 507 |
+
|
| 508 |
+
```python
|
| 509 |
+
from google.genai import types
|
| 510 |
+
|
| 511 |
+
contents = [
|
| 512 |
+
types.Part.from_function_call(
|
| 513 |
+
name='get_weather_by_location',
|
| 514 |
+
args={'location': 'Boston'}
|
| 515 |
+
),
|
| 516 |
+
types.Part.from_function_call(
|
| 517 |
+
name='get_weather_by_location',
|
| 518 |
+
args={'location': 'New York'}
|
| 519 |
+
),
|
| 520 |
+
]
|
| 521 |
+
```
|
| 522 |
+
|
| 523 |
+
The SDK converts a list of function call parts to a content with a `model` role:
|
| 524 |
+
|
| 525 |
+
```python
|
| 526 |
+
[
|
| 527 |
+
types.ModelContent(
|
| 528 |
+
parts=[
|
| 529 |
+
types.Part.from_function_call(
|
| 530 |
+
name='get_weather_by_location',
|
| 531 |
+
args={'location': 'Boston'}
|
| 532 |
+
),
|
| 533 |
+
types.Part.from_function_call(
|
| 534 |
+
name='get_weather_by_location',
|
| 535 |
+
args={'location': 'New York'}
|
| 536 |
+
)
|
| 537 |
+
]
|
| 538 |
+
)
|
| 539 |
+
]
|
| 540 |
+
```
|
| 541 |
+
|
| 542 |
+
Where a `types.ModelContent` is a subclass of `types.Content`, the
|
| 543 |
+
`role` field in `types.ModelContent` is fixed to be `model`.
|
| 544 |
+
|
| 545 |
+
##### Provide a non function call part
|
| 546 |
+
|
| 547 |
+
```python
|
| 548 |
+
from google.genai import types
|
| 549 |
+
|
| 550 |
+
contents = types.Part.from_uri(
|
| 551 |
+
file_uri: 'gs://generativeai-downloads/images/scones.jpg',
|
| 552 |
+
mime_type: 'image/jpeg',
|
| 553 |
+
)
|
| 554 |
+
```
|
| 555 |
+
|
| 556 |
+
The SDK converts all non function call parts into a content with a `user` role.
|
| 557 |
+
|
| 558 |
+
```python
|
| 559 |
+
[
|
| 560 |
+
types.UserContent(parts=[
|
| 561 |
+
types.Part.from_uri(
|
| 562 |
+
file_uri: 'gs://generativeai-downloads/images/scones.jpg',
|
| 563 |
+
mime_type: 'image/jpeg',
|
| 564 |
+
)
|
| 565 |
+
])
|
| 566 |
+
]
|
| 567 |
+
```
|
| 568 |
+
|
| 569 |
+
##### Provide a list of non function call parts
|
| 570 |
+
|
| 571 |
+
```python
|
| 572 |
+
from google.genai import types
|
| 573 |
+
|
| 574 |
+
contents = [
|
| 575 |
+
types.Part.from_text('What is this image about?'),
|
| 576 |
+
types.Part.from_uri(
|
| 577 |
+
file_uri: 'gs://generativeai-downloads/images/scones.jpg',
|
| 578 |
+
mime_type: 'image/jpeg',
|
| 579 |
+
)
|
| 580 |
+
]
|
| 581 |
+
```
|
| 582 |
+
|
| 583 |
+
The SDK will convert the list of parts into a content with a `user` role
|
| 584 |
+
|
| 585 |
+
```python
|
| 586 |
+
[
|
| 587 |
+
types.UserContent(
|
| 588 |
+
parts=[
|
| 589 |
+
types.Part.from_text('What is this image about?'),
|
| 590 |
+
types.Part.from_uri(
|
| 591 |
+
file_uri: 'gs://generativeai-downloads/images/scones.jpg',
|
| 592 |
+
mime_type: 'image/jpeg',
|
| 593 |
+
)
|
| 594 |
+
]
|
| 595 |
+
)
|
| 596 |
+
]
|
| 597 |
+
```
|
| 598 |
+
|
| 599 |
+
##### Mix types in contents
|
| 600 |
+
|
| 601 |
+
You can also provide a list of `types.ContentUnion`. The SDK leaves items of
|
| 602 |
+
`types.Content` as is, it groups consecutive non function call parts into a
|
| 603 |
+
single `types.UserContent`, and it groups consecutive function call parts into
|
| 604 |
+
a single `types.ModelContent`.
|
| 605 |
+
|
| 606 |
+
If you put a list within a list, the inner list can only contain
|
| 607 |
+
`types.PartUnion` items. The SDK will convert the inner list into a single
|
| 608 |
+
`types.UserContent`.
|
| 609 |
+
|
| 610 |
+
### System Instructions and Other Configs
|
| 611 |
+
|
| 612 |
+
The output of the model can be influenced by several optional settings
|
| 613 |
+
available in generate_content's config parameter. For example, increasing
|
| 614 |
+
`max_output_tokens` is essential for longer model responses. To make a model more
|
| 615 |
+
deterministic, lowering the `temperature` parameter reduces randomness, with
|
| 616 |
+
values near 0 minimizing variability. Capabilities and parameter defaults for
|
| 617 |
+
each model is shown in the
|
| 618 |
+
[Vertex AI docs](https://cloud.google.com/vertex-ai/generative-ai/docs/models/gemini/2-5-flash)
|
| 619 |
+
and [Gemini API docs](https://ai.google.dev/gemini-api/docs/models) respectively.
|
| 620 |
+
|
| 621 |
+
```python
|
| 622 |
+
from google.genai import types
|
| 623 |
+
|
| 624 |
+
response = client.models.generate_content(
|
| 625 |
+
model='gemini-2.5-flash',
|
| 626 |
+
contents='high',
|
| 627 |
+
config=types.GenerateContentConfig(
|
| 628 |
+
system_instruction='I say high, you say low',
|
| 629 |
+
max_output_tokens=3,
|
| 630 |
+
temperature=0.3,
|
| 631 |
+
),
|
| 632 |
+
)
|
| 633 |
+
print(response.text)
|
| 634 |
+
```
|
| 635 |
+
|
| 636 |
+
### List Base Models
|
| 637 |
+
|
| 638 |
+
To retrieve tuned models, see [list tuned models](#list-tuned-models).
|
| 639 |
+
|
| 640 |
+
```python
|
| 641 |
+
for model in client.models.list():
|
| 642 |
+
print(model)
|
| 643 |
+
```
|
| 644 |
+
|
| 645 |
+
```python
|
| 646 |
+
pager = client.models.list(config={'page_size': 10})
|
| 647 |
+
print(pager.page_size)
|
| 648 |
+
print(pager[0])
|
| 649 |
+
pager.next_page()
|
| 650 |
+
print(pager[0])
|
| 651 |
+
```
|
| 652 |
+
|
| 653 |
+
#### List Base Models (Asynchronous)
|
| 654 |
+
|
| 655 |
+
```python
|
| 656 |
+
async for job in await client.aio.models.list():
|
| 657 |
+
print(job)
|
| 658 |
+
```
|
| 659 |
+
|
| 660 |
+
```python
|
| 661 |
+
async_pager = await client.aio.models.list(config={'page_size': 10})
|
| 662 |
+
print(async_pager.page_size)
|
| 663 |
+
print(async_pager[0])
|
| 664 |
+
await async_pager.next_page()
|
| 665 |
+
print(async_pager[0])
|
| 666 |
+
```
|
| 667 |
+
|
| 668 |
+
### Safety Settings
|
| 669 |
+
|
| 670 |
+
```python
|
| 671 |
+
from google.genai import types
|
| 672 |
+
|
| 673 |
+
response = client.models.generate_content(
|
| 674 |
+
model='gemini-2.5-flash',
|
| 675 |
+
contents='Say something bad.',
|
| 676 |
+
config=types.GenerateContentConfig(
|
| 677 |
+
safety_settings=[
|
| 678 |
+
types.SafetySetting(
|
| 679 |
+
category='HARM_CATEGORY_HATE_SPEECH',
|
| 680 |
+
threshold='BLOCK_ONLY_HIGH',
|
| 681 |
+
)
|
| 682 |
+
]
|
| 683 |
+
),
|
| 684 |
+
)
|
| 685 |
+
print(response.text)
|
| 686 |
+
```
|
| 687 |
+
|
| 688 |
+
### Function Calling
|
| 689 |
+
|
| 690 |
+
#### Automatic Python function Support
|
| 691 |
+
|
| 692 |
+
You can pass a Python function directly and it will be automatically
|
| 693 |
+
called and responded by default.
|
| 694 |
+
|
| 695 |
+
```python
|
| 696 |
+
from google.genai import types
|
| 697 |
+
|
| 698 |
+
def get_current_weather(location: str) -> str:
|
| 699 |
+
"""Returns the current weather.
|
| 700 |
+
|
| 701 |
+
Args:
|
| 702 |
+
location: The city and state, e.g. San Francisco, CA
|
| 703 |
+
"""
|
| 704 |
+
return 'sunny'
|
| 705 |
+
|
| 706 |
+
|
| 707 |
+
response = client.models.generate_content(
|
| 708 |
+
model='gemini-2.5-flash',
|
| 709 |
+
contents='What is the weather like in Boston?',
|
| 710 |
+
config=types.GenerateContentConfig(tools=[get_current_weather]),
|
| 711 |
+
)
|
| 712 |
+
|
| 713 |
+
print(response.text)
|
| 714 |
+
```
|
| 715 |
+
|
| 716 |
+
#### Disabling automatic function calling
|
| 717 |
+
|
| 718 |
+
If you pass in a python function as a tool directly, and do not want
|
| 719 |
+
automatic function calling, you can disable automatic function calling
|
| 720 |
+
as follows:
|
| 721 |
+
|
| 722 |
+
```python
|
| 723 |
+
from google.genai import types
|
| 724 |
+
|
| 725 |
+
response = client.models.generate_content(
|
| 726 |
+
model='gemini-2.5-flash',
|
| 727 |
+
contents='What is the weather like in Boston?',
|
| 728 |
+
config=types.GenerateContentConfig(
|
| 729 |
+
tools=[get_current_weather],
|
| 730 |
+
automatic_function_calling=types.AutomaticFunctionCallingConfig(
|
| 731 |
+
disable=True
|
| 732 |
+
),
|
| 733 |
+
),
|
| 734 |
+
)
|
| 735 |
+
```
|
| 736 |
+
|
| 737 |
+
With automatic function calling disabled, you will get a list of function call
|
| 738 |
+
parts in the response:
|
| 739 |
+
|
| 740 |
+
```python
|
| 741 |
+
function_calls: Optional[List[types.FunctionCall]] = response.function_calls
|
| 742 |
+
```
|
| 743 |
+
|
| 744 |
+
#### Manually declare and invoke a function for function calling
|
| 745 |
+
|
| 746 |
+
If you don't want to use the automatic function support, you can manually
|
| 747 |
+
declare the function and invoke it.
|
| 748 |
+
|
| 749 |
+
The following example shows how to declare a function and pass it as a tool.
|
| 750 |
+
Then you will receive a function call part in the response.
|
| 751 |
+
|
| 752 |
+
```python
|
| 753 |
+
from google.genai import types
|
| 754 |
+
|
| 755 |
+
function = types.FunctionDeclaration(
|
| 756 |
+
name='get_current_weather',
|
| 757 |
+
description='Get the current weather in a given location',
|
| 758 |
+
parameters_json_schema={
|
| 759 |
+
'type': 'object',
|
| 760 |
+
'properties': {
|
| 761 |
+
'location': {
|
| 762 |
+
'type': 'string',
|
| 763 |
+
'description': 'The city and state, e.g. San Francisco, CA',
|
| 764 |
+
}
|
| 765 |
+
},
|
| 766 |
+
'required': ['location'],
|
| 767 |
+
},
|
| 768 |
+
)
|
| 769 |
+
|
| 770 |
+
tool = types.Tool(function_declarations=[function])
|
| 771 |
+
|
| 772 |
+
response = client.models.generate_content(
|
| 773 |
+
model='gemini-2.5-flash',
|
| 774 |
+
contents='What is the weather like in Boston?',
|
| 775 |
+
config=types.GenerateContentConfig(tools=[tool]),
|
| 776 |
+
)
|
| 777 |
+
|
| 778 |
+
print(response.function_calls[0])
|
| 779 |
+
```
|
| 780 |
+
|
| 781 |
+
After you receive the function call part from the model, you can invoke the function
|
| 782 |
+
and get the function response. And then you can pass the function response to
|
| 783 |
+
the model.
|
| 784 |
+
The following example shows how to do it for a simple function invocation.
|
| 785 |
+
|
| 786 |
+
```python
|
| 787 |
+
from google.genai import types
|
| 788 |
+
|
| 789 |
+
user_prompt_content = types.Content(
|
| 790 |
+
role='user',
|
| 791 |
+
parts=[types.Part.from_text(text='What is the weather like in Boston?')],
|
| 792 |
+
)
|
| 793 |
+
function_call_part = response.function_calls[0]
|
| 794 |
+
function_call_content = response.candidates[0].content
|
| 795 |
+
|
| 796 |
+
|
| 797 |
+
try:
|
| 798 |
+
function_result = get_current_weather(
|
| 799 |
+
**function_call_part.function_call.args
|
| 800 |
+
)
|
| 801 |
+
function_response = {'result': function_result}
|
| 802 |
+
except (
|
| 803 |
+
Exception
|
| 804 |
+
) as e: # instead of raising the exception, you can let the model handle it
|
| 805 |
+
function_response = {'error': str(e)}
|
| 806 |
+
|
| 807 |
+
|
| 808 |
+
function_response_part = types.Part.from_function_response(
|
| 809 |
+
name=function_call_part.name,
|
| 810 |
+
response=function_response,
|
| 811 |
+
)
|
| 812 |
+
function_response_content = types.Content(
|
| 813 |
+
role='tool', parts=[function_response_part]
|
| 814 |
+
)
|
| 815 |
+
|
| 816 |
+
response = client.models.generate_content(
|
| 817 |
+
model='gemini-2.5-flash',
|
| 818 |
+
contents=[
|
| 819 |
+
user_prompt_content,
|
| 820 |
+
function_call_content,
|
| 821 |
+
function_response_content,
|
| 822 |
+
],
|
| 823 |
+
config=types.GenerateContentConfig(
|
| 824 |
+
tools=[tool],
|
| 825 |
+
),
|
| 826 |
+
)
|
| 827 |
+
|
| 828 |
+
print(response.text)
|
| 829 |
+
```
|
| 830 |
+
|
| 831 |
+
#### Function calling with `ANY` tools config mode
|
| 832 |
+
|
| 833 |
+
If you configure function calling mode to be `ANY`, then the model will always
|
| 834 |
+
return function call parts. If you also pass a python function as a tool, by
|
| 835 |
+
default the SDK will perform automatic function calling until the remote calls exceed the
|
| 836 |
+
maximum remote call for automatic function calling (default to 10 times).
|
| 837 |
+
|
| 838 |
+
If you'd like to disable automatic function calling in `ANY` mode:
|
| 839 |
+
|
| 840 |
+
```python
|
| 841 |
+
from google.genai import types
|
| 842 |
+
|
| 843 |
+
def get_current_weather(location: str) -> str:
|
| 844 |
+
"""Returns the current weather.
|
| 845 |
+
|
| 846 |
+
Args:
|
| 847 |
+
location: The city and state, e.g. San Francisco, CA
|
| 848 |
+
"""
|
| 849 |
+
return "sunny"
|
| 850 |
+
|
| 851 |
+
response = client.models.generate_content(
|
| 852 |
+
model="gemini-2.5-flash",
|
| 853 |
+
contents="What is the weather like in Boston?",
|
| 854 |
+
config=types.GenerateContentConfig(
|
| 855 |
+
tools=[get_current_weather],
|
| 856 |
+
automatic_function_calling=types.AutomaticFunctionCallingConfig(
|
| 857 |
+
disable=True
|
| 858 |
+
),
|
| 859 |
+
tool_config=types.ToolConfig(
|
| 860 |
+
function_calling_config=types.FunctionCallingConfig(mode='ANY')
|
| 861 |
+
),
|
| 862 |
+
),
|
| 863 |
+
)
|
| 864 |
+
```
|
| 865 |
+
|
| 866 |
+
If you'd like to set `x` number of automatic function call turns, you can
|
| 867 |
+
configure the maximum remote calls to be `x + 1`.
|
| 868 |
+
Assuming you prefer `1` turn for automatic function calling.
|
| 869 |
+
|
| 870 |
+
```python
|
| 871 |
+
from google.genai import types
|
| 872 |
+
|
| 873 |
+
def get_current_weather(location: str) -> str:
|
| 874 |
+
"""Returns the current weather.
|
| 875 |
+
|
| 876 |
+
Args:
|
| 877 |
+
location: The city and state, e.g. San Francisco, CA
|
| 878 |
+
"""
|
| 879 |
+
return "sunny"
|
| 880 |
+
|
| 881 |
+
response = client.models.generate_content(
|
| 882 |
+
model="gemini-2.5-flash",
|
| 883 |
+
contents="What is the weather like in Boston?",
|
| 884 |
+
config=types.GenerateContentConfig(
|
| 885 |
+
tools=[get_current_weather],
|
| 886 |
+
automatic_function_calling=types.AutomaticFunctionCallingConfig(
|
| 887 |
+
maximum_remote_calls=2
|
| 888 |
+
),
|
| 889 |
+
tool_config=types.ToolConfig(
|
| 890 |
+
function_calling_config=types.FunctionCallingConfig(mode='ANY')
|
| 891 |
+
),
|
| 892 |
+
),
|
| 893 |
+
)
|
| 894 |
+
```
|
| 895 |
+
|
| 896 |
+
#### Model Context Protocol (MCP) support (experimental)
|
| 897 |
+
|
| 898 |
+
Built-in [MCP](https://modelcontextprotocol.io/introduction) support is an
|
| 899 |
+
experimental feature. You can pass a local MCP server as a tool directly.
|
| 900 |
+
|
| 901 |
+
```python
|
| 902 |
+
import os
|
| 903 |
+
import asyncio
|
| 904 |
+
from datetime import datetime
|
| 905 |
+
from mcp import ClientSession, StdioServerParameters
|
| 906 |
+
from mcp.client.stdio import stdio_client
|
| 907 |
+
from google import genai
|
| 908 |
+
|
| 909 |
+
client = genai.Client()
|
| 910 |
+
|
| 911 |
+
# Create server parameters for stdio connection
|
| 912 |
+
server_params = StdioServerParameters(
|
| 913 |
+
command="npx", # Executable
|
| 914 |
+
args=["-y", "@philschmid/weather-mcp"], # MCP Server
|
| 915 |
+
env=None, # Optional environment variables
|
| 916 |
+
)
|
| 917 |
+
|
| 918 |
+
async def run():
|
| 919 |
+
async with stdio_client(server_params) as (read, write):
|
| 920 |
+
async with ClientSession(read, write) as session:
|
| 921 |
+
# Prompt to get the weather for the current day in London.
|
| 922 |
+
prompt = f"What is the weather in London in {datetime.now().strftime('%Y-%m-%d')}?"
|
| 923 |
+
|
| 924 |
+
# Initialize the connection between client and server
|
| 925 |
+
await session.initialize()
|
| 926 |
+
|
| 927 |
+
# Send request to the model with MCP function declarations
|
| 928 |
+
response = await client.aio.models.generate_content(
|
| 929 |
+
model="gemini-2.5-flash",
|
| 930 |
+
contents=prompt,
|
| 931 |
+
config=genai.types.GenerateContentConfig(
|
| 932 |
+
temperature=0,
|
| 933 |
+
tools=[session], # uses the session, will automatically call the tool using automatic function calling
|
| 934 |
+
),
|
| 935 |
+
)
|
| 936 |
+
print(response.text)
|
| 937 |
+
|
| 938 |
+
# Start the asyncio event loop and run the main function
|
| 939 |
+
asyncio.run(run())
|
| 940 |
+
```
|
| 941 |
+
|
| 942 |
+
### JSON Response Schema
|
| 943 |
+
|
| 944 |
+
However you define your schema, don't duplicate it in your input prompt,
|
| 945 |
+
including by giving examples of expected JSON output. If you do, the generated
|
| 946 |
+
output might be lower in quality.
|
| 947 |
+
|
| 948 |
+
#### JSON Schema support
|
| 949 |
+
|
| 950 |
+
Schemas can be provided as standard JSON schema.
|
| 951 |
+
|
| 952 |
+
```python
|
| 953 |
+
user_profile = {
|
| 954 |
+
'properties': {
|
| 955 |
+
'age': {
|
| 956 |
+
'anyOf': [
|
| 957 |
+
{'maximum': 20, 'minimum': 0, 'type': 'integer'},
|
| 958 |
+
{'type': 'null'},
|
| 959 |
+
],
|
| 960 |
+
'title': 'Age',
|
| 961 |
+
},
|
| 962 |
+
'username': {
|
| 963 |
+
'description': "User's unique name",
|
| 964 |
+
'title': 'Username',
|
| 965 |
+
'type': 'string',
|
| 966 |
+
},
|
| 967 |
+
},
|
| 968 |
+
'required': ['username', 'age'],
|
| 969 |
+
'title': 'User Schema',
|
| 970 |
+
'type': 'object',
|
| 971 |
+
}
|
| 972 |
+
|
| 973 |
+
response = client.models.generate_content(
|
| 974 |
+
model='gemini-2.5-flash',
|
| 975 |
+
contents='Give me a random user profile.',
|
| 976 |
+
config={
|
| 977 |
+
'response_mime_type': 'application/json',
|
| 978 |
+
'response_json_schema': user_profile
|
| 979 |
+
},
|
| 980 |
+
)
|
| 981 |
+
print(response.parsed)
|
| 982 |
+
```
|
| 983 |
+
|
| 984 |
+
#### Pydantic Model Schema support
|
| 985 |
+
|
| 986 |
+
Schemas can be provided as Pydantic Models.
|
| 987 |
+
|
| 988 |
+
```python
|
| 989 |
+
from pydantic import BaseModel
|
| 990 |
+
from google.genai import types
|
| 991 |
+
|
| 992 |
+
|
| 993 |
+
class CountryInfo(BaseModel):
|
| 994 |
+
name: str
|
| 995 |
+
population: int
|
| 996 |
+
capital: str
|
| 997 |
+
continent: str
|
| 998 |
+
gdp: int
|
| 999 |
+
official_language: str
|
| 1000 |
+
total_area_sq_mi: int
|
| 1001 |
+
|
| 1002 |
+
|
| 1003 |
+
response = client.models.generate_content(
|
| 1004 |
+
model='gemini-2.5-flash',
|
| 1005 |
+
contents='Give me information for the United States.',
|
| 1006 |
+
config=types.GenerateContentConfig(
|
| 1007 |
+
response_mime_type='application/json',
|
| 1008 |
+
response_schema=CountryInfo,
|
| 1009 |
+
),
|
| 1010 |
+
)
|
| 1011 |
+
print(response.text)
|
| 1012 |
+
```
|
| 1013 |
+
|
| 1014 |
+
```python
|
| 1015 |
+
from google.genai import types
|
| 1016 |
+
|
| 1017 |
+
response = client.models.generate_content(
|
| 1018 |
+
model='gemini-2.5-flash',
|
| 1019 |
+
contents='Give me information for the United States.',
|
| 1020 |
+
config=types.GenerateContentConfig(
|
| 1021 |
+
response_mime_type='application/json',
|
| 1022 |
+
response_schema={
|
| 1023 |
+
'required': [
|
| 1024 |
+
'name',
|
| 1025 |
+
'population',
|
| 1026 |
+
'capital',
|
| 1027 |
+
'continent',
|
| 1028 |
+
'gdp',
|
| 1029 |
+
'official_language',
|
| 1030 |
+
'total_area_sq_mi',
|
| 1031 |
+
],
|
| 1032 |
+
'properties': {
|
| 1033 |
+
'name': {'type': 'STRING'},
|
| 1034 |
+
'population': {'type': 'INTEGER'},
|
| 1035 |
+
'capital': {'type': 'STRING'},
|
| 1036 |
+
'continent': {'type': 'STRING'},
|
| 1037 |
+
'gdp': {'type': 'INTEGER'},
|
| 1038 |
+
'official_language': {'type': 'STRING'},
|
| 1039 |
+
'total_area_sq_mi': {'type': 'INTEGER'},
|
| 1040 |
+
},
|
| 1041 |
+
'type': 'OBJECT',
|
| 1042 |
+
},
|
| 1043 |
+
),
|
| 1044 |
+
)
|
| 1045 |
+
print(response.text)
|
| 1046 |
+
```
|
| 1047 |
+
|
| 1048 |
+
### Enum Response Schema
|
| 1049 |
+
|
| 1050 |
+
#### Text Response
|
| 1051 |
+
|
| 1052 |
+
You can set response_mime_type to 'text/x.enum' to return one of those enum
|
| 1053 |
+
values as the response.
|
| 1054 |
+
|
| 1055 |
+
```python
|
| 1056 |
+
from enum import Enum
|
| 1057 |
+
|
| 1058 |
+
class InstrumentEnum(Enum):
|
| 1059 |
+
PERCUSSION = 'Percussion'
|
| 1060 |
+
STRING = 'String'
|
| 1061 |
+
WOODWIND = 'Woodwind'
|
| 1062 |
+
BRASS = 'Brass'
|
| 1063 |
+
KEYBOARD = 'Keyboard'
|
| 1064 |
+
|
| 1065 |
+
response = client.models.generate_content(
|
| 1066 |
+
model='gemini-2.5-flash',
|
| 1067 |
+
contents='What instrument plays multiple notes at once?',
|
| 1068 |
+
config={
|
| 1069 |
+
'response_mime_type': 'text/x.enum',
|
| 1070 |
+
'response_schema': InstrumentEnum,
|
| 1071 |
+
},
|
| 1072 |
+
)
|
| 1073 |
+
print(response.text)
|
| 1074 |
+
```
|
| 1075 |
+
|
| 1076 |
+
#### JSON Response
|
| 1077 |
+
|
| 1078 |
+
You can also set `response_mime_type` to `'application/json'`, the response will be
|
| 1079 |
+
identical but in quotes.
|
| 1080 |
+
|
| 1081 |
+
```python
|
| 1082 |
+
from enum import Enum
|
| 1083 |
+
|
| 1084 |
+
class InstrumentEnum(Enum):
|
| 1085 |
+
PERCUSSION = 'Percussion'
|
| 1086 |
+
STRING = 'String'
|
| 1087 |
+
WOODWIND = 'Woodwind'
|
| 1088 |
+
BRASS = 'Brass'
|
| 1089 |
+
KEYBOARD = 'Keyboard'
|
| 1090 |
+
|
| 1091 |
+
response = client.models.generate_content(
|
| 1092 |
+
model='gemini-2.5-flash',
|
| 1093 |
+
contents='What instrument plays multiple notes at once?',
|
| 1094 |
+
config={
|
| 1095 |
+
'response_mime_type': 'application/json',
|
| 1096 |
+
'response_schema': InstrumentEnum,
|
| 1097 |
+
},
|
| 1098 |
+
)
|
| 1099 |
+
print(response.text)
|
| 1100 |
+
```
|
| 1101 |
+
|
| 1102 |
+
### Generate Content (Synchronous Streaming)
|
| 1103 |
+
|
| 1104 |
+
Generate content in a streaming format so that the model outputs streams back
|
| 1105 |
+
to you, rather than being returned as one chunk.
|
| 1106 |
+
|
| 1107 |
+
#### Streaming for text content
|
| 1108 |
+
|
| 1109 |
+
```python
|
| 1110 |
+
for chunk in client.models.generate_content_stream(
|
| 1111 |
+
model='gemini-2.5-flash', contents='Tell me a story in 300 words.'
|
| 1112 |
+
):
|
| 1113 |
+
print(chunk.text, end='')
|
| 1114 |
+
```
|
| 1115 |
+
|
| 1116 |
+
#### Streaming for image content
|
| 1117 |
+
|
| 1118 |
+
If your image is stored in [Google Cloud Storage](https://cloud.google.com/storage),
|
| 1119 |
+
you can use the `from_uri` class method to create a `Part` object.
|
| 1120 |
+
|
| 1121 |
+
```python
|
| 1122 |
+
from google.genai import types
|
| 1123 |
+
|
| 1124 |
+
for chunk in client.models.generate_content_stream(
|
| 1125 |
+
model='gemini-2.5-flash',
|
| 1126 |
+
contents=[
|
| 1127 |
+
'What is this image about?',
|
| 1128 |
+
types.Part.from_uri(
|
| 1129 |
+
file_uri='gs://generativeai-downloads/images/scones.jpg',
|
| 1130 |
+
mime_type='image/jpeg',
|
| 1131 |
+
),
|
| 1132 |
+
],
|
| 1133 |
+
):
|
| 1134 |
+
print(chunk.text, end='')
|
| 1135 |
+
```
|
| 1136 |
+
|
| 1137 |
+
If your image is stored in your local file system, you can read it in as bytes
|
| 1138 |
+
data and use the `from_bytes` class method to create a `Part` object.
|
| 1139 |
+
|
| 1140 |
+
```python
|
| 1141 |
+
from google.genai import types
|
| 1142 |
+
|
| 1143 |
+
YOUR_IMAGE_PATH = 'your_image_path'
|
| 1144 |
+
YOUR_IMAGE_MIME_TYPE = 'your_image_mime_type'
|
| 1145 |
+
with open(YOUR_IMAGE_PATH, 'rb') as f:
|
| 1146 |
+
image_bytes = f.read()
|
| 1147 |
+
|
| 1148 |
+
for chunk in client.models.generate_content_stream(
|
| 1149 |
+
model='gemini-2.5-flash',
|
| 1150 |
+
contents=[
|
| 1151 |
+
'What is this image about?',
|
| 1152 |
+
types.Part.from_bytes(data=image_bytes, mime_type=YOUR_IMAGE_MIME_TYPE),
|
| 1153 |
+
],
|
| 1154 |
+
):
|
| 1155 |
+
print(chunk.text, end='')
|
| 1156 |
+
```
|
| 1157 |
+
|
| 1158 |
+
### Generate Content (Asynchronous Non Streaming)
|
| 1159 |
+
|
| 1160 |
+
`client.aio` exposes all the analogous [`async` methods](https://docs.python.org/3/library/asyncio.html)
|
| 1161 |
+
that are available on `client`. Note that it applies to all the modules.
|
| 1162 |
+
|
| 1163 |
+
For example, `client.aio.models.generate_content` is the `async` version
|
| 1164 |
+
of `client.models.generate_content`
|
| 1165 |
+
|
| 1166 |
+
```python
|
| 1167 |
+
response = await client.aio.models.generate_content(
|
| 1168 |
+
model='gemini-2.5-flash', contents='Tell me a story in 300 words.'
|
| 1169 |
+
)
|
| 1170 |
+
|
| 1171 |
+
print(response.text)
|
| 1172 |
+
```
|
| 1173 |
+
|
| 1174 |
+
### Generate Content (Asynchronous Streaming)
|
| 1175 |
+
|
| 1176 |
+
```python
|
| 1177 |
+
async for chunk in await client.aio.models.generate_content_stream(
|
| 1178 |
+
model='gemini-2.5-flash', contents='Tell me a story in 300 words.'
|
| 1179 |
+
):
|
| 1180 |
+
print(chunk.text, end='')
|
| 1181 |
+
```
|
| 1182 |
+
|
| 1183 |
+
### Count Tokens and Compute Tokens
|
| 1184 |
+
|
| 1185 |
+
```python
|
| 1186 |
+
response = client.models.count_tokens(
|
| 1187 |
+
model='gemini-2.5-flash',
|
| 1188 |
+
contents='why is the sky blue?',
|
| 1189 |
+
)
|
| 1190 |
+
print(response)
|
| 1191 |
+
```
|
| 1192 |
+
|
| 1193 |
+
#### Compute Tokens
|
| 1194 |
+
|
| 1195 |
+
Compute tokens is only supported in Vertex AI.
|
| 1196 |
+
|
| 1197 |
+
```python
|
| 1198 |
+
response = client.models.compute_tokens(
|
| 1199 |
+
model='gemini-2.5-flash',
|
| 1200 |
+
contents='why is the sky blue?',
|
| 1201 |
+
)
|
| 1202 |
+
print(response)
|
| 1203 |
+
```
|
| 1204 |
+
|
| 1205 |
+
##### Async
|
| 1206 |
+
|
| 1207 |
+
```python
|
| 1208 |
+
response = await client.aio.models.count_tokens(
|
| 1209 |
+
model='gemini-2.5-flash',
|
| 1210 |
+
contents='why is the sky blue?',
|
| 1211 |
+
)
|
| 1212 |
+
print(response)
|
| 1213 |
+
```
|
| 1214 |
+
|
| 1215 |
+
#### Local Count Tokens
|
| 1216 |
+
|
| 1217 |
+
```python
|
| 1218 |
+
tokenizer = genai.LocalTokenizer(model_name='gemini-2.5-flash')
|
| 1219 |
+
result = tokenizer.count_tokens("What is your name?")
|
| 1220 |
+
```
|
| 1221 |
+
|
| 1222 |
+
#### Local Compute Tokens
|
| 1223 |
+
|
| 1224 |
+
```python
|
| 1225 |
+
tokenizer = genai.LocalTokenizer(model_name='gemini-2.5-flash')
|
| 1226 |
+
result = tokenizer.compute_tokens("What is your name?")
|
| 1227 |
+
```
|
| 1228 |
+
|
| 1229 |
+
### Embed Content
|
| 1230 |
+
|
| 1231 |
+
```python
|
| 1232 |
+
response = client.models.embed_content(
|
| 1233 |
+
model='gemini-embedding-001',
|
| 1234 |
+
contents='why is the sky blue?',
|
| 1235 |
+
)
|
| 1236 |
+
print(response)
|
| 1237 |
+
```
|
| 1238 |
+
|
| 1239 |
+
```python
|
| 1240 |
+
from google.genai import types
|
| 1241 |
+
|
| 1242 |
+
response = client.models.embed_content(
|
| 1243 |
+
model='gemini-embedding-001',
|
| 1244 |
+
contents=['why is the sky blue?', 'What is your age?'],
|
| 1245 |
+
config=types.EmbedContentConfig(output_dimensionality=10),
|
| 1246 |
+
)
|
| 1247 |
+
|
| 1248 |
+
print(response)
|
| 1249 |
+
```
|
| 1250 |
+
|
| 1251 |
+
### Imagen
|
| 1252 |
+
|
| 1253 |
+
#### Generate Images
|
| 1254 |
+
|
| 1255 |
+
```python
|
| 1256 |
+
from google.genai import types
|
| 1257 |
+
|
| 1258 |
+
response1 = client.models.generate_images(
|
| 1259 |
+
model='imagen-4.0-generate-001',
|
| 1260 |
+
prompt='An umbrella in the foreground, and a rainy night sky in the background',
|
| 1261 |
+
config=types.GenerateImagesConfig(
|
| 1262 |
+
number_of_images=1,
|
| 1263 |
+
include_rai_reason=True,
|
| 1264 |
+
output_mime_type='image/jpeg',
|
| 1265 |
+
),
|
| 1266 |
+
)
|
| 1267 |
+
response1.generated_images[0].image.show()
|
| 1268 |
+
```
|
| 1269 |
+
|
| 1270 |
+
#### Upscale Image
|
| 1271 |
+
|
| 1272 |
+
Upscale image is only supported in Vertex AI.
|
| 1273 |
+
|
| 1274 |
+
```python
|
| 1275 |
+
from google.genai import types
|
| 1276 |
+
|
| 1277 |
+
response2 = client.models.upscale_image(
|
| 1278 |
+
model='imagen-4.0-upscale-preview',
|
| 1279 |
+
image=response1.generated_images[0].image,
|
| 1280 |
+
upscale_factor='x2',
|
| 1281 |
+
config=types.UpscaleImageConfig(
|
| 1282 |
+
include_rai_reason=True,
|
| 1283 |
+
output_mime_type='image/jpeg',
|
| 1284 |
+
),
|
| 1285 |
+
)
|
| 1286 |
+
response2.generated_images[0].image.show()
|
| 1287 |
+
```
|
| 1288 |
+
|
| 1289 |
+
#### Edit Image
|
| 1290 |
+
|
| 1291 |
+
Edit image uses a separate model from generate and upscale.
|
| 1292 |
+
|
| 1293 |
+
Edit image is only supported in Vertex AI.
|
| 1294 |
+
|
| 1295 |
+
```python
|
| 1296 |
+
# Edit the generated image from above
|
| 1297 |
+
from google.genai import types
|
| 1298 |
+
from google.genai.types import RawReferenceImage, MaskReferenceImage
|
| 1299 |
+
|
| 1300 |
+
raw_ref_image = RawReferenceImage(
|
| 1301 |
+
reference_id=1,
|
| 1302 |
+
reference_image=response1.generated_images[0].image,
|
| 1303 |
+
)
|
| 1304 |
+
|
| 1305 |
+
# Model computes a mask of the background
|
| 1306 |
+
mask_ref_image = MaskReferenceImage(
|
| 1307 |
+
reference_id=2,
|
| 1308 |
+
config=types.MaskReferenceConfig(
|
| 1309 |
+
mask_mode='MASK_MODE_BACKGROUND',
|
| 1310 |
+
mask_dilation=0,
|
| 1311 |
+
),
|
| 1312 |
+
)
|
| 1313 |
+
|
| 1314 |
+
response3 = client.models.edit_image(
|
| 1315 |
+
model='imagen-3.0-capability-001',
|
| 1316 |
+
prompt='Sunlight and clear sky',
|
| 1317 |
+
reference_images=[raw_ref_image, mask_ref_image],
|
| 1318 |
+
config=types.EditImageConfig(
|
| 1319 |
+
edit_mode='EDIT_MODE_INPAINT_INSERTION',
|
| 1320 |
+
number_of_images=1,
|
| 1321 |
+
include_rai_reason=True,
|
| 1322 |
+
output_mime_type='image/jpeg',
|
| 1323 |
+
),
|
| 1324 |
+
)
|
| 1325 |
+
response3.generated_images[0].image.show()
|
| 1326 |
+
```
|
| 1327 |
+
|
| 1328 |
+
### Veo
|
| 1329 |
+
|
| 1330 |
+
Support for generating videos is considered public preview
|
| 1331 |
+
|
| 1332 |
+
#### Generate Videos (Text to Video)
|
| 1333 |
+
|
| 1334 |
+
```python
|
| 1335 |
+
from google.genai import types
|
| 1336 |
+
|
| 1337 |
+
# Create operation
|
| 1338 |
+
operation = client.models.generate_videos(
|
| 1339 |
+
model='veo-3.1-generate-preview',
|
| 1340 |
+
prompt='A neon hologram of a cat driving at top speed',
|
| 1341 |
+
config=types.GenerateVideosConfig(
|
| 1342 |
+
number_of_videos=1,
|
| 1343 |
+
duration_seconds=5,
|
| 1344 |
+
enhance_prompt=True,
|
| 1345 |
+
),
|
| 1346 |
+
)
|
| 1347 |
+
|
| 1348 |
+
# Poll operation
|
| 1349 |
+
while not operation.done:
|
| 1350 |
+
time.sleep(20)
|
| 1351 |
+
operation = client.operations.get(operation)
|
| 1352 |
+
|
| 1353 |
+
video = operation.response.generated_videos[0].video
|
| 1354 |
+
video.show()
|
| 1355 |
+
```
|
| 1356 |
+
|
| 1357 |
+
#### Generate Videos (Image to Video)
|
| 1358 |
+
|
| 1359 |
+
```python
|
| 1360 |
+
from google.genai import types
|
| 1361 |
+
|
| 1362 |
+
# Read local image (uses mimetypes.guess_type to infer mime type)
|
| 1363 |
+
image = types.Image.from_file("local/path/file.png")
|
| 1364 |
+
|
| 1365 |
+
# Create operation
|
| 1366 |
+
operation = client.models.generate_videos(
|
| 1367 |
+
model='veo-3.1-generate-preview',
|
| 1368 |
+
# Prompt is optional if image is provided
|
| 1369 |
+
prompt='Night sky',
|
| 1370 |
+
image=image,
|
| 1371 |
+
config=types.GenerateVideosConfig(
|
| 1372 |
+
number_of_videos=1,
|
| 1373 |
+
duration_seconds=5,
|
| 1374 |
+
enhance_prompt=True,
|
| 1375 |
+
# Can also pass an Image into last_frame for frame interpolation
|
| 1376 |
+
),
|
| 1377 |
+
)
|
| 1378 |
+
|
| 1379 |
+
# Poll operation
|
| 1380 |
+
while not operation.done:
|
| 1381 |
+
time.sleep(20)
|
| 1382 |
+
operation = client.operations.get(operation)
|
| 1383 |
+
|
| 1384 |
+
video = operation.response.generated_videos[0].video
|
| 1385 |
+
video.show()
|
| 1386 |
+
```
|
| 1387 |
+
|
| 1388 |
+
#### Generate Videos (Video to Video)
|
| 1389 |
+
|
| 1390 |
+
Currently, only Gemini Developer API supports video extension on Veo 3.1 for
|
| 1391 |
+
previously generated videos. Vertex supports video extension on Veo 2.0.
|
| 1392 |
+
|
| 1393 |
+
```python
|
| 1394 |
+
from google.genai import types
|
| 1395 |
+
|
| 1396 |
+
# Read local video (uses mimetypes.guess_type to infer mime type)
|
| 1397 |
+
video = types.Video.from_file("local/path/video.mp4")
|
| 1398 |
+
|
| 1399 |
+
# Create operation
|
| 1400 |
+
operation = client.models.generate_videos(
|
| 1401 |
+
model='veo-3.1-generate-preview',
|
| 1402 |
+
# Prompt is optional if Video is provided
|
| 1403 |
+
prompt='Night sky',
|
| 1404 |
+
# Input video must be in GCS for Vertex or a URI for Gemini
|
| 1405 |
+
video=types.Video(
|
| 1406 |
+
uri="gs://bucket-name/inputs/videos/cat_driving.mp4",
|
| 1407 |
+
),
|
| 1408 |
+
config=types.GenerateVideosConfig(
|
| 1409 |
+
number_of_videos=1,
|
| 1410 |
+
duration_seconds=5,
|
| 1411 |
+
enhance_prompt=True,
|
| 1412 |
+
),
|
| 1413 |
+
)
|
| 1414 |
+
|
| 1415 |
+
# Poll operation
|
| 1416 |
+
while not operation.done:
|
| 1417 |
+
time.sleep(20)
|
| 1418 |
+
operation = client.operations.get(operation)
|
| 1419 |
+
|
| 1420 |
+
video = operation.response.generated_videos[0].video
|
| 1421 |
+
video.show()
|
| 1422 |
+
```
|
| 1423 |
+
|
| 1424 |
+
## Chats
|
| 1425 |
+
|
| 1426 |
+
Create a chat session to start a multi-turn conversations with the model. Then,
|
| 1427 |
+
use `chat.send_message` function multiple times within the same chat session so
|
| 1428 |
+
that it can reflect on its previous responses (i.e., engage in an ongoing
|
| 1429 |
+
conversation). See the 'Create a client' section above to initialize a client.
|
| 1430 |
+
|
| 1431 |
+
### Send Message (Synchronous Non-Streaming)
|
| 1432 |
+
|
| 1433 |
+
```python
|
| 1434 |
+
chat = client.chats.create(model='gemini-2.5-flash')
|
| 1435 |
+
response = chat.send_message('tell me a story')
|
| 1436 |
+
print(response.text)
|
| 1437 |
+
response = chat.send_message('summarize the story you told me in 1 sentence')
|
| 1438 |
+
print(response.text)
|
| 1439 |
+
```
|
| 1440 |
+
|
| 1441 |
+
### Send Message (Synchronous Streaming)
|
| 1442 |
+
|
| 1443 |
+
```python
|
| 1444 |
+
chat = client.chats.create(model='gemini-2.5-flash')
|
| 1445 |
+
for chunk in chat.send_message_stream('tell me a story'):
|
| 1446 |
+
print(chunk.text)
|
| 1447 |
+
```
|
| 1448 |
+
|
| 1449 |
+
### Send Message (Asynchronous Non-Streaming)
|
| 1450 |
+
|
| 1451 |
+
```python
|
| 1452 |
+
chat = client.aio.chats.create(model='gemini-2.5-flash')
|
| 1453 |
+
response = await chat.send_message('tell me a story')
|
| 1454 |
+
print(response.text)
|
| 1455 |
+
```
|
| 1456 |
+
|
| 1457 |
+
### Send Message (Asynchronous Streaming)
|
| 1458 |
+
|
| 1459 |
+
```python
|
| 1460 |
+
chat = client.aio.chats.create(model='gemini-2.5-flash')
|
| 1461 |
+
async for chunk in await chat.send_message_stream('tell me a story'):
|
| 1462 |
+
print(chunk.text)
|
| 1463 |
+
```
|
| 1464 |
+
|
| 1465 |
+
## Files
|
| 1466 |
+
|
| 1467 |
+
Files are only supported in Gemini Developer API. See the 'Create a client'
|
| 1468 |
+
section above to initialize a client.
|
| 1469 |
+
|
| 1470 |
+
```sh
|
| 1471 |
+
!gcloud storage cp gs://cloud-samples-data/generative-ai/pdf/2312.11805v3.pdf .
|
| 1472 |
+
!gcloud storage cp gs://cloud-samples-data/generative-ai/pdf/2403.05530.pdf .
|
| 1473 |
+
```
|
| 1474 |
+
|
| 1475 |
+
### Upload
|
| 1476 |
+
|
| 1477 |
+
```python
|
| 1478 |
+
file1 = client.files.upload(file='2312.11805v3.pdf')
|
| 1479 |
+
file2 = client.files.upload(file='2403.05530.pdf')
|
| 1480 |
+
|
| 1481 |
+
print(file1)
|
| 1482 |
+
print(file2)
|
| 1483 |
+
```
|
| 1484 |
+
|
| 1485 |
+
### Get
|
| 1486 |
+
|
| 1487 |
+
```python
|
| 1488 |
+
file1 = client.files.upload(file='2312.11805v3.pdf')
|
| 1489 |
+
file_info = client.files.get(name=file1.name)
|
| 1490 |
+
```
|
| 1491 |
+
|
| 1492 |
+
### Delete
|
| 1493 |
+
|
| 1494 |
+
```python
|
| 1495 |
+
file3 = client.files.upload(file='2312.11805v3.pdf')
|
| 1496 |
+
|
| 1497 |
+
client.files.delete(name=file3.name)
|
| 1498 |
+
```
|
| 1499 |
+
|
| 1500 |
+
## Caches
|
| 1501 |
+
|
| 1502 |
+
`client.caches` contains the control plane APIs for cached content. See the
|
| 1503 |
+
'Create a client' section above to initialize a client.
|
| 1504 |
+
|
| 1505 |
+
### Create
|
| 1506 |
+
|
| 1507 |
+
```python
|
| 1508 |
+
from google.genai import types
|
| 1509 |
+
|
| 1510 |
+
if client.vertexai:
|
| 1511 |
+
file_uris = [
|
| 1512 |
+
'gs://cloud-samples-data/generative-ai/pdf/2312.11805v3.pdf',
|
| 1513 |
+
'gs://cloud-samples-data/generative-ai/pdf/2403.05530.pdf',
|
| 1514 |
+
]
|
| 1515 |
+
else:
|
| 1516 |
+
file_uris = [file1.uri, file2.uri]
|
| 1517 |
+
|
| 1518 |
+
cached_content = client.caches.create(
|
| 1519 |
+
model='gemini-2.5-flash',
|
| 1520 |
+
config=types.CreateCachedContentConfig(
|
| 1521 |
+
contents=[
|
| 1522 |
+
types.Content(
|
| 1523 |
+
role='user',
|
| 1524 |
+
parts=[
|
| 1525 |
+
types.Part.from_uri(
|
| 1526 |
+
file_uri=file_uris[0], mime_type='application/pdf'
|
| 1527 |
+
),
|
| 1528 |
+
types.Part.from_uri(
|
| 1529 |
+
file_uri=file_uris[1],
|
| 1530 |
+
mime_type='application/pdf',
|
| 1531 |
+
),
|
| 1532 |
+
],
|
| 1533 |
+
)
|
| 1534 |
+
],
|
| 1535 |
+
system_instruction='What is the sum of the two pdfs?',
|
| 1536 |
+
display_name='test cache',
|
| 1537 |
+
ttl='3600s',
|
| 1538 |
+
),
|
| 1539 |
+
)
|
| 1540 |
+
```
|
| 1541 |
+
|
| 1542 |
+
### Get
|
| 1543 |
+
|
| 1544 |
+
```python
|
| 1545 |
+
cached_content = client.caches.get(name=cached_content.name)
|
| 1546 |
+
```
|
| 1547 |
+
|
| 1548 |
+
### Generate Content with Caches
|
| 1549 |
+
|
| 1550 |
+
```python
|
| 1551 |
+
from google.genai import types
|
| 1552 |
+
|
| 1553 |
+
response = client.models.generate_content(
|
| 1554 |
+
model='gemini-2.5-flash',
|
| 1555 |
+
contents='Summarize the pdfs',
|
| 1556 |
+
config=types.GenerateContentConfig(
|
| 1557 |
+
cached_content=cached_content.name,
|
| 1558 |
+
),
|
| 1559 |
+
)
|
| 1560 |
+
print(response.text)
|
| 1561 |
+
```
|
| 1562 |
+
|
| 1563 |
+
## Interactions (Preview)
|
| 1564 |
+
|
| 1565 |
+
> **Warning:** The Interactions API is in **Beta**. This is a preview of an experimental feature. Features and schemas are subject to **breaking changes**.
|
| 1566 |
+
|
| 1567 |
+
The Interactions API is a unified interface for interacting with Gemini models and agents. It simplifies state management, tool orchestration, and long-running tasks.
|
| 1568 |
+
|
| 1569 |
+
See the [documentation site](https://ai.google.dev/gemini-api/docs/interactions) for more details.
|
| 1570 |
+
|
| 1571 |
+
### Basic Interaction
|
| 1572 |
+
|
| 1573 |
+
```python
|
| 1574 |
+
interaction = client.interactions.create(
|
| 1575 |
+
model='gemini-2.5-flash',
|
| 1576 |
+
input='Tell me a short joke about programming.'
|
| 1577 |
+
)
|
| 1578 |
+
print(interaction.outputs[-1].text)
|
| 1579 |
+
|
| 1580 |
+
```
|
| 1581 |
+
|
| 1582 |
+
### Stateful Conversation
|
| 1583 |
+
|
| 1584 |
+
The Interactions API supports server-side state management. You can continue a conversation by referencing the `previous_interaction_id`.
|
| 1585 |
+
|
| 1586 |
+
```python
|
| 1587 |
+
# 1. First turn
|
| 1588 |
+
interaction1 = client.interactions.create(
|
| 1589 |
+
model='gemini-2.5-flash',
|
| 1590 |
+
input='Hi, my name is Amir.'
|
| 1591 |
+
)
|
| 1592 |
+
print(f"Model: {interaction1.outputs[-1].text}")
|
| 1593 |
+
|
| 1594 |
+
# 2. Second turn (passing previous_interaction_id)
|
| 1595 |
+
interaction2 = client.interactions.create(
|
| 1596 |
+
model='gemini-2.5-flash',
|
| 1597 |
+
input='What is my name?',
|
| 1598 |
+
previous_interaction_id=interaction1.id
|
| 1599 |
+
)
|
| 1600 |
+
print(f"Model: {interaction2.outputs[-1].text}")
|
| 1601 |
+
|
| 1602 |
+
```
|
| 1603 |
+
|
| 1604 |
+
### Agents (Deep Research)
|
| 1605 |
+
|
| 1606 |
+
You can use specialized agents like `deep-research-pro-preview-12-2025` for complex tasks.
|
| 1607 |
+
|
| 1608 |
+
```python
|
| 1609 |
+
import time
|
| 1610 |
+
|
| 1611 |
+
# 1. Start the Deep Research Agent
|
| 1612 |
+
initial_interaction = client.interactions.create(
|
| 1613 |
+
input='Research the history of the Google TPUs with a focus on 2025 and 2026.',
|
| 1614 |
+
agent='deep-research-pro-preview-12-2025',
|
| 1615 |
+
background=True
|
| 1616 |
+
)
|
| 1617 |
+
print(f"Research started. Interaction ID: {initial_interaction.id}")
|
| 1618 |
+
|
| 1619 |
+
# 2. Poll for results
|
| 1620 |
+
while True:
|
| 1621 |
+
interaction = client.interactions.get(id=initial_interaction.id)
|
| 1622 |
+
print(f"Status: {interaction.status}")
|
| 1623 |
+
|
| 1624 |
+
if interaction.status == "completed":
|
| 1625 |
+
print("\nFinal Report:\n", interaction.outputs[-1].text)
|
| 1626 |
+
break
|
| 1627 |
+
elif interaction.status in ["failed", "cancelled"]:
|
| 1628 |
+
print(f"Failed with status: {interaction.status}")
|
| 1629 |
+
break
|
| 1630 |
+
|
| 1631 |
+
time.sleep(10)
|
| 1632 |
+
|
| 1633 |
+
```
|
| 1634 |
+
|
| 1635 |
+
### Multimodal Input
|
| 1636 |
+
|
| 1637 |
+
You can provide multimodal data (text, images, audio, etc.) in the input list.
|
| 1638 |
+
|
| 1639 |
+
```python
|
| 1640 |
+
import base64
|
| 1641 |
+
|
| 1642 |
+
# Assuming you have an image loaded as bytes
|
| 1643 |
+
# base64_image = ...
|
| 1644 |
+
|
| 1645 |
+
interaction = client.interactions.create(
|
| 1646 |
+
model='gemini-2.5-flash',
|
| 1647 |
+
input=[
|
| 1648 |
+
{'type': 'text', 'text': 'Describe the image.'},
|
| 1649 |
+
{'type': 'image', 'data': base64_image, 'mime_type': 'image/png'}
|
| 1650 |
+
]
|
| 1651 |
+
)
|
| 1652 |
+
print(interaction.outputs[-1].text)
|
| 1653 |
+
|
| 1654 |
+
```
|
| 1655 |
+
|
| 1656 |
+
### Function Calling
|
| 1657 |
+
|
| 1658 |
+
You can define custom functions for the model to use. The Interactions API handles the tool selection, and you provide the execution result back to the model.
|
| 1659 |
+
|
| 1660 |
+
```python
|
| 1661 |
+
# 1. Define the tool
|
| 1662 |
+
def get_weather(location: str):
|
| 1663 |
+
"""Gets the weather for a given location."""
|
| 1664 |
+
return f"The weather in {location} is sunny."
|
| 1665 |
+
|
| 1666 |
+
weather_tool = {
|
| 1667 |
+
'type': 'function',
|
| 1668 |
+
'name': 'get_weather',
|
| 1669 |
+
'description': 'Gets the weather for a given location.',
|
| 1670 |
+
'parameters': {
|
| 1671 |
+
'type': 'object',
|
| 1672 |
+
'properties': {
|
| 1673 |
+
'location': {'type': 'string', 'description': 'The city and state, e.g. San Francisco, CA'}
|
| 1674 |
+
},
|
| 1675 |
+
'required': ['location']
|
| 1676 |
+
}
|
| 1677 |
+
}
|
| 1678 |
+
|
| 1679 |
+
# 2. Send the request with tools
|
| 1680 |
+
interaction = client.interactions.create(
|
| 1681 |
+
model='gemini-2.5-flash',
|
| 1682 |
+
input='What is the weather in Mountain View, CA?',
|
| 1683 |
+
tools=[weather_tool]
|
| 1684 |
+
)
|
| 1685 |
+
|
| 1686 |
+
# 3. Handle the tool call
|
| 1687 |
+
for output in interaction.outputs:
|
| 1688 |
+
if output.type == 'function_call':
|
| 1689 |
+
print(f"Tool Call: {output.name}({output.arguments})")
|
| 1690 |
+
|
| 1691 |
+
# Execute your actual function here
|
| 1692 |
+
result = get_weather(**output.arguments)
|
| 1693 |
+
|
| 1694 |
+
# Send result back to the model
|
| 1695 |
+
interaction = client.interactions.create(
|
| 1696 |
+
model='gemini-2.5-flash',
|
| 1697 |
+
previous_interaction_id=interaction.id,
|
| 1698 |
+
input=[{
|
| 1699 |
+
'type': 'function_result',
|
| 1700 |
+
'name': output.name,
|
| 1701 |
+
'call_id': output.id,
|
| 1702 |
+
'result': result
|
| 1703 |
+
}]
|
| 1704 |
+
)
|
| 1705 |
+
print(f"Response: {interaction.outputs[-1].text}")
|
| 1706 |
+
|
| 1707 |
+
```
|
| 1708 |
+
|
| 1709 |
+
### Built-in Tools
|
| 1710 |
+
You can also use Google's built-in tools, such as **Google Search** or **Code Execution**.
|
| 1711 |
+
|
| 1712 |
+
#### Grounding with Google Search
|
| 1713 |
+
|
| 1714 |
+
```python
|
| 1715 |
+
interaction = client.interactions.create(
|
| 1716 |
+
model='gemini-2.5-flash',
|
| 1717 |
+
input='Who won the last Super Bowl?',
|
| 1718 |
+
tools=[{'type': 'google_search'}]
|
| 1719 |
+
)
|
| 1720 |
+
|
| 1721 |
+
# Find the text output (not the GoogleSearchResultContent)
|
| 1722 |
+
text_output = next((o for o in interaction.outputs if o.type == 'text'), None)
|
| 1723 |
+
if text_output:
|
| 1724 |
+
print(text_output.text)
|
| 1725 |
+
|
| 1726 |
+
```
|
| 1727 |
+
|
| 1728 |
+
#### Code Execution
|
| 1729 |
+
|
| 1730 |
+
```python
|
| 1731 |
+
interaction = client.interactions.create(
|
| 1732 |
+
model='gemini-2.5-flash',
|
| 1733 |
+
input='Calculate the 50th Fibonacci number.',
|
| 1734 |
+
tools=[{'type': 'code_execution'}]
|
| 1735 |
+
)
|
| 1736 |
+
print(interaction.outputs[-1].text)
|
| 1737 |
+
|
| 1738 |
+
```
|
| 1739 |
+
|
| 1740 |
+
### Multimodal Output
|
| 1741 |
+
|
| 1742 |
+
The Interactions API can generate multimodal outputs, such as images. You must specify the `response_modalities`.
|
| 1743 |
+
|
| 1744 |
+
```python
|
| 1745 |
+
import base64
|
| 1746 |
+
|
| 1747 |
+
interaction = client.interactions.create(
|
| 1748 |
+
model='gemini-3-pro-image-preview',
|
| 1749 |
+
input='Generate an image of a futuristic city.',
|
| 1750 |
+
response_modalities=['IMAGE']
|
| 1751 |
+
)
|
| 1752 |
+
|
| 1753 |
+
for output in interaction.outputs:
|
| 1754 |
+
if output.type == 'image':
|
| 1755 |
+
print(f"Generated image with mime_type: {output.mime_type}")
|
| 1756 |
+
# Save the image
|
| 1757 |
+
with open("generated_city.png", "wb") as f:
|
| 1758 |
+
f.write(base64.b64decode(output.data))
|
| 1759 |
+
|
| 1760 |
+
```
|
| 1761 |
+
|
| 1762 |
+
## Tunings
|
| 1763 |
+
|
| 1764 |
+
`client.tunings` contains tuning job APIs and supports supervised fine
|
| 1765 |
+
tuning through `tune`. Only supported in Vertex AI. See the 'Create a client'
|
| 1766 |
+
section above to initialize a client.
|
| 1767 |
+
|
| 1768 |
+
### Tune
|
| 1769 |
+
|
| 1770 |
+
- Vertex AI supports tuning from GCS source or from a [Vertex AI Multimodal Dataset](https://docs.cloud.google.com/vertex-ai/generative-ai/docs/multimodal/datasets)
|
| 1771 |
+
|
| 1772 |
+
```python
|
| 1773 |
+
from google.genai import types
|
| 1774 |
+
|
| 1775 |
+
model = 'gemini-2.5-flash'
|
| 1776 |
+
training_dataset = types.TuningDataset(
|
| 1777 |
+
# or gcs_uri=my_vertex_multimodal_dataset
|
| 1778 |
+
gcs_uri='gs://your-gcs-bucket/your-tuning-data.jsonl',
|
| 1779 |
+
)
|
| 1780 |
+
```
|
| 1781 |
+
|
| 1782 |
+
```python
|
| 1783 |
+
from google.genai import types
|
| 1784 |
+
|
| 1785 |
+
tuning_job = client.tunings.tune(
|
| 1786 |
+
base_model=model,
|
| 1787 |
+
training_dataset=training_dataset,
|
| 1788 |
+
config=types.CreateTuningJobConfig(
|
| 1789 |
+
epoch_count=1, tuned_model_display_name='test_dataset_examples model'
|
| 1790 |
+
),
|
| 1791 |
+
)
|
| 1792 |
+
print(tuning_job)
|
| 1793 |
+
```
|
| 1794 |
+
|
| 1795 |
+
### Get Tuning Job
|
| 1796 |
+
|
| 1797 |
+
```python
|
| 1798 |
+
tuning_job = client.tunings.get(name=tuning_job.name)
|
| 1799 |
+
print(tuning_job)
|
| 1800 |
+
```
|
| 1801 |
+
|
| 1802 |
+
```python
|
| 1803 |
+
import time
|
| 1804 |
+
|
| 1805 |
+
completed_states = set(
|
| 1806 |
+
[
|
| 1807 |
+
'JOB_STATE_SUCCEEDED',
|
| 1808 |
+
'JOB_STATE_FAILED',
|
| 1809 |
+
'JOB_STATE_CANCELLED',
|
| 1810 |
+
]
|
| 1811 |
+
)
|
| 1812 |
+
|
| 1813 |
+
while tuning_job.state not in completed_states:
|
| 1814 |
+
print(tuning_job.state)
|
| 1815 |
+
tuning_job = client.tunings.get(name=tuning_job.name)
|
| 1816 |
+
time.sleep(10)
|
| 1817 |
+
```
|
| 1818 |
+
|
| 1819 |
+
#### Use Tuned Model
|
| 1820 |
+
|
| 1821 |
+
```python
|
| 1822 |
+
response = client.models.generate_content(
|
| 1823 |
+
model=tuning_job.tuned_model.endpoint,
|
| 1824 |
+
contents='why is the sky blue?',
|
| 1825 |
+
)
|
| 1826 |
+
|
| 1827 |
+
print(response.text)
|
| 1828 |
+
```
|
| 1829 |
+
|
| 1830 |
+
### Get Tuned Model
|
| 1831 |
+
|
| 1832 |
+
```python
|
| 1833 |
+
tuned_model = client.models.get(model=tuning_job.tuned_model.model)
|
| 1834 |
+
print(tuned_model)
|
| 1835 |
+
```
|
| 1836 |
+
|
| 1837 |
+
### List Tuned Models
|
| 1838 |
+
|
| 1839 |
+
To retrieve base models, see [list base models](#list-base-models).
|
| 1840 |
+
|
| 1841 |
+
```python
|
| 1842 |
+
for model in client.models.list(config={'page_size': 10, 'query_base': False}):
|
| 1843 |
+
print(model)
|
| 1844 |
+
```
|
| 1845 |
+
|
| 1846 |
+
```python
|
| 1847 |
+
pager = client.models.list(config={'page_size': 10, 'query_base': False})
|
| 1848 |
+
print(pager.page_size)
|
| 1849 |
+
print(pager[0])
|
| 1850 |
+
pager.next_page()
|
| 1851 |
+
print(pager[0])
|
| 1852 |
+
```
|
| 1853 |
+
|
| 1854 |
+
#### Async
|
| 1855 |
+
|
| 1856 |
+
```python
|
| 1857 |
+
async for job in await client.aio.models.list(config={'page_size': 10, 'query_base': False}):
|
| 1858 |
+
print(job)
|
| 1859 |
+
```
|
| 1860 |
+
|
| 1861 |
+
```python
|
| 1862 |
+
async_pager = await client.aio.models.list(config={'page_size': 10, 'query_base': False})
|
| 1863 |
+
print(async_pager.page_size)
|
| 1864 |
+
print(async_pager[0])
|
| 1865 |
+
await async_pager.next_page()
|
| 1866 |
+
print(async_pager[0])
|
| 1867 |
+
```
|
| 1868 |
+
|
| 1869 |
+
### Update Tuned Model
|
| 1870 |
+
|
| 1871 |
+
```python
|
| 1872 |
+
from google.genai import types
|
| 1873 |
+
|
| 1874 |
+
model = pager[0]
|
| 1875 |
+
|
| 1876 |
+
model = client.models.update(
|
| 1877 |
+
model=model.name,
|
| 1878 |
+
config=types.UpdateModelConfig(
|
| 1879 |
+
display_name='my tuned model', description='my tuned model description'
|
| 1880 |
+
),
|
| 1881 |
+
)
|
| 1882 |
+
|
| 1883 |
+
print(model)
|
| 1884 |
+
```
|
| 1885 |
+
|
| 1886 |
+
|
| 1887 |
+
### List Tuning Jobs
|
| 1888 |
+
|
| 1889 |
+
```python
|
| 1890 |
+
for job in client.tunings.list(config={'page_size': 10}):
|
| 1891 |
+
print(job)
|
| 1892 |
+
```
|
| 1893 |
+
|
| 1894 |
+
```python
|
| 1895 |
+
pager = client.tunings.list(config={'page_size': 10})
|
| 1896 |
+
print(pager.page_size)
|
| 1897 |
+
print(pager[0])
|
| 1898 |
+
pager.next_page()
|
| 1899 |
+
print(pager[0])
|
| 1900 |
+
```
|
| 1901 |
+
|
| 1902 |
+
#### Async
|
| 1903 |
+
|
| 1904 |
+
```python
|
| 1905 |
+
async for job in await client.aio.tunings.list(config={'page_size': 10}):
|
| 1906 |
+
print(job)
|
| 1907 |
+
```
|
| 1908 |
+
|
| 1909 |
+
```python
|
| 1910 |
+
async_pager = await client.aio.tunings.list(config={'page_size': 10})
|
| 1911 |
+
print(async_pager.page_size)
|
| 1912 |
+
print(async_pager[0])
|
| 1913 |
+
await async_pager.next_page()
|
| 1914 |
+
print(async_pager[0])
|
| 1915 |
+
```
|
| 1916 |
+
|
| 1917 |
+
## Batch Prediction
|
| 1918 |
+
|
| 1919 |
+
Only supported in Vertex AI. See the 'Create a client' section above to
|
| 1920 |
+
initialize a client.
|
| 1921 |
+
|
| 1922 |
+
### Create
|
| 1923 |
+
|
| 1924 |
+
Vertex AI:
|
| 1925 |
+
|
| 1926 |
+
```python
|
| 1927 |
+
# Specify model and source file only, destination and job display name will be auto-populated
|
| 1928 |
+
job = client.batches.create(
|
| 1929 |
+
model='gemini-2.5-flash',
|
| 1930 |
+
src='bq://my-project.my-dataset.my-table', # or "gs://path/to/input/data"
|
| 1931 |
+
)
|
| 1932 |
+
|
| 1933 |
+
print(job)
|
| 1934 |
+
```
|
| 1935 |
+
|
| 1936 |
+
Gemini Developer API:
|
| 1937 |
+
|
| 1938 |
+
```python
|
| 1939 |
+
# Create a batch job with inlined requests
|
| 1940 |
+
batch_job = client.batches.create(
|
| 1941 |
+
model="gemini-2.5-flash",
|
| 1942 |
+
src=[{
|
| 1943 |
+
"contents": [{
|
| 1944 |
+
"parts": [{
|
| 1945 |
+
"text": "Hello!",
|
| 1946 |
+
}],
|
| 1947 |
+
"role": "user",
|
| 1948 |
+
}],
|
| 1949 |
+
"config": {"response_modalities": ["text"]},
|
| 1950 |
+
}],
|
| 1951 |
+
)
|
| 1952 |
+
|
| 1953 |
+
job
|
| 1954 |
+
```
|
| 1955 |
+
|
| 1956 |
+
In order to create a batch job with file name. Need to upload a json file.
|
| 1957 |
+
For example `myrequests.json`:
|
| 1958 |
+
|
| 1959 |
+
```json
|
| 1960 |
+
{"key":"request_1", "request": {"contents": [{"parts": [{"text":
|
| 1961 |
+
"Explain how AI works in a few words"}]}], "generation_config": {"response_modalities": ["TEXT"]}}}
|
| 1962 |
+
{"key":"request_2", "request": {"contents": [{"parts": [{"text": "Explain how Crypto works in a few words"}]}]}}
|
| 1963 |
+
```
|
| 1964 |
+
|
| 1965 |
+
Then upload the file.
|
| 1966 |
+
|
| 1967 |
+
```python
|
| 1968 |
+
# Upload the file
|
| 1969 |
+
file = client.files.upload(
|
| 1970 |
+
file='myrequests.json',
|
| 1971 |
+
config=types.UploadFileConfig(display_name='test-json')
|
| 1972 |
+
)
|
| 1973 |
+
|
| 1974 |
+
# Create a batch job with file name
|
| 1975 |
+
batch_job = client.batches.create(
|
| 1976 |
+
model="gemini-2.5-flash",
|
| 1977 |
+
src="files/test-json",
|
| 1978 |
+
)
|
| 1979 |
+
```
|
| 1980 |
+
|
| 1981 |
+
```python
|
| 1982 |
+
# Get a job by name
|
| 1983 |
+
job = client.batches.get(name=job.name)
|
| 1984 |
+
|
| 1985 |
+
job.state
|
| 1986 |
+
```
|
| 1987 |
+
|
| 1988 |
+
```python
|
| 1989 |
+
completed_states = set(
|
| 1990 |
+
[
|
| 1991 |
+
'JOB_STATE_SUCCEEDED',
|
| 1992 |
+
'JOB_STATE_FAILED',
|
| 1993 |
+
'JOB_STATE_CANCELLED',
|
| 1994 |
+
'JOB_STATE_PAUSED',
|
| 1995 |
+
]
|
| 1996 |
+
)
|
| 1997 |
+
|
| 1998 |
+
while job.state not in completed_states:
|
| 1999 |
+
print(job.state)
|
| 2000 |
+
job = client.batches.get(name=job.name)
|
| 2001 |
+
time.sleep(30)
|
| 2002 |
+
|
| 2003 |
+
job
|
| 2004 |
+
```
|
| 2005 |
+
|
| 2006 |
+
### List
|
| 2007 |
+
|
| 2008 |
+
```python
|
| 2009 |
+
for job in client.batches.list(config=types.ListBatchJobsConfig(page_size=10)):
|
| 2010 |
+
print(job)
|
| 2011 |
+
```
|
| 2012 |
+
|
| 2013 |
+
```python
|
| 2014 |
+
pager = client.batches.list(config=types.ListBatchJobsConfig(page_size=10))
|
| 2015 |
+
print(pager.page_size)
|
| 2016 |
+
print(pager[0])
|
| 2017 |
+
pager.next_page()
|
| 2018 |
+
print(pager[0])
|
| 2019 |
+
```
|
| 2020 |
+
|
| 2021 |
+
#### Async
|
| 2022 |
+
|
| 2023 |
+
```python
|
| 2024 |
+
async for job in await client.aio.batches.list(
|
| 2025 |
+
config=types.ListBatchJobsConfig(page_size=10)
|
| 2026 |
+
):
|
| 2027 |
+
print(job)
|
| 2028 |
+
```
|
| 2029 |
+
|
| 2030 |
+
```python
|
| 2031 |
+
async_pager = await client.aio.batches.list(
|
| 2032 |
+
config=types.ListBatchJobsConfig(page_size=10)
|
| 2033 |
+
)
|
| 2034 |
+
print(async_pager.page_size)
|
| 2035 |
+
print(async_pager[0])
|
| 2036 |
+
await async_pager.next_page()
|
| 2037 |
+
print(async_pager[0])
|
| 2038 |
+
```
|
| 2039 |
+
|
| 2040 |
+
### Delete
|
| 2041 |
+
|
| 2042 |
+
```python
|
| 2043 |
+
# Delete the job resource
|
| 2044 |
+
delete_job = client.batches.delete(name=job.name)
|
| 2045 |
+
|
| 2046 |
+
delete_job
|
| 2047 |
+
```
|
| 2048 |
+
|
| 2049 |
+
## Error Handling
|
| 2050 |
+
|
| 2051 |
+
To handle errors raised by the model service, the SDK provides this [`APIError`](https://github.com/googleapis/python-genai/blob/main/google/genai/errors.py) class.
|
| 2052 |
+
|
| 2053 |
+
```python
|
| 2054 |
+
from google.genai import errors
|
| 2055 |
+
|
| 2056 |
+
try:
|
| 2057 |
+
client.models.generate_content(
|
| 2058 |
+
model="invalid-model-name",
|
| 2059 |
+
contents="What is your name?",
|
| 2060 |
+
)
|
| 2061 |
+
except errors.APIError as e:
|
| 2062 |
+
print(e.code) # 404
|
| 2063 |
+
print(e.message)
|
| 2064 |
+
```
|
| 2065 |
+
|
| 2066 |
+
## Extra Request Body
|
| 2067 |
+
|
| 2068 |
+
The `extra_body` field in `HttpOptions` accepts a dictionary of additional JSON
|
| 2069 |
+
properties to include in the request body. This can be used to access new or
|
| 2070 |
+
experimental backend features that are not yet formally supported in the SDK.
|
| 2071 |
+
The structure of the dictionary must match the backend API's request structure.
|
| 2072 |
+
|
| 2073 |
+
- Vertex AI backend API docs: https://cloud.google.com/vertex-ai/docs/reference/rest
|
| 2074 |
+
- Gemini API backend API docs: https://ai.google.dev/api/rest
|
| 2075 |
+
|
| 2076 |
+
```python
|
| 2077 |
+
response = client.models.generate_content(
|
| 2078 |
+
model="gemini-2.5-pro",
|
| 2079 |
+
contents="What is the weather in Boston? and how about Sunnyvale?",
|
| 2080 |
+
config=types.GenerateContentConfig(
|
| 2081 |
+
tools=[get_current_weather],
|
| 2082 |
+
http_options=types.HttpOptions(extra_body={'tool_config': {'function_calling_config': {'mode': 'COMPOSITIONAL'}}}),
|
| 2083 |
+
),
|
| 2084 |
+
)
|
| 2085 |
+
```
|
.cache/pip/http-v2/6/e/b/2/9/6eb29acc74a7b2a4fa9d02eaa2d7b3d6780e701cba01a5f9b1bc28ad
ADDED
|
Binary file (1.2 kB). View file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summary: Easily download, build, install, upgrade, and uninstall Python packages
|
| 5 |
+
Author-email: Python Packaging Authority <distutils-sig@python.org>
|
| 6 |
+
License-Expression: MIT
|
| 7 |
+
Project-URL: Source, https://github.com/pypa/setuptools
|
| 8 |
+
Project-URL: Documentation, https://setuptools.pypa.io/
|
| 9 |
+
Project-URL: Changelog, https://setuptools.pypa.io/en/stable/history.html
|
| 10 |
+
Keywords: CPAN PyPI distutils eggs package management
|
| 11 |
+
Classifier: Development Status :: 5 - Production/Stable
|
| 12 |
+
Classifier: Intended Audience :: Developers
|
| 13 |
+
Classifier: Programming Language :: Python :: 3
|
| 14 |
+
Classifier: Programming Language :: Python :: 3 :: Only
|
| 15 |
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
| 16 |
+
Classifier: Topic :: System :: Archiving :: Packaging
|
| 17 |
+
Classifier: Topic :: System :: Systems Administration
|
| 18 |
+
Classifier: Topic :: Utilities
|
| 19 |
+
Requires-Python: >=3.9
|
| 20 |
+
Description-Content-Type: text/x-rst
|
| 21 |
+
License-File: LICENSE
|
| 22 |
+
Provides-Extra: test
|
| 23 |
+
Requires-Dist: pytest!=8.1.*,>=6; extra == "test"
|
| 24 |
+
Requires-Dist: virtualenv>=13.0.0; extra == "test"
|
| 25 |
+
Requires-Dist: wheel>=0.44.0; extra == "test"
|
| 26 |
+
Requires-Dist: pip>=19.1; extra == "test"
|
| 27 |
+
Requires-Dist: packaging>=24.2; extra == "test"
|
| 28 |
+
Requires-Dist: jaraco.envs>=2.2; extra == "test"
|
| 29 |
+
Requires-Dist: pytest-xdist>=3; extra == "test"
|
| 30 |
+
Requires-Dist: jaraco.path>=3.7.2; extra == "test"
|
| 31 |
+
Requires-Dist: build[virtualenv]>=1.0.3; extra == "test"
|
| 32 |
+
Requires-Dist: filelock>=3.4.0; extra == "test"
|
| 33 |
+
Requires-Dist: ini2toml[lite]>=0.14; extra == "test"
|
| 34 |
+
Requires-Dist: tomli-w>=1.0.0; extra == "test"
|
| 35 |
+
Requires-Dist: pytest-timeout; extra == "test"
|
| 36 |
+
Requires-Dist: pytest-perf; sys_platform != "cygwin" and extra == "test"
|
| 37 |
+
Requires-Dist: jaraco.develop>=7.21; (python_version >= "3.9" and sys_platform != "cygwin") and extra == "test"
|
| 38 |
+
Requires-Dist: pytest-home>=0.5; extra == "test"
|
| 39 |
+
Requires-Dist: pytest-subprocess; extra == "test"
|
| 40 |
+
Requires-Dist: pyproject-hooks!=1.1; extra == "test"
|
| 41 |
+
Requires-Dist: jaraco.test>=5.5; extra == "test"
|
| 42 |
+
Provides-Extra: doc
|
| 43 |
+
Requires-Dist: sphinx>=3.5; extra == "doc"
|
| 44 |
+
Requires-Dist: jaraco.packaging>=9.3; extra == "doc"
|
| 45 |
+
Requires-Dist: rst.linker>=1.9; extra == "doc"
|
| 46 |
+
Requires-Dist: furo; extra == "doc"
|
| 47 |
+
Requires-Dist: sphinx-lint; extra == "doc"
|
| 48 |
+
Requires-Dist: jaraco.tidelift>=1.4; extra == "doc"
|
| 49 |
+
Requires-Dist: pygments-github-lexers==0.0.5; extra == "doc"
|
| 50 |
+
Requires-Dist: sphinx-favicon; extra == "doc"
|
| 51 |
+
Requires-Dist: sphinx-inline-tabs; extra == "doc"
|
| 52 |
+
Requires-Dist: sphinx-reredirects; extra == "doc"
|
| 53 |
+
Requires-Dist: sphinxcontrib-towncrier; extra == "doc"
|
| 54 |
+
Requires-Dist: sphinx-notfound-page<2,>=1; extra == "doc"
|
| 55 |
+
Requires-Dist: pyproject-hooks!=1.1; extra == "doc"
|
| 56 |
+
Requires-Dist: towncrier<24.7; extra == "doc"
|
| 57 |
+
Provides-Extra: ssl
|
| 58 |
+
Provides-Extra: certs
|
| 59 |
+
Provides-Extra: core
|
| 60 |
+
Requires-Dist: packaging>=24.2; extra == "core"
|
| 61 |
+
Requires-Dist: more_itertools>=8.8; extra == "core"
|
| 62 |
+
Requires-Dist: jaraco.text>=3.7; extra == "core"
|
| 63 |
+
Requires-Dist: importlib_metadata>=6; python_version < "3.10" and extra == "core"
|
| 64 |
+
Requires-Dist: tomli>=2.0.1; python_version < "3.11" and extra == "core"
|
| 65 |
+
Requires-Dist: wheel>=0.43.0; extra == "core"
|
| 66 |
+
Requires-Dist: platformdirs>=4.2.2; extra == "core"
|
| 67 |
+
Requires-Dist: jaraco.functools>=4; extra == "core"
|
| 68 |
+
Requires-Dist: more_itertools; extra == "core"
|
| 69 |
+
Provides-Extra: check
|
| 70 |
+
Requires-Dist: pytest-checkdocs>=2.4; extra == "check"
|
| 71 |
+
Requires-Dist: pytest-ruff>=0.2.1; sys_platform != "cygwin" and extra == "check"
|
| 72 |
+
Requires-Dist: ruff>=0.13.0; sys_platform != "cygwin" and extra == "check"
|
| 73 |
+
Provides-Extra: cover
|
| 74 |
+
Requires-Dist: pytest-cov; extra == "cover"
|
| 75 |
+
Provides-Extra: enabler
|
| 76 |
+
Requires-Dist: pytest-enabler>=2.2; extra == "enabler"
|
| 77 |
+
Provides-Extra: type
|
| 78 |
+
Requires-Dist: pytest-mypy; extra == "type"
|
| 79 |
+
Requires-Dist: mypy==1.18.*; extra == "type"
|
| 80 |
+
Requires-Dist: importlib_metadata>=7.0.2; python_version < "3.10" and extra == "type"
|
| 81 |
+
Requires-Dist: jaraco.develop>=7.21; sys_platform != "cygwin" and extra == "type"
|
| 82 |
+
Dynamic: license-file
|
| 83 |
+
|
| 84 |
+
.. |pypi-version| image:: https://img.shields.io/pypi/v/setuptools.svg
|
| 85 |
+
:target: https://pypi.org/project/setuptools
|
| 86 |
+
|
| 87 |
+
.. |py-version| image:: https://img.shields.io/pypi/pyversions/setuptools.svg
|
| 88 |
+
|
| 89 |
+
.. |test-badge| image:: https://github.com/pypa/setuptools/actions/workflows/main.yml/badge.svg
|
| 90 |
+
:target: https://github.com/pypa/setuptools/actions?query=workflow%3A%22tests%22
|
| 91 |
+
:alt: tests
|
| 92 |
+
|
| 93 |
+
.. |ruff-badge| image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json
|
| 94 |
+
:target: https://github.com/astral-sh/ruff
|
| 95 |
+
:alt: Ruff
|
| 96 |
+
|
| 97 |
+
.. |docs-badge| image:: https://img.shields.io/readthedocs/setuptools/latest.svg
|
| 98 |
+
:target: https://setuptools.pypa.io
|
| 99 |
+
|
| 100 |
+
.. |skeleton-badge| image:: https://img.shields.io/badge/skeleton-2025-informational
|
| 101 |
+
:target: https://blog.jaraco.com/skeleton
|
| 102 |
+
|
| 103 |
+
.. |codecov-badge| image:: https://img.shields.io/codecov/c/github/pypa/setuptools/master.svg?logo=codecov&logoColor=white
|
| 104 |
+
:target: https://codecov.io/gh/pypa/setuptools
|
| 105 |
+
|
| 106 |
+
.. |tidelift-badge| image:: https://tidelift.com/badges/github/pypa/setuptools?style=flat
|
| 107 |
+
:target: https://tidelift.com/subscription/pkg/pypi-setuptools?utm_source=pypi-setuptools&utm_medium=readme
|
| 108 |
+
|
| 109 |
+
.. |discord-badge| image:: https://img.shields.io/discord/803025117553754132
|
| 110 |
+
:target: https://discord.com/channels/803025117553754132/815945031150993468
|
| 111 |
+
:alt: Discord
|
| 112 |
+
|
| 113 |
+
|pypi-version| |py-version| |test-badge| |ruff-badge| |docs-badge| |skeleton-badge| |codecov-badge| |discord-badge|
|
| 114 |
+
|
| 115 |
+
See the `Quickstart <https://setuptools.pypa.io/en/latest/userguide/quickstart.html>`_
|
| 116 |
+
and the `User's Guide <https://setuptools.pypa.io/en/latest/userguide/>`_ for
|
| 117 |
+
instructions on how to use Setuptools.
|
| 118 |
+
|
| 119 |
+
Questions and comments should be directed to `GitHub Discussions
|
| 120 |
+
<https://github.com/pypa/setuptools/discussions>`_.
|
| 121 |
+
Bug reports and especially tested patches may be
|
| 122 |
+
submitted directly to the `bug tracker
|
| 123 |
+
<https://github.com/pypa/setuptools/issues>`_.
|
| 124 |
+
|
| 125 |
+
|
| 126 |
+
Code of Conduct
|
| 127 |
+
===============
|
| 128 |
+
|
| 129 |
+
Everyone interacting in the setuptools project's codebases, issue trackers,
|
| 130 |
+
chat rooms, and fora is expected to follow the
|
| 131 |
+
`PSF Code of Conduct <https://github.com/pypa/.github/blob/main/CODE_OF_CONDUCT.md>`_.
|
| 132 |
+
|
| 133 |
+
|
| 134 |
+
For Enterprise
|
| 135 |
+
==============
|
| 136 |
+
|
| 137 |
+
Available as part of the Tidelift Subscription.
|
| 138 |
+
|
| 139 |
+
Setuptools and the maintainers of thousands of other packages are working with Tidelift to deliver one enterprise subscription that covers all of the open source you use.
|
| 140 |
+
|
| 141 |
+
`Learn more <https://tidelift.com/subscription/pkg/pypi-setuptools?utm_source=pypi-setuptools&utm_medium=referral&utm_campaign=github>`_.
|
.cache/pip/http-v2/a/2/6/7/f/a267f54c19667a20e6416d2dc2a1df4a525eed802f0f2b538b654da1
ADDED
|
Binary file (1.78 kB). View file
|
|
|
.cache/pip/http-v2/c/0/4/0/0/c0400f4849a16bb7ec1db13ba6d964327b0869995ab53c54f6668654
ADDED
|
Binary file (1.85 kB). View file
|
|
|
.cache/pip/http-v2/c/0/4/0/0/c0400f4849a16bb7ec1db13ba6d964327b0869995ab53c54f6668654.body
ADDED
|
Binary file (6.58 kB). View file
|
|
|
.cache/pip/http-v2/c/5/2/e/2/c52e2f1dd5b9608ced10cc1a661cb4850330552cdc6801105598d8e4
ADDED
|
Binary file (1.2 kB). View file
|
|
|
.cache/pip/http-v2/c/5/2/e/2/c52e2f1dd5b9608ced10cc1a661cb4850330552cdc6801105598d8e4.body
ADDED
|
@@ -0,0 +1,356 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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 |
+
Requires-Python: >=3.9
|
| 7 |
+
Description-Content-Type: text/x-rst
|
| 8 |
+
Classifier: Development Status :: 5 - Production/Stable
|
| 9 |
+
Classifier: Intended Audience :: Developers
|
| 10 |
+
Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)
|
| 11 |
+
Classifier: Operating System :: OS Independent
|
| 12 |
+
Classifier: Programming Language :: Python
|
| 13 |
+
Classifier: Programming Language :: Python :: 3
|
| 14 |
+
Classifier: Programming Language :: Python :: 3.9
|
| 15 |
+
Classifier: Programming Language :: Python :: 3.10
|
| 16 |
+
Classifier: Programming Language :: Python :: 3.11
|
| 17 |
+
Classifier: Programming Language :: Python :: 3.12
|
| 18 |
+
Classifier: Programming Language :: Python :: 3.13
|
| 19 |
+
Classifier: Programming Language :: Python :: 3.14
|
| 20 |
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
| 21 |
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
| 22 |
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
| 23 |
+
Classifier: Topic :: Utilities
|
| 24 |
+
License-File: LICENSE
|
| 25 |
+
Requires-Dist: hyperscan >=0.7 ; extra == "hyperscan"
|
| 26 |
+
Requires-Dist: typing-extensions >=4 ; extra == "optional"
|
| 27 |
+
Requires-Dist: google-re2 >=1.1 ; extra == "re2"
|
| 28 |
+
Requires-Dist: pytest >=9 ; extra == "tests"
|
| 29 |
+
Requires-Dist: typing-extensions >=4.15 ; extra == "tests"
|
| 30 |
+
Project-URL: Documentation, https://python-path-specification.readthedocs.io/en/latest/index.html
|
| 31 |
+
Project-URL: Issue Tracker, https://github.com/cpburnz/python-pathspec/issues
|
| 32 |
+
Project-URL: Source Code, https://github.com/cpburnz/python-pathspec
|
| 33 |
+
Provides-Extra: hyperscan
|
| 34 |
+
Provides-Extra: optional
|
| 35 |
+
Provides-Extra: re2
|
| 36 |
+
Provides-Extra: tests
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
PathSpec
|
| 40 |
+
========
|
| 41 |
+
|
| 42 |
+
*pathspec* is a utility library for pattern matching of file paths. So far this
|
| 43 |
+
only includes Git's `gitignore`_ pattern matching.
|
| 44 |
+
|
| 45 |
+
.. _`gitignore`: http://git-scm.com/docs/gitignore
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
Tutorial
|
| 49 |
+
--------
|
| 50 |
+
|
| 51 |
+
Say you have a "Projects" directory and you want to back it up, but only
|
| 52 |
+
certain files, and ignore others depending on certain conditions::
|
| 53 |
+
|
| 54 |
+
>>> from pathspec import PathSpec
|
| 55 |
+
>>> # The gitignore-style patterns for files to select, but we're including
|
| 56 |
+
>>> # instead of ignoring.
|
| 57 |
+
>>> spec_text = """
|
| 58 |
+
...
|
| 59 |
+
... # This is a comment because the line begins with a hash: "#"
|
| 60 |
+
...
|
| 61 |
+
... # Include several project directories (and all descendants) relative to
|
| 62 |
+
... # the current directory. To reference only a directory you must end with a
|
| 63 |
+
... # slash: "/"
|
| 64 |
+
... /project-a/
|
| 65 |
+
... /project-b/
|
| 66 |
+
... /project-c/
|
| 67 |
+
...
|
| 68 |
+
... # Patterns can be negated by prefixing with exclamation mark: "!"
|
| 69 |
+
...
|
| 70 |
+
... # Ignore temporary files beginning or ending with "~" and ending with
|
| 71 |
+
... # ".swp".
|
| 72 |
+
... !~*
|
| 73 |
+
... !*~
|
| 74 |
+
... !*.swp
|
| 75 |
+
...
|
| 76 |
+
... # These are python projects so ignore compiled python files from
|
| 77 |
+
... # testing.
|
| 78 |
+
... !*.pyc
|
| 79 |
+
...
|
| 80 |
+
... # Ignore the build directories but only directly under the project
|
| 81 |
+
... # directories.
|
| 82 |
+
... !/*/build/
|
| 83 |
+
...
|
| 84 |
+
... """
|
| 85 |
+
|
| 86 |
+
The ``PathSpec`` class provides an abstraction around pattern implementations,
|
| 87 |
+
and we want to compile our patterns as "gitignore" patterns. You could call it a
|
| 88 |
+
wrapper for a list of compiled patterns::
|
| 89 |
+
|
| 90 |
+
>>> spec = PathSpec.from_lines('gitignore', spec_text.splitlines())
|
| 91 |
+
|
| 92 |
+
If we wanted to manually compile the patterns, we can use the ``GitIgnoreBasicPattern``
|
| 93 |
+
class directly. It is used in the background for "gitignore" which internally
|
| 94 |
+
converts patterns to regular expressions::
|
| 95 |
+
|
| 96 |
+
>>> from pathspec.patterns.gitignore.basic import GitIgnoreBasicPattern
|
| 97 |
+
>>> patterns = map(GitIgnoreBasicPattern, spec_text.splitlines())
|
| 98 |
+
>>> spec = PathSpec(patterns)
|
| 99 |
+
|
| 100 |
+
``PathSpec.from_lines()`` is a class method which simplifies that.
|
| 101 |
+
|
| 102 |
+
If you want to load the patterns from file, you can pass the file object
|
| 103 |
+
directly as well::
|
| 104 |
+
|
| 105 |
+
>>> with open('patterns.list', 'r') as fh:
|
| 106 |
+
>>> spec = PathSpec.from_lines('gitignore', fh)
|
| 107 |
+
|
| 108 |
+
You can perform matching on a whole directory tree with::
|
| 109 |
+
|
| 110 |
+
>>> matches = set(spec.match_tree_files('path/to/directory'))
|
| 111 |
+
|
| 112 |
+
Or you can perform matching on a specific set of file paths with::
|
| 113 |
+
|
| 114 |
+
>>> matches = set(spec.match_files(file_paths))
|
| 115 |
+
|
| 116 |
+
Or check to see if an individual file matches::
|
| 117 |
+
|
| 118 |
+
>>> is_matched = spec.match_file(file_path)
|
| 119 |
+
|
| 120 |
+
There's actually two implementations of "gitignore". The basic implementation is
|
| 121 |
+
used by ``PathSpec`` and follows patterns as documented by `gitignore`_.
|
| 122 |
+
However, Git's behavior differs from the documented patterns. There's some
|
| 123 |
+
edge-cases, and in particular, Git allows including files from excluded
|
| 124 |
+
directories which appears to contradict the documentation. ``GitIgnoreSpec``
|
| 125 |
+
handles these cases to more closely replicate Git's behavior::
|
| 126 |
+
|
| 127 |
+
>>> from pathspec import GitIgnoreSpec
|
| 128 |
+
>>> spec = GitIgnoreSpec.from_lines(spec_text.splitlines())
|
| 129 |
+
|
| 130 |
+
You do not specify the style of pattern for ``GitIgnoreSpec`` because it should
|
| 131 |
+
always use ``GitIgnoreSpecPattern`` internally.
|
| 132 |
+
|
| 133 |
+
|
| 134 |
+
Performance
|
| 135 |
+
-----------
|
| 136 |
+
|
| 137 |
+
Running lots of regular expression matches against thousands of files in Python
|
| 138 |
+
is slow. Alternate regular expression backends can be used to improve
|
| 139 |
+
performance. ``PathSpec`` and ``GitIgnoreSpec`` both accept a ``backend``
|
| 140 |
+
parameter to control the backend. The default is "best" to automatically choose
|
| 141 |
+
the best available backend. There are currently 3 backends.
|
| 142 |
+
|
| 143 |
+
The "simple" backend is the default and it simply uses Python's ``re.Pattern``
|
| 144 |
+
objects that are normally created. This can be the fastest when there's only 1
|
| 145 |
+
or 2 patterns.
|
| 146 |
+
|
| 147 |
+
The "hyperscan" backend uses the `hyperscan`_ library. Hyperscan tends to be at
|
| 148 |
+
least 2 times faster than "simple", and generally slower than "re2". This can be
|
| 149 |
+
faster than "re2" under the right conditions with pattern counts of 1-25.
|
| 150 |
+
|
| 151 |
+
The "re2" backend uses the `google-re2`_ library (not to be confused with the
|
| 152 |
+
*re2* library on PyPI which is unrelated and abandoned). Google's re2 tends to
|
| 153 |
+
be significantly faster than "simple", and 3 times faster than "hyperscan" at
|
| 154 |
+
high pattern counts.
|
| 155 |
+
|
| 156 |
+
See `benchmarks_backends.md`_ for comparisons between native Python regular
|
| 157 |
+
expressions and the optional backends.
|
| 158 |
+
|
| 159 |
+
|
| 160 |
+
.. _`benchmarks_backends.md`: https://github.com/cpburnz/python-pathspec/blob/master/benchmarks_backends.md
|
| 161 |
+
.. _`google-re2`: https://pypi.org/project/google-re2/
|
| 162 |
+
.. _`hyperscan`: https://pypi.org/project/hyperscan/
|
| 163 |
+
|
| 164 |
+
|
| 165 |
+
FAQ
|
| 166 |
+
---
|
| 167 |
+
|
| 168 |
+
|
| 169 |
+
1. How do I ignore files like *.gitignore*?
|
| 170 |
+
+++++++++++++++++++++++++++++++++++++++++++
|
| 171 |
+
|
| 172 |
+
``GitIgnoreSpec`` (and ``PathSpec``) positively match files by default. To find
|
| 173 |
+
the files to keep, and exclude files like *.gitignore*, you need to set
|
| 174 |
+
``negate=True`` to flip the results::
|
| 175 |
+
|
| 176 |
+
>>> from pathspec import GitIgnoreSpec
|
| 177 |
+
>>> spec = GitIgnoreSpec.from_lines([...])
|
| 178 |
+
>>> keep_files = set(spec.match_tree_files('path/to/directory', negate=True))
|
| 179 |
+
>>> ignore_files = set(spec.match_tree_files('path/to/directory'))
|
| 180 |
+
|
| 181 |
+
|
| 182 |
+
License
|
| 183 |
+
-------
|
| 184 |
+
|
| 185 |
+
*pathspec* is licensed under the `Mozilla Public License Version 2.0`_. See
|
| 186 |
+
`LICENSE`_ or the `FAQ`_ for more information.
|
| 187 |
+
|
| 188 |
+
In summary, you may use *pathspec* with any closed or open source project
|
| 189 |
+
without affecting the license of the larger work so long as you:
|
| 190 |
+
|
| 191 |
+
- give credit where credit is due,
|
| 192 |
+
|
| 193 |
+
- and release any custom changes made to *pathspec*.
|
| 194 |
+
|
| 195 |
+
.. _`Mozilla Public License Version 2.0`: http://www.mozilla.org/MPL/2.0
|
| 196 |
+
.. _`LICENSE`: LICENSE
|
| 197 |
+
.. _`FAQ`: http://www.mozilla.org/MPL/2.0/FAQ.html
|
| 198 |
+
|
| 199 |
+
|
| 200 |
+
Source
|
| 201 |
+
------
|
| 202 |
+
|
| 203 |
+
The source code for *pathspec* is available from the GitHub repo
|
| 204 |
+
`cpburnz/python-pathspec`_.
|
| 205 |
+
|
| 206 |
+
.. _`cpburnz/python-pathspec`: https://github.com/cpburnz/python-pathspec
|
| 207 |
+
|
| 208 |
+
|
| 209 |
+
Installation
|
| 210 |
+
------------
|
| 211 |
+
|
| 212 |
+
*pathspec* is available for install through `PyPI`_::
|
| 213 |
+
|
| 214 |
+
pip install pathspec
|
| 215 |
+
|
| 216 |
+
*pathspec* can also be built from source. The following packages will be
|
| 217 |
+
required:
|
| 218 |
+
|
| 219 |
+
- `build`_ (>=0.6.0)
|
| 220 |
+
|
| 221 |
+
*pathspec* can then be built and installed with::
|
| 222 |
+
|
| 223 |
+
python -m build
|
| 224 |
+
pip install dist/pathspec-*-py3-none-any.whl
|
| 225 |
+
|
| 226 |
+
The following optional dependencies can be installed:
|
| 227 |
+
|
| 228 |
+
- `google-re2`_: Enables optional "re2" backend.
|
| 229 |
+
- `hyperscan`_: Enables optional "hyperscan" backend.
|
| 230 |
+
- `typing-extensions`_: Improves some type hints.
|
| 231 |
+
|
| 232 |
+
.. _`PyPI`: http://pypi.python.org/pypi/pathspec
|
| 233 |
+
.. _`build`: https://pypi.org/project/build/
|
| 234 |
+
.. _`typing-extensions`: https://pypi.org/project/typing-extensions/
|
| 235 |
+
|
| 236 |
+
|
| 237 |
+
Documentation
|
| 238 |
+
-------------
|
| 239 |
+
|
| 240 |
+
Documentation for *pathspec* is available on `Read the Docs`_.
|
| 241 |
+
|
| 242 |
+
The full change history can be found in `CHANGES.rst`_ and `Change History`_.
|
| 243 |
+
|
| 244 |
+
An upgrade guide is available in `UPGRADING.rst`_ and `Upgrade Guide`_.
|
| 245 |
+
|
| 246 |
+
.. _`CHANGES.rst`: https://github.com/cpburnz/python-pathspec/blob/master/CHANGES.rst
|
| 247 |
+
.. _`Change History`: https://python-path-specification.readthedocs.io/en/stable/changes.html
|
| 248 |
+
.. _`Read the Docs`: https://python-path-specification.readthedocs.io
|
| 249 |
+
.. _`UPGRADING.rst`: https://github.com/cpburnz/python-pathspec/blob/master/UPGRADING.rst
|
| 250 |
+
.. _`Upgrade Guide`: https://python-path-specification.readthedocs.io/en/stable/upgrading.html
|
| 251 |
+
|
| 252 |
+
|
| 253 |
+
Other Languages
|
| 254 |
+
---------------
|
| 255 |
+
|
| 256 |
+
The related project `pathspec-ruby`_ (by *highb*) provides a similar library as
|
| 257 |
+
a `Ruby gem`_.
|
| 258 |
+
|
| 259 |
+
.. _`pathspec-ruby`: https://github.com/highb/pathspec-ruby
|
| 260 |
+
.. _`Ruby gem`: https://rubygems.org/gems/pathspec
|
| 261 |
+
|
| 262 |
+
|
| 263 |
+
Change History
|
| 264 |
+
==============
|
| 265 |
+
|
| 266 |
+
|
| 267 |
+
1.0.4 (2026-01-26)
|
| 268 |
+
------------------
|
| 269 |
+
|
| 270 |
+
- `Issue #103`_: Using re2 fails if pyre2 is also installed.
|
| 271 |
+
|
| 272 |
+
.. _`Issue #103`: https://github.com/cpburnz/python-pathspec/issues/103
|
| 273 |
+
|
| 274 |
+
|
| 275 |
+
1.0.3 (2026-01-09)
|
| 276 |
+
------------------
|
| 277 |
+
|
| 278 |
+
Bug fixes:
|
| 279 |
+
|
| 280 |
+
- `Issue #101`_: pyright strict errors with pathspec >= 1.0.0.
|
| 281 |
+
- `Issue #102`_: No module named 'tomllib'.
|
| 282 |
+
|
| 283 |
+
|
| 284 |
+
.. _`Issue #101`: https://github.com/cpburnz/python-pathspec/issues/101
|
| 285 |
+
.. _`Issue #102`: https://github.com/cpburnz/python-pathspec/issues/102
|
| 286 |
+
|
| 287 |
+
|
| 288 |
+
1.0.2 (2026-01-07)
|
| 289 |
+
------------------
|
| 290 |
+
|
| 291 |
+
Bug fixes:
|
| 292 |
+
|
| 293 |
+
- Type hint `collections.abc.Callable` does not properly replace `typing.Callable` until Python 3.9.2.
|
| 294 |
+
|
| 295 |
+
|
| 296 |
+
1.0.1 (2026-01-06)
|
| 297 |
+
------------------
|
| 298 |
+
|
| 299 |
+
Bug fixes:
|
| 300 |
+
|
| 301 |
+
- `Issue #100`_: ValueError(f"{patterns=!r} cannot be empty.") when using black.
|
| 302 |
+
|
| 303 |
+
|
| 304 |
+
.. _`Issue #100`: https://github.com/cpburnz/python-pathspec/issues/100
|
| 305 |
+
|
| 306 |
+
|
| 307 |
+
1.0.0 (2026-01-05)
|
| 308 |
+
------------------
|
| 309 |
+
|
| 310 |
+
Major changes:
|
| 311 |
+
|
| 312 |
+
- `Issue #91`_: Dropped support of EoL Python 3.8.
|
| 313 |
+
- Added concept of backends to allow for faster regular expression matching. The backend can be controlled using the `backend` argument to `PathSpec()`, `PathSpec.from_lines()`, `GitIgnoreSpec()`, and `GitIgnoreSpec.from_lines()`.
|
| 314 |
+
- Renamed "gitwildmatch" pattern back to "gitignore". The "gitignore" pattern behaves slightly differently when used with `PathSpec` (*gitignore* as documented) than with `GitIgnoreSpec` (replicates *Git*'s edge cases).
|
| 315 |
+
|
| 316 |
+
API changes:
|
| 317 |
+
|
| 318 |
+
- Breaking: protected method `pathspec.pathspec.PathSpec._match_file()` (with a leading underscore) has been removed and replaced by backends. This does not affect normal usage of `PathSpec` or `GitIgnoreSpec`. Only custom subclasses will be affected. If this breaks your usage, let me know by `opening an issue <https://github.com/cpburnz/python-pathspec/issues>`_.
|
| 319 |
+
- Deprecated: "gitwildmatch" is now an alias for "gitignore".
|
| 320 |
+
- Deprecated: `pathspec.patterns.GitWildMatchPattern` is now an alias for `pathspec.patterns.gitignore.spec.GitIgnoreSpecPattern`.
|
| 321 |
+
- Deprecated: `pathspec.patterns.gitwildmatch` module has been replaced by the `pathspec.patterns.gitignore` package.
|
| 322 |
+
- Deprecated: `pathspec.patterns.gitwildmatch.GitWildMatchPattern` is now an alias for `pathspec.patterns.gitignore.spec.GitIgnoreSpecPattern`.
|
| 323 |
+
- Deprecated: `pathspec.patterns.gitwildmatch.GitWildMatchPatternError` is now an alias for `pathspec.patterns.gitignore.GitIgnorePatternError`.
|
| 324 |
+
- Removed: `pathspec.patterns.gitwildmatch.GitIgnorePattern` has been deprecated since v0.4 (2016-07-15).
|
| 325 |
+
- Signature of method `pathspec.pattern.RegexPattern.match_file()` has been changed from `def match_file(self, file: str) -> RegexMatchResult | None` to `def match_file(self, file: AnyStr) -> RegexMatchResult | None` to reflect usage.
|
| 326 |
+
- Signature of class method `pathspec.pattern.RegexPattern.pattern_to_regex()` has been changed from `def pattern_to_regex(cls, pattern: str) -> tuple[str, bool]` to `def pattern_to_regex(cls, pattern: AnyStr) -> tuple[AnyStr | None, bool | None]` to reflect usage and documentation.
|
| 327 |
+
|
| 328 |
+
New features:
|
| 329 |
+
|
| 330 |
+
- Added optional "hyperscan" backend using `hyperscan`_ library. It will automatically be used when installed. This dependency can be installed with ``pip install 'pathspec[hyperscan]'``.
|
| 331 |
+
- Added optional "re2" backend using the `google-re2`_ library. It will automatically be used when installed. This dependency can be installed with ``pip install 'pathspec[re2]'``.
|
| 332 |
+
- Added optional dependency on `typing-extensions`_ library to improve some type hints.
|
| 333 |
+
|
| 334 |
+
Bug fixes:
|
| 335 |
+
|
| 336 |
+
- `Issue #93`_: Do not remove leading spaces.
|
| 337 |
+
- `Issue #95`_: Matching for files inside folder does not seem to behave like .gitignore's.
|
| 338 |
+
- `Issue #98`_: UnboundLocalError in RegexPattern when initialized with `pattern=None`.
|
| 339 |
+
- Type hint on return value of `pathspec.pattern.RegexPattern.match_file()` to match documentation.
|
| 340 |
+
|
| 341 |
+
Improvements:
|
| 342 |
+
|
| 343 |
+
- Mark Python 3.13 and 3.14 as supported.
|
| 344 |
+
- No-op patterns are now filtered out when matching files, slightly improving performance.
|
| 345 |
+
- Fix performance regression in `iter_tree_files()` from v0.10.
|
| 346 |
+
|
| 347 |
+
|
| 348 |
+
.. _`Issue #38`: https://github.com/cpburnz/python-pathspec/issues/38
|
| 349 |
+
.. _`Issue #91`: https://github.com/cpburnz/python-pathspec/issues/91
|
| 350 |
+
.. _`Issue #93`: https://github.com/cpburnz/python-pathspec/issues/93
|
| 351 |
+
.. _`Issue #95`: https://github.com/cpburnz/python-pathspec/issues/95
|
| 352 |
+
.. _`Issue #98`: https://github.com/cpburnz/python-pathspec/issues/98
|
| 353 |
+
.. _`google-re2`: https://pypi.org/project/google-re2/
|
| 354 |
+
.. _`hyperscan`: https://pypi.org/project/hyperscan/
|
| 355 |
+
.. _`typing-extensions`: https://pypi.org/project/typing-extensions/
|
| 356 |
+
|
.cache/pip/http-v2/c/6/f/3/1/c6f3192810e6b78a08fee1da61557cd4bdd93a63331b9d474bca9d38
ADDED
|
Binary file (1.15 kB). View file
|
|
|
.cache/pip/http-v2/c/6/f/3/1/c6f3192810e6b78a08fee1da61557cd4bdd93a63331b9d474bca9d38.body
ADDED
|
Binary file (74.4 kB). View file
|
|
|
.cache/pip/http-v2/c/7/8/8/7/c78874231318158a294dd5b68c42610cc1c0c99d6a1453dfec26706e
ADDED
|
Binary file (1.17 kB). View file
|
|
|
.cache/pip/http-v2/c/7/8/8/7/c78874231318158a294dd5b68c42610cc1c0c99d6a1453dfec26706e.body
ADDED
|
@@ -0,0 +1,819 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.3
|
| 2 |
+
Name: together
|
| 3 |
+
Version: 2.2.0
|
| 4 |
+
Summary: The official Python library for the together API
|
| 5 |
+
Project-URL: Homepage, https://github.com/togethercomputer/together-py
|
| 6 |
+
Project-URL: Repository, https://github.com/togethercomputer/together-py
|
| 7 |
+
Project-URL: Documentation, https://docs.together.ai/
|
| 8 |
+
Project-URL: Changelog, https://github.com/togethercomputer/together-py/blob/main/CHANGELOG.md
|
| 9 |
+
Author-email: Together <dev-feedback@TogetherAI.com>
|
| 10 |
+
License: Apache-2.0
|
| 11 |
+
Classifier: Intended Audience :: Developers
|
| 12 |
+
Classifier: License :: OSI Approved :: Apache Software License
|
| 13 |
+
Classifier: Operating System :: MacOS
|
| 14 |
+
Classifier: Operating System :: Microsoft :: Windows
|
| 15 |
+
Classifier: Operating System :: OS Independent
|
| 16 |
+
Classifier: Operating System :: POSIX
|
| 17 |
+
Classifier: Operating System :: POSIX :: Linux
|
| 18 |
+
Classifier: Programming Language :: Python :: 3.9
|
| 19 |
+
Classifier: Programming Language :: Python :: 3.10
|
| 20 |
+
Classifier: Programming Language :: Python :: 3.11
|
| 21 |
+
Classifier: Programming Language :: Python :: 3.12
|
| 22 |
+
Classifier: Programming Language :: Python :: 3.13
|
| 23 |
+
Classifier: Programming Language :: Python :: 3.14
|
| 24 |
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
| 25 |
+
Classifier: Typing :: Typed
|
| 26 |
+
Requires-Python: >=3.9
|
| 27 |
+
Requires-Dist: anyio<5,>=3.5.0
|
| 28 |
+
Requires-Dist: click>=8.1.7
|
| 29 |
+
Requires-Dist: distro<2,>=1.7.0
|
| 30 |
+
Requires-Dist: filelock>=3.13.1
|
| 31 |
+
Requires-Dist: httpx<1,>=0.23.0
|
| 32 |
+
Requires-Dist: pillow>=10.4.0
|
| 33 |
+
Requires-Dist: pydantic<3,>=1.9.0
|
| 34 |
+
Requires-Dist: rich>=13.7.1
|
| 35 |
+
Requires-Dist: sniffio
|
| 36 |
+
Requires-Dist: tabulate>=0.9.0
|
| 37 |
+
Requires-Dist: tomli>=2.0.0; python_version < '3.11'
|
| 38 |
+
Requires-Dist: tqdm>=4.67.1
|
| 39 |
+
Requires-Dist: types-pyyaml>=6.0.12.20250915
|
| 40 |
+
Requires-Dist: types-tabulate>=0.9.0.20240106
|
| 41 |
+
Requires-Dist: types-tqdm>=4.67.0.20250516
|
| 42 |
+
Requires-Dist: typing-extensions<5,>=4.10
|
| 43 |
+
Provides-Extra: aiofiles
|
| 44 |
+
Requires-Dist: aiofiles>=25.0.0; extra == 'aiofiles'
|
| 45 |
+
Requires-Dist: types-aiofiles; extra == 'aiofiles'
|
| 46 |
+
Provides-Extra: aiohttp
|
| 47 |
+
Requires-Dist: aiohttp; extra == 'aiohttp'
|
| 48 |
+
Requires-Dist: httpx-aiohttp>=0.1.9; extra == 'aiohttp'
|
| 49 |
+
Provides-Extra: cli
|
| 50 |
+
Requires-Dist: pyyaml; extra == 'cli'
|
| 51 |
+
Provides-Extra: pyarrow
|
| 52 |
+
Requires-Dist: pyarrow-stubs>=10.0.1.7; extra == 'pyarrow'
|
| 53 |
+
Requires-Dist: pyarrow>=16.1.0; extra == 'pyarrow'
|
| 54 |
+
Description-Content-Type: text/markdown
|
| 55 |
+
|
| 56 |
+
# Together Python API library
|
| 57 |
+
|
| 58 |
+
<!-- prettier-ignore -->
|
| 59 |
+
[)](https://pypi.org/project/together/)
|
| 60 |
+
|
| 61 |
+
The Together Python library provides convenient access to the Together REST API from any Python 3.9+
|
| 62 |
+
application. The library includes type definitions for all request params and response fields,
|
| 63 |
+
and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx).
|
| 64 |
+
|
| 65 |
+
It is generated with [Stainless](https://www.stainless.com/).
|
| 66 |
+
|
| 67 |
+
## Documentation
|
| 68 |
+
|
| 69 |
+
The REST API documentation can be found on [docs.together.ai](https://docs.together.ai/). The full API of this library can be found in [api.md](https://github.com/togethercomputer/together-py/tree/main/api.md).
|
| 70 |
+
|
| 71 |
+
## Installation
|
| 72 |
+
|
| 73 |
+
```sh
|
| 74 |
+
pip install together
|
| 75 |
+
```
|
| 76 |
+
|
| 77 |
+
```sh
|
| 78 |
+
uv add together
|
| 79 |
+
```
|
| 80 |
+
|
| 81 |
+
## Usage
|
| 82 |
+
|
| 83 |
+
The full API of this library can be found in [api.md](https://github.com/togethercomputer/together-py/tree/main/api.md).
|
| 84 |
+
|
| 85 |
+
```python
|
| 86 |
+
import os
|
| 87 |
+
from together import Together
|
| 88 |
+
|
| 89 |
+
client = Together(
|
| 90 |
+
api_key=os.environ.get("TOGETHER_API_KEY"), # This is the default and can be omitted
|
| 91 |
+
)
|
| 92 |
+
|
| 93 |
+
chat_completion = client.chat.completions.create(
|
| 94 |
+
messages=[
|
| 95 |
+
{
|
| 96 |
+
"role": "user",
|
| 97 |
+
"content": "Say this is a test!",
|
| 98 |
+
}
|
| 99 |
+
],
|
| 100 |
+
model="meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo",
|
| 101 |
+
)
|
| 102 |
+
print(chat_completion.choices)
|
| 103 |
+
```
|
| 104 |
+
|
| 105 |
+
While you can provide an `api_key` keyword argument,
|
| 106 |
+
we recommend using [python-dotenv](https://pypi.org/project/python-dotenv/)
|
| 107 |
+
to add `TOGETHER_API_KEY="My API Key"` to your `.env` file
|
| 108 |
+
so that your API Key is not stored in source control.
|
| 109 |
+
|
| 110 |
+
## Async usage
|
| 111 |
+
|
| 112 |
+
Simply import `AsyncTogether` instead of `Together` and use `await` with each API call:
|
| 113 |
+
|
| 114 |
+
```python
|
| 115 |
+
import os
|
| 116 |
+
import asyncio
|
| 117 |
+
from together import AsyncTogether
|
| 118 |
+
|
| 119 |
+
client = AsyncTogether(
|
| 120 |
+
api_key=os.environ.get("TOGETHER_API_KEY"), # This is the default and can be omitted
|
| 121 |
+
)
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
async def main() -> None:
|
| 125 |
+
chat_completion = await client.chat.completions.create(
|
| 126 |
+
messages=[
|
| 127 |
+
{
|
| 128 |
+
"role": "user",
|
| 129 |
+
"content": "Say this is a test!",
|
| 130 |
+
}
|
| 131 |
+
],
|
| 132 |
+
model="meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo",
|
| 133 |
+
)
|
| 134 |
+
print(chat_completion.choices)
|
| 135 |
+
|
| 136 |
+
|
| 137 |
+
asyncio.run(main())
|
| 138 |
+
```
|
| 139 |
+
|
| 140 |
+
Functionality between the synchronous and asynchronous clients is otherwise identical.
|
| 141 |
+
|
| 142 |
+
### With aiohttp
|
| 143 |
+
|
| 144 |
+
By default, the async client uses `httpx` for HTTP requests. However, for improved concurrency performance you may also use `aiohttp` as the HTTP backend.
|
| 145 |
+
|
| 146 |
+
You can enable this by installing `aiohttp`:
|
| 147 |
+
|
| 148 |
+
```sh
|
| 149 |
+
# install from PyPI
|
| 150 |
+
pip install '--pre together[aiohttp]'
|
| 151 |
+
```
|
| 152 |
+
|
| 153 |
+
Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
|
| 154 |
+
|
| 155 |
+
```python
|
| 156 |
+
import os
|
| 157 |
+
import asyncio
|
| 158 |
+
from together import DefaultAioHttpClient
|
| 159 |
+
from together import AsyncTogether
|
| 160 |
+
|
| 161 |
+
|
| 162 |
+
async def main() -> None:
|
| 163 |
+
async with AsyncTogether(
|
| 164 |
+
api_key=os.environ.get("TOGETHER_API_KEY"), # This is the default and can be omitted
|
| 165 |
+
http_client=DefaultAioHttpClient(),
|
| 166 |
+
) as client:
|
| 167 |
+
chat_completion = await client.chat.completions.create(
|
| 168 |
+
messages=[
|
| 169 |
+
{
|
| 170 |
+
"role": "user",
|
| 171 |
+
"content": "Say this is a test!",
|
| 172 |
+
}
|
| 173 |
+
],
|
| 174 |
+
model="meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo",
|
| 175 |
+
)
|
| 176 |
+
print(chat_completion.choices)
|
| 177 |
+
|
| 178 |
+
|
| 179 |
+
asyncio.run(main())
|
| 180 |
+
```
|
| 181 |
+
|
| 182 |
+
## Streaming responses
|
| 183 |
+
|
| 184 |
+
We provide support for streaming responses using Server Side Events (SSE).
|
| 185 |
+
|
| 186 |
+
```python
|
| 187 |
+
from together import Together
|
| 188 |
+
|
| 189 |
+
client = Together()
|
| 190 |
+
|
| 191 |
+
stream = client.chat.completions.create(
|
| 192 |
+
messages=[
|
| 193 |
+
{
|
| 194 |
+
"role": "user",
|
| 195 |
+
"content": "Say this is a test!",
|
| 196 |
+
}
|
| 197 |
+
],
|
| 198 |
+
model="meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo",
|
| 199 |
+
stream=True,
|
| 200 |
+
)
|
| 201 |
+
for chat_completion in stream:
|
| 202 |
+
print(chat_completion.choices)
|
| 203 |
+
```
|
| 204 |
+
|
| 205 |
+
The async client uses the exact same interface.
|
| 206 |
+
|
| 207 |
+
```python
|
| 208 |
+
from together import AsyncTogether
|
| 209 |
+
|
| 210 |
+
client = AsyncTogether()
|
| 211 |
+
|
| 212 |
+
stream = await client.chat.completions.create(
|
| 213 |
+
messages=[
|
| 214 |
+
{
|
| 215 |
+
"role": "user",
|
| 216 |
+
"content": "Say this is a test!",
|
| 217 |
+
}
|
| 218 |
+
],
|
| 219 |
+
model="meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo",
|
| 220 |
+
stream=True,
|
| 221 |
+
)
|
| 222 |
+
async for chat_completion in stream:
|
| 223 |
+
print(chat_completion.choices)
|
| 224 |
+
```
|
| 225 |
+
|
| 226 |
+
## Using types
|
| 227 |
+
|
| 228 |
+
Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like:
|
| 229 |
+
|
| 230 |
+
- Serializing back into JSON, `model.to_json()`
|
| 231 |
+
- Converting to a dictionary, `model.to_dict()`
|
| 232 |
+
|
| 233 |
+
Typed requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.
|
| 234 |
+
|
| 235 |
+
## Nested params
|
| 236 |
+
|
| 237 |
+
Nested parameters are dictionaries, typed using `TypedDict`, for example:
|
| 238 |
+
|
| 239 |
+
```python
|
| 240 |
+
from together import Together
|
| 241 |
+
|
| 242 |
+
client = Together()
|
| 243 |
+
|
| 244 |
+
chat_completion = client.chat.completions.create(
|
| 245 |
+
messages=[
|
| 246 |
+
{
|
| 247 |
+
"content": "content",
|
| 248 |
+
"role": "system",
|
| 249 |
+
}
|
| 250 |
+
],
|
| 251 |
+
model="meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo",
|
| 252 |
+
reasoning={},
|
| 253 |
+
)
|
| 254 |
+
print(chat_completion.reasoning)
|
| 255 |
+
```
|
| 256 |
+
|
| 257 |
+
The async client uses the exact same interface. If you pass a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance, the file contents will be read asynchronously automatically.
|
| 258 |
+
|
| 259 |
+
## Handling errors
|
| 260 |
+
|
| 261 |
+
When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `together.APIConnectionError` is raised.
|
| 262 |
+
|
| 263 |
+
When the API returns a non-success status code (that is, 4xx or 5xx
|
| 264 |
+
response), a subclass of `together.APIStatusError` is raised, containing `status_code` and `response` properties.
|
| 265 |
+
|
| 266 |
+
All errors inherit from `together.APIError`.
|
| 267 |
+
|
| 268 |
+
```python
|
| 269 |
+
import together
|
| 270 |
+
from together import Together
|
| 271 |
+
|
| 272 |
+
client = Together()
|
| 273 |
+
|
| 274 |
+
try:
|
| 275 |
+
client.chat.completions.create(
|
| 276 |
+
messages=[
|
| 277 |
+
{
|
| 278 |
+
"role": "user",
|
| 279 |
+
"content": "Say this is a test",
|
| 280 |
+
}
|
| 281 |
+
],
|
| 282 |
+
model="meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo",
|
| 283 |
+
)
|
| 284 |
+
except together.APIConnectionError as e:
|
| 285 |
+
print("The server could not be reached")
|
| 286 |
+
print(e.__cause__) # an underlying Exception, likely raised within httpx.
|
| 287 |
+
except together.RateLimitError as e:
|
| 288 |
+
print("A 429 status code was received; we should back off a bit.")
|
| 289 |
+
except together.APIStatusError as e:
|
| 290 |
+
print("Another non-200-range status code was received")
|
| 291 |
+
print(e.status_code)
|
| 292 |
+
print(e.response)
|
| 293 |
+
```
|
| 294 |
+
|
| 295 |
+
Error codes are as follows:
|
| 296 |
+
|
| 297 |
+
| Status Code | Error Type |
|
| 298 |
+
| ----------- | -------------------------- |
|
| 299 |
+
| 400 | `BadRequestError` |
|
| 300 |
+
| 401 | `AuthenticationError` |
|
| 301 |
+
| 403 | `PermissionDeniedError` |
|
| 302 |
+
| 404 | `NotFoundError` |
|
| 303 |
+
| 422 | `UnprocessableEntityError` |
|
| 304 |
+
| 429 | `RateLimitError` |
|
| 305 |
+
| >=500 | `InternalServerError` |
|
| 306 |
+
| N/A | `APIConnectionError` |
|
| 307 |
+
|
| 308 |
+
### Retries
|
| 309 |
+
|
| 310 |
+
Certain errors are automatically retried 2 times by default, with a short exponential backoff.
|
| 311 |
+
Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,
|
| 312 |
+
429 Rate Limit, and >=500 Internal errors are all retried by default.
|
| 313 |
+
|
| 314 |
+
You can use the `max_retries` option to configure or disable retry settings:
|
| 315 |
+
|
| 316 |
+
```python
|
| 317 |
+
from together import Together
|
| 318 |
+
|
| 319 |
+
# Configure the default for all requests:
|
| 320 |
+
client = Together(
|
| 321 |
+
# default is 2
|
| 322 |
+
max_retries=0,
|
| 323 |
+
)
|
| 324 |
+
|
| 325 |
+
# Or, configure per-request:
|
| 326 |
+
client.with_options(max_retries=5).chat.completions.create(
|
| 327 |
+
messages=[
|
| 328 |
+
{
|
| 329 |
+
"role": "user",
|
| 330 |
+
"content": "Say this is a test",
|
| 331 |
+
}
|
| 332 |
+
],
|
| 333 |
+
model="meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo",
|
| 334 |
+
)
|
| 335 |
+
```
|
| 336 |
+
|
| 337 |
+
### Timeouts
|
| 338 |
+
|
| 339 |
+
By default requests time out after 1 minute. You can configure this with a `timeout` option,
|
| 340 |
+
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:
|
| 341 |
+
|
| 342 |
+
```python
|
| 343 |
+
from together import Together
|
| 344 |
+
|
| 345 |
+
# Configure the default for all requests:
|
| 346 |
+
client = Together(
|
| 347 |
+
# 20 seconds (default is 1 minute)
|
| 348 |
+
timeout=20.0,
|
| 349 |
+
)
|
| 350 |
+
|
| 351 |
+
# More granular control:
|
| 352 |
+
client = Together(
|
| 353 |
+
timeout=httpx.Timeout(60.0, read=5.0, write=10.0, connect=2.0),
|
| 354 |
+
)
|
| 355 |
+
|
| 356 |
+
# Override per-request:
|
| 357 |
+
client.with_options(timeout=5.0).chat.completions.create(
|
| 358 |
+
messages=[
|
| 359 |
+
{
|
| 360 |
+
"role": "user",
|
| 361 |
+
"content": "Say this is a test",
|
| 362 |
+
}
|
| 363 |
+
],
|
| 364 |
+
model="meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo",
|
| 365 |
+
)
|
| 366 |
+
```
|
| 367 |
+
|
| 368 |
+
On timeout, an `APITimeoutError` is thrown.
|
| 369 |
+
|
| 370 |
+
Note that requests that time out are [retried twice by default](https://github.com/togethercomputer/together-py/tree/main/#retries).
|
| 371 |
+
|
| 372 |
+
## Advanced
|
| 373 |
+
|
| 374 |
+
### Logging
|
| 375 |
+
|
| 376 |
+
We use the standard library [`logging`](https://docs.python.org/3/library/logging.html) module.
|
| 377 |
+
|
| 378 |
+
You can enable logging by setting the environment variable `TOGETHER_LOG` to `info`.
|
| 379 |
+
|
| 380 |
+
```shell
|
| 381 |
+
$ export TOGETHER_LOG=info
|
| 382 |
+
```
|
| 383 |
+
|
| 384 |
+
Or to `debug` for more verbose logging.
|
| 385 |
+
|
| 386 |
+
### How to tell whether `None` means `null` or missing
|
| 387 |
+
|
| 388 |
+
In an API response, a field may be explicitly `null`, or missing entirely; in either case, its value is `None` in this library. You can differentiate the two cases with `.model_fields_set`:
|
| 389 |
+
|
| 390 |
+
```py
|
| 391 |
+
if response.my_field is None:
|
| 392 |
+
if 'my_field' not in response.model_fields_set:
|
| 393 |
+
print('Got json like {}, without a "my_field" key present at all.')
|
| 394 |
+
else:
|
| 395 |
+
print('Got json like {"my_field": null}.')
|
| 396 |
+
```
|
| 397 |
+
|
| 398 |
+
### Accessing raw response data (e.g. headers)
|
| 399 |
+
|
| 400 |
+
The "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g.,
|
| 401 |
+
|
| 402 |
+
```py
|
| 403 |
+
from together import Together
|
| 404 |
+
|
| 405 |
+
client = Together()
|
| 406 |
+
response = client.chat.completions.with_raw_response.create(
|
| 407 |
+
messages=[{
|
| 408 |
+
"role": "user",
|
| 409 |
+
"content": "Say this is a test",
|
| 410 |
+
}],
|
| 411 |
+
model="meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo",
|
| 412 |
+
)
|
| 413 |
+
print(response.headers.get('X-My-Header'))
|
| 414 |
+
|
| 415 |
+
completion = response.parse() # get the object that `chat.completions.create()` would have returned
|
| 416 |
+
print(completion.choices)
|
| 417 |
+
```
|
| 418 |
+
|
| 419 |
+
These methods return an [`APIResponse`](https://github.com/togethercomputer/together-py/tree/main/src/together/_response.py) object.
|
| 420 |
+
|
| 421 |
+
The async client returns an [`AsyncAPIResponse`](https://github.com/togethercomputer/together-py/tree/main/src/together/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
|
| 422 |
+
|
| 423 |
+
#### `.with_streaming_response`
|
| 424 |
+
|
| 425 |
+
The above interface eagerly reads the full response body when you make the request, which may not always be what you want.
|
| 426 |
+
|
| 427 |
+
To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.
|
| 428 |
+
|
| 429 |
+
```python
|
| 430 |
+
with client.chat.completions.with_streaming_response.create(
|
| 431 |
+
messages=[
|
| 432 |
+
{
|
| 433 |
+
"role": "user",
|
| 434 |
+
"content": "Say this is a test",
|
| 435 |
+
}
|
| 436 |
+
],
|
| 437 |
+
model="meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo",
|
| 438 |
+
) as response:
|
| 439 |
+
print(response.headers.get("X-My-Header"))
|
| 440 |
+
|
| 441 |
+
for line in response.iter_lines():
|
| 442 |
+
print(line)
|
| 443 |
+
```
|
| 444 |
+
|
| 445 |
+
The context manager is required so that the response will reliably be closed.
|
| 446 |
+
|
| 447 |
+
### Making custom/undocumented requests
|
| 448 |
+
|
| 449 |
+
This library is typed for convenient access to the documented API.
|
| 450 |
+
|
| 451 |
+
If you need to access undocumented endpoints, params, or response properties, the library can still be used.
|
| 452 |
+
|
| 453 |
+
#### Undocumented endpoints
|
| 454 |
+
|
| 455 |
+
To make requests to undocumented endpoints, you can make requests using `client.get`, `client.post`, and other
|
| 456 |
+
http verbs. Options on the client will be respected (such as retries) when making this request.
|
| 457 |
+
|
| 458 |
+
```py
|
| 459 |
+
import httpx
|
| 460 |
+
|
| 461 |
+
response = client.post(
|
| 462 |
+
"/foo",
|
| 463 |
+
cast_to=httpx.Response,
|
| 464 |
+
body={"my_param": True},
|
| 465 |
+
)
|
| 466 |
+
|
| 467 |
+
print(response.headers.get("x-foo"))
|
| 468 |
+
```
|
| 469 |
+
|
| 470 |
+
#### Undocumented request params
|
| 471 |
+
|
| 472 |
+
If you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` request
|
| 473 |
+
options.
|
| 474 |
+
|
| 475 |
+
#### Undocumented response properties
|
| 476 |
+
|
| 477 |
+
To access undocumented response properties, you can access the extra fields like `response.unknown_prop`. You
|
| 478 |
+
can also get all the extra fields on the Pydantic model as a dict with
|
| 479 |
+
[`response.model_extra`](https://docs.pydantic.dev/latest/api/base_model/#pydantic.BaseModel.model_extra).
|
| 480 |
+
|
| 481 |
+
### Configuring the HTTP client
|
| 482 |
+
|
| 483 |
+
You can directly override the [httpx client](https://www.python-httpx.org/api/#client) to customize it for your use case, including:
|
| 484 |
+
|
| 485 |
+
- Support for [proxies](https://www.python-httpx.org/advanced/proxies/)
|
| 486 |
+
- Custom [transports](https://www.python-httpx.org/advanced/transports/)
|
| 487 |
+
- Additional [advanced](https://www.python-httpx.org/advanced/clients/) functionality
|
| 488 |
+
|
| 489 |
+
```python
|
| 490 |
+
import httpx
|
| 491 |
+
from together import Together, DefaultHttpxClient
|
| 492 |
+
|
| 493 |
+
client = Together(
|
| 494 |
+
# Or use the `TOGETHER_BASE_URL` env var
|
| 495 |
+
base_url="http://my.test.server.example.com:8083",
|
| 496 |
+
http_client=DefaultHttpxClient(
|
| 497 |
+
proxy="http://my.test.proxy.example.com",
|
| 498 |
+
transport=httpx.HTTPTransport(local_address="0.0.0.0"),
|
| 499 |
+
),
|
| 500 |
+
)
|
| 501 |
+
```
|
| 502 |
+
|
| 503 |
+
You can also customize the client on a per-request basis by using `with_options()`:
|
| 504 |
+
|
| 505 |
+
```python
|
| 506 |
+
client.with_options(http_client=DefaultHttpxClient(...))
|
| 507 |
+
```
|
| 508 |
+
|
| 509 |
+
### Managing HTTP resources
|
| 510 |
+
|
| 511 |
+
By default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting.
|
| 512 |
+
|
| 513 |
+
```py
|
| 514 |
+
from together import Together
|
| 515 |
+
|
| 516 |
+
with Together() as client:
|
| 517 |
+
# make requests here
|
| 518 |
+
...
|
| 519 |
+
|
| 520 |
+
# HTTP client is now closed
|
| 521 |
+
```
|
| 522 |
+
|
| 523 |
+
## Usage – CLI
|
| 524 |
+
|
| 525 |
+
### Files
|
| 526 |
+
|
| 527 |
+
```bash
|
| 528 |
+
# Help
|
| 529 |
+
together files --help
|
| 530 |
+
|
| 531 |
+
# Check file
|
| 532 |
+
together files check example.jsonl
|
| 533 |
+
|
| 534 |
+
# Upload file
|
| 535 |
+
together files upload example.jsonl
|
| 536 |
+
|
| 537 |
+
# List files
|
| 538 |
+
together files list
|
| 539 |
+
|
| 540 |
+
# Retrieve file metadata
|
| 541 |
+
together files retrieve file-6f50f9d1-5b95-416c-9040-0799b2b4b894
|
| 542 |
+
|
| 543 |
+
# Retrieve file content
|
| 544 |
+
together files retrieve-content file-6f50f9d1-5b95-416c-9040-0799b2b4b894
|
| 545 |
+
|
| 546 |
+
# Delete remote file
|
| 547 |
+
together files delete file-6f50f9d1-5b95-416c-9040-0799b2b4b894
|
| 548 |
+
```
|
| 549 |
+
|
| 550 |
+
### Fine-tuning
|
| 551 |
+
|
| 552 |
+
```bash
|
| 553 |
+
# Help
|
| 554 |
+
together fine-tuning --help
|
| 555 |
+
|
| 556 |
+
# Create fine-tune job
|
| 557 |
+
together fine-tuning create \
|
| 558 |
+
--model togethercomputer/llama-2-7b-chat \
|
| 559 |
+
--training-file file-711d8724-b3e3-4ae2-b516-94841958117d
|
| 560 |
+
|
| 561 |
+
# List fine-tune jobs
|
| 562 |
+
together fine-tuning list
|
| 563 |
+
|
| 564 |
+
# Retrieve fine-tune job details
|
| 565 |
+
together fine-tuning retrieve ft-c66a5c18-1d6d-43c9-94bd-32d756425b4b
|
| 566 |
+
|
| 567 |
+
# List fine-tune job events
|
| 568 |
+
together fine-tuning list-events ft-c66a5c18-1d6d-43c9-94bd-32d756425b4b
|
| 569 |
+
|
| 570 |
+
# Cancel running job
|
| 571 |
+
together fine-tuning cancel ft-c66a5c18-1d6d-43c9-94bd-32d756425b4b
|
| 572 |
+
|
| 573 |
+
# Download fine-tuned model weights
|
| 574 |
+
together fine-tuning download ft-c66a5c18-1d6d-43c9-94bd-32d756425b4b
|
| 575 |
+
```
|
| 576 |
+
|
| 577 |
+
### Models
|
| 578 |
+
|
| 579 |
+
```bash
|
| 580 |
+
# Help
|
| 581 |
+
together models --help
|
| 582 |
+
|
| 583 |
+
# List models
|
| 584 |
+
together models list
|
| 585 |
+
```
|
| 586 |
+
|
| 587 |
+
## Versioning
|
| 588 |
+
|
| 589 |
+
This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:
|
| 590 |
+
|
| 591 |
+
1. Changes that only affect static types, without breaking runtime behavior.
|
| 592 |
+
2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_
|
| 593 |
+
3. Changes that we do not expect to impact the vast majority of users in practice.
|
| 594 |
+
|
| 595 |
+
We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
|
| 596 |
+
|
| 597 |
+
We are keen for your feedback; please open an [issue](https://www.github.com/togethercomputer/together-py/issues) with questions, bugs, or suggestions.
|
| 598 |
+
|
| 599 |
+
### Determining the installed version
|
| 600 |
+
|
| 601 |
+
If you've upgraded to the latest version but aren't seeing any new features you were expecting then your python environment is likely still using an older version.
|
| 602 |
+
|
| 603 |
+
You can determine the version that is being used at runtime with:
|
| 604 |
+
|
| 605 |
+
```py
|
| 606 |
+
import together
|
| 607 |
+
print(together.__version__)
|
| 608 |
+
```
|
| 609 |
+
|
| 610 |
+
## Requirements
|
| 611 |
+
|
| 612 |
+
Python 3.9 or higher.
|
| 613 |
+
|
| 614 |
+
## Usage – CLI
|
| 615 |
+
|
| 616 |
+
### Files
|
| 617 |
+
|
| 618 |
+
```bash
|
| 619 |
+
# Help
|
| 620 |
+
together files --help
|
| 621 |
+
|
| 622 |
+
# Check file
|
| 623 |
+
together files check example.jsonl
|
| 624 |
+
|
| 625 |
+
# Upload file
|
| 626 |
+
together files upload example.jsonl
|
| 627 |
+
|
| 628 |
+
# List files
|
| 629 |
+
together files list
|
| 630 |
+
|
| 631 |
+
# Retrieve file metadata
|
| 632 |
+
together files retrieve file-6f50f9d1-5b95-416c-9040-0799b2b4b894
|
| 633 |
+
|
| 634 |
+
# Retrieve file content
|
| 635 |
+
together files retrieve-content file-6f50f9d1-5b95-416c-9040-0799b2b4b894
|
| 636 |
+
|
| 637 |
+
# Delete remote file
|
| 638 |
+
together files delete file-6f50f9d1-5b95-416c-9040-0799b2b4b894
|
| 639 |
+
```
|
| 640 |
+
|
| 641 |
+
### Fine-tuning
|
| 642 |
+
|
| 643 |
+
```bash
|
| 644 |
+
# Help
|
| 645 |
+
together fine-tuning --help
|
| 646 |
+
|
| 647 |
+
# Create fine-tune job
|
| 648 |
+
together fine-tuning create \
|
| 649 |
+
--model togethercomputer/llama-2-7b-chat \
|
| 650 |
+
--training-file file-711d8724-b3e3-4ae2-b516-94841958117d
|
| 651 |
+
|
| 652 |
+
# List fine-tune jobs
|
| 653 |
+
together fine-tuning list
|
| 654 |
+
|
| 655 |
+
# Retrieve fine-tune job details
|
| 656 |
+
together fine-tuning retrieve ft-c66a5c18-1d6d-43c9-94bd-32d756425b4b
|
| 657 |
+
|
| 658 |
+
# List fine-tune job events
|
| 659 |
+
together fine-tuning list-events ft-c66a5c18-1d6d-43c9-94bd-32d756425b4b
|
| 660 |
+
|
| 661 |
+
# List fine-tune checkpoints
|
| 662 |
+
together fine-tuning list-checkpoints ft-c66a5c18-1d6d-43c9-94bd-32d756425b4b
|
| 663 |
+
|
| 664 |
+
# Cancel running job
|
| 665 |
+
together fine-tuning cancel ft-c66a5c18-1d6d-43c9-94bd-32d756425b4b
|
| 666 |
+
|
| 667 |
+
# Download fine-tuned model weights
|
| 668 |
+
together fine-tuning download ft-c66a5c18-1d6d-43c9-94bd-32d756425b4b
|
| 669 |
+
|
| 670 |
+
# Delete fine-tuned model weights
|
| 671 |
+
together fine-tuning delete ft-c66a5c18-1d6d-43c9-94bd-32d756425b4b
|
| 672 |
+
```
|
| 673 |
+
|
| 674 |
+
### Models
|
| 675 |
+
|
| 676 |
+
```bash
|
| 677 |
+
# Help
|
| 678 |
+
together models --help
|
| 679 |
+
|
| 680 |
+
# List models
|
| 681 |
+
together models list
|
| 682 |
+
|
| 683 |
+
# Upload a model
|
| 684 |
+
together models upload --model-name my-org/my-model --model-source s3-or-hugging-face
|
| 685 |
+
```
|
| 686 |
+
|
| 687 |
+
### Clusters
|
| 688 |
+
|
| 689 |
+
```bash
|
| 690 |
+
# Help
|
| 691 |
+
together beta clusters --help
|
| 692 |
+
|
| 693 |
+
# Create a cluster
|
| 694 |
+
together beta clusters create
|
| 695 |
+
|
| 696 |
+
# List clusters
|
| 697 |
+
together beta clusters list
|
| 698 |
+
|
| 699 |
+
# Retrieve cluster details
|
| 700 |
+
together beta clusters retrieve [cluster-id]
|
| 701 |
+
|
| 702 |
+
# Update a cluster
|
| 703 |
+
together beta clusters update [cluster-id]
|
| 704 |
+
|
| 705 |
+
# Retrieve Together cluster configuration options such as regions, gpu types and drivers available
|
| 706 |
+
together beta clusters list-regions
|
| 707 |
+
```
|
| 708 |
+
|
| 709 |
+
##### Cluster Storage
|
| 710 |
+
|
| 711 |
+
```bash
|
| 712 |
+
# Help
|
| 713 |
+
together beta clusters storage --help
|
| 714 |
+
|
| 715 |
+
# Create cluster storage volume
|
| 716 |
+
together beta clusters storage create
|
| 717 |
+
|
| 718 |
+
# List storage volumes
|
| 719 |
+
together beta clusters storage list
|
| 720 |
+
|
| 721 |
+
# Retrieve storage volume
|
| 722 |
+
together beta clusters storage retrieve [storage-id]
|
| 723 |
+
|
| 724 |
+
# Delete storage volume
|
| 725 |
+
together beta clusters storage delete [storage-id]
|
| 726 |
+
```
|
| 727 |
+
|
| 728 |
+
### Jig (Container Deployments)
|
| 729 |
+
|
| 730 |
+
```bash
|
| 731 |
+
# Help
|
| 732 |
+
together beta jig --help
|
| 733 |
+
|
| 734 |
+
# Initialize jig configuration (creates pyproject.toml)
|
| 735 |
+
together beta jig init
|
| 736 |
+
|
| 737 |
+
# Generate Dockerfile from config
|
| 738 |
+
together beta jig dockerfile
|
| 739 |
+
|
| 740 |
+
# Build container image
|
| 741 |
+
together beta jig build
|
| 742 |
+
together beta jig build --tag v1.0 --warmup
|
| 743 |
+
|
| 744 |
+
# Push image to registry
|
| 745 |
+
together beta jig push
|
| 746 |
+
together beta jig push --tag v1.0
|
| 747 |
+
|
| 748 |
+
# Deploy model (builds, pushes, and deploys)
|
| 749 |
+
together beta jig deploy
|
| 750 |
+
together beta jig deploy --build-only
|
| 751 |
+
together beta jig deploy --image existing-image:tag
|
| 752 |
+
|
| 753 |
+
# Get deployment status
|
| 754 |
+
together beta jig status
|
| 755 |
+
|
| 756 |
+
# Get deployment endpoint URL
|
| 757 |
+
together beta jig endpoint
|
| 758 |
+
|
| 759 |
+
# View deployment logs
|
| 760 |
+
together beta jig logs
|
| 761 |
+
together beta jig logs --follow
|
| 762 |
+
|
| 763 |
+
# Destroy deployment
|
| 764 |
+
together beta jig destroy
|
| 765 |
+
|
| 766 |
+
# Get queue metrics
|
| 767 |
+
together beta jig queue-status
|
| 768 |
+
|
| 769 |
+
# List all deployments
|
| 770 |
+
together beta jig list
|
| 771 |
+
```
|
| 772 |
+
|
| 773 |
+
##### Jig Secrets
|
| 774 |
+
|
| 775 |
+
```bash
|
| 776 |
+
# Help
|
| 777 |
+
together beta jig secrets --help
|
| 778 |
+
|
| 779 |
+
# Set a secret (creates or updates)
|
| 780 |
+
together beta jig secrets set --name MY_SECRET --value "secret-value"
|
| 781 |
+
|
| 782 |
+
# Remove a secret from local state
|
| 783 |
+
together beta jig secrets unset --name MY_SECRET
|
| 784 |
+
|
| 785 |
+
# List all secrets with sync status
|
| 786 |
+
together beta jig secrets list
|
| 787 |
+
```
|
| 788 |
+
|
| 789 |
+
##### Jig Volumes
|
| 790 |
+
|
| 791 |
+
```bash
|
| 792 |
+
# Help
|
| 793 |
+
together beta jig volumes --help
|
| 794 |
+
|
| 795 |
+
# Create a volume and upload files from directory
|
| 796 |
+
together beta jig volumes create --name my-volume --source ./data
|
| 797 |
+
|
| 798 |
+
# Update a volume with new files
|
| 799 |
+
together beta jig volumes update --name my-volume --source ./data
|
| 800 |
+
|
| 801 |
+
# Set volume mount path for deployment
|
| 802 |
+
together beta jig volumes set --name my-volume --mount-path /app/data
|
| 803 |
+
|
| 804 |
+
# Remove volume from deployment config (does not delete remote volume)
|
| 805 |
+
together beta jig volumes unset --name my-volume
|
| 806 |
+
|
| 807 |
+
# Delete a volume
|
| 808 |
+
together beta jig volumes delete --name my-volume
|
| 809 |
+
|
| 810 |
+
# Describe a volume
|
| 811 |
+
together beta jig volumes describe --name my-volume
|
| 812 |
+
|
| 813 |
+
# List all volumes
|
| 814 |
+
together beta jig volumes list
|
| 815 |
+
```
|
| 816 |
+
|
| 817 |
+
## Contributing
|
| 818 |
+
|
| 819 |
+
See [the contributing documentation](https://github.com/togethercomputer/together-py/tree/main/./CONTRIBUTING.md).
|
.cache/pip/http-v2/c/9/4/0/b/c940b2250e62326f26b47c7a80ee830db74434095fb11c383a444ac9
ADDED
|
Binary file (1.2 kB). View file
|
|
|
.cache/pip/http-v2/c/9/a/6/c/c9a6cf900bd08e59c5c1f2ac1e9a3c7d81a890e4ebba0a7410e78b89
ADDED
|
Binary file (1.18 kB). View file
|
|
|
.cache/pip/http-v2/c/9/a/6/c/c9a6cf900bd08e59c5c1f2ac1e9a3c7d81a890e4ebba0a7410e78b89.body
ADDED
|
@@ -0,0 +1,446 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.4
|
| 2 |
+
Name: scikit_build_core
|
| 3 |
+
Version: 0.11.6
|
| 4 |
+
Summary: Build backend for CMake based projects
|
| 5 |
+
Project-URL: Changelog, https://scikit-build-core.readthedocs.io/en/latest/changelog.html
|
| 6 |
+
Project-URL: Discussions, https://github.com/orgs/scikit-build/discussions
|
| 7 |
+
Project-URL: Documentation, https://scikit-build-core.readthedocs.io
|
| 8 |
+
Project-URL: Homepage, https://github.com/scikit-build/scikit-build-core
|
| 9 |
+
Project-URL: Issues, https://github.com/scikit-build/scikit-build-core/issues
|
| 10 |
+
Author-email: Henry Schreiner <henryfs@princeton.edu>
|
| 11 |
+
License-File: LICENSE
|
| 12 |
+
Classifier: Development Status :: 4 - Beta
|
| 13 |
+
Classifier: Intended Audience :: Developers
|
| 14 |
+
Classifier: Intended Audience :: Science/Research
|
| 15 |
+
Classifier: License :: OSI Approved :: Apache Software License
|
| 16 |
+
Classifier: Operating System :: OS Independent
|
| 17 |
+
Classifier: Programming Language :: Python
|
| 18 |
+
Classifier: Programming Language :: Python :: 3
|
| 19 |
+
Classifier: Programming Language :: Python :: 3 :: Only
|
| 20 |
+
Classifier: Programming Language :: Python :: 3.8
|
| 21 |
+
Classifier: Programming Language :: Python :: 3.9
|
| 22 |
+
Classifier: Programming Language :: Python :: 3.10
|
| 23 |
+
Classifier: Programming Language :: Python :: 3.11
|
| 24 |
+
Classifier: Programming Language :: Python :: 3.12
|
| 25 |
+
Classifier: Programming Language :: Python :: 3.13
|
| 26 |
+
Classifier: Programming Language :: Python :: 3.14
|
| 27 |
+
Classifier: Topic :: Scientific/Engineering
|
| 28 |
+
Classifier: Topic :: Software Development :: Build Tools
|
| 29 |
+
Classifier: Typing :: Typed
|
| 30 |
+
Requires-Python: >=3.8
|
| 31 |
+
Requires-Dist: exceptiongroup>=1.0; python_version < '3.11'
|
| 32 |
+
Requires-Dist: importlib-resources>=1.3; python_version < '3.9'
|
| 33 |
+
Requires-Dist: packaging>=23.2
|
| 34 |
+
Requires-Dist: pathspec>=0.10.1
|
| 35 |
+
Requires-Dist: tomli>=1.2.2; python_version < '3.11'
|
| 36 |
+
Requires-Dist: typing-extensions>=3.10.0; python_version < '3.9'
|
| 37 |
+
Provides-Extra: cov
|
| 38 |
+
Requires-Dist: pytest-cov; extra == 'cov'
|
| 39 |
+
Provides-Extra: dev
|
| 40 |
+
Requires-Dist: rich; extra == 'dev'
|
| 41 |
+
Provides-Extra: docs
|
| 42 |
+
Requires-Dist: furo; extra == 'docs'
|
| 43 |
+
Requires-Dist: hatchling; extra == 'docs'
|
| 44 |
+
Requires-Dist: myst-parser>=0.13; extra == 'docs'
|
| 45 |
+
Requires-Dist: setuptools; extra == 'docs'
|
| 46 |
+
Requires-Dist: sphinx-autodoc-typehints; extra == 'docs'
|
| 47 |
+
Requires-Dist: sphinx-copybutton; extra == 'docs'
|
| 48 |
+
Requires-Dist: sphinx-inline-tabs; extra == 'docs'
|
| 49 |
+
Requires-Dist: sphinx-jsonschema; extra == 'docs'
|
| 50 |
+
Requires-Dist: sphinx-tippy; extra == 'docs'
|
| 51 |
+
Requires-Dist: sphinx>=7.0; extra == 'docs'
|
| 52 |
+
Requires-Dist: sphinxcontrib-programoutput; extra == 'docs'
|
| 53 |
+
Provides-Extra: pyproject
|
| 54 |
+
Provides-Extra: test
|
| 55 |
+
Requires-Dist: build>=0.8; extra == 'test'
|
| 56 |
+
Requires-Dist: cattrs>=22.2.0; extra == 'test'
|
| 57 |
+
Requires-Dist: pip>=23; (python_version < '3.13') and extra == 'test'
|
| 58 |
+
Requires-Dist: pip>=24.1; (python_version >= '3.13') and extra == 'test'
|
| 59 |
+
Requires-Dist: pybind11>=2.11; extra == 'test'
|
| 60 |
+
Requires-Dist: pytest-subprocess>=1.5; extra == 'test'
|
| 61 |
+
Requires-Dist: pytest-xdist>=3.1; extra == 'test'
|
| 62 |
+
Requires-Dist: pytest>=7.2; extra == 'test'
|
| 63 |
+
Requires-Dist: setuptools>=43; (python_version < '3.9') and extra == 'test'
|
| 64 |
+
Requires-Dist: setuptools>=45; (python_version == '3.9') and extra == 'test'
|
| 65 |
+
Requires-Dist: setuptools>=49; (python_version >= '3.10' and python_version < '3.12') and extra == 'test'
|
| 66 |
+
Requires-Dist: setuptools>=66.1; (python_version >= '3.12') and extra == 'test'
|
| 67 |
+
Requires-Dist: virtualenv>=20.20; extra == 'test'
|
| 68 |
+
Requires-Dist: wheel>=0.40; extra == 'test'
|
| 69 |
+
Provides-Extra: test-hatchling
|
| 70 |
+
Requires-Dist: hatchling>=1.24.0; extra == 'test-hatchling'
|
| 71 |
+
Provides-Extra: test-meta
|
| 72 |
+
Requires-Dist: hatch-fancy-pypi-readme>=22.3; extra == 'test-meta'
|
| 73 |
+
Requires-Dist: setuptools-scm; extra == 'test-meta'
|
| 74 |
+
Provides-Extra: test-numpy
|
| 75 |
+
Requires-Dist: numpy; (python_version < '3.14' and platform_python_implementation != 'PyPy' and (platform_system != 'Windows' or platform_machine != 'ARM64')) and extra == 'test-numpy'
|
| 76 |
+
Requires-Dist: numpy~=1.24.0; (python_version == '3.8' and platform_python_implementation == 'PyPy') and extra == 'test-numpy'
|
| 77 |
+
Requires-Dist: numpy~=2.0.0; (python_version == '3.9' and platform_python_implementation == 'PyPy') and extra == 'test-numpy'
|
| 78 |
+
Requires-Dist: numpy~=2.2.0; (python_version == '3.10' and platform_python_implementation == 'PyPy') and extra == 'test-numpy'
|
| 79 |
+
Provides-Extra: test-schema
|
| 80 |
+
Requires-Dist: fastjsonschema; extra == 'test-schema'
|
| 81 |
+
Requires-Dist: validate-pyproject; extra == 'test-schema'
|
| 82 |
+
Provides-Extra: wheel-free-setuptools
|
| 83 |
+
Requires-Dist: setuptools>=70.1; (python_version >= '3.8') and extra == 'wheel-free-setuptools'
|
| 84 |
+
Provides-Extra: wheels
|
| 85 |
+
Requires-Dist: cmake; extra == 'wheels'
|
| 86 |
+
Requires-Dist: ninja; (sys_platform != 'win32') and extra == 'wheels'
|
| 87 |
+
Description-Content-Type: text/markdown
|
| 88 |
+
|
| 89 |
+
# scikit-build-core
|
| 90 |
+
|
| 91 |
+
[![Documentation Status][rtd-badge]][rtd-link]
|
| 92 |
+
[![GitHub Discussion][github-discussions-badge]][github-discussions-link]
|
| 93 |
+
[![Discord][discord-badge]][discord-link]
|
| 94 |
+
|
| 95 |
+
[![Actions Status][actions-badge]][actions-link]
|
| 96 |
+
[![codecov][codecov-badge]][codecov-link]
|
| 97 |
+
|
| 98 |
+
[![PyPI version][pypi-version]][pypi-link]
|
| 99 |
+
[![Conda-Forge][conda-badge]][conda-link]
|
| 100 |
+
[![PyPI platforms][pypi-platforms]][pypi-link]
|
| 101 |
+
[![Downloads][download-badge]][download-link]
|
| 102 |
+
|
| 103 |
+
> [!NOTE]
|
| 104 |
+
>
|
| 105 |
+
> We have a public Scikit-build community meeting every month!
|
| 106 |
+
> [Join us on Google Meet](https://meet.google.com/hzu-znrd-uef) on the third
|
| 107 |
+
> Friday of every month at 12:00 PM EST. We also have a developer's meeting on
|
| 108 |
+
> the first Friday of every month at the same time. Our past meeting minutes are
|
| 109 |
+
> [available here](https://github.com/orgs/scikit-build/discussions/categories/community-meeting-notes).
|
| 110 |
+
|
| 111 |
+
<!-- SPHINX-START -->
|
| 112 |
+
|
| 113 |
+
Scikit-build-core is a build backend for Python that uses CMake to build
|
| 114 |
+
extension modules. It has a simple yet powerful static configuration system in
|
| 115 |
+
pyproject.toml, and supports almost unlimited flexibility via CMake. It was
|
| 116 |
+
initially developed to support the demanding needs of scientific users, but can
|
| 117 |
+
build any sort of package that uses CMake.
|
| 118 |
+
|
| 119 |
+
Scikit-build-core is a ground-up rewrite of the classic Scikit-build. The key
|
| 120 |
+
features of scikit-build classic (which is setuptools based) are also present
|
| 121 |
+
here:
|
| 122 |
+
|
| 123 |
+
- Great support for or by most OSs, compilers, IDEs, and libraries
|
| 124 |
+
- Support for C++ features and other languages like Fortran
|
| 125 |
+
- Support for multithreaded builds
|
| 126 |
+
- Simple CMakeLists.txt files instead of up to thousands of lines of fragile
|
| 127 |
+
setuptools/distutils code
|
| 128 |
+
- Cross-compile support for Apple Silicon and Windows ARM
|
| 129 |
+
|
| 130 |
+
Scikit-build-core was built using Python packaging standards developed after
|
| 131 |
+
scikit-build (classic) was written. Using it directly provides the following
|
| 132 |
+
features over classic Scikit-build:
|
| 133 |
+
|
| 134 |
+
- Better warnings, errors, and logging
|
| 135 |
+
- No warning about unused variables
|
| 136 |
+
- Automatically adds Ninja and/or CMake only as required
|
| 137 |
+
- No dependency on setuptools, distutils, or wheel
|
| 138 |
+
- Powerful config system, including config options support
|
| 139 |
+
- Automatic inclusion of site-packages in `CMAKE_PREFIX_PATH`
|
| 140 |
+
- FindPython is backported if running on CMake < 3.26.1 (configurable), supports
|
| 141 |
+
PyPY SOABI & Limited API / Stable ABI
|
| 142 |
+
- Limited API / Stable ABI and pythonless tags supported via config option
|
| 143 |
+
- No slow generator search, ninja/make or MSVC used by default, respects
|
| 144 |
+
`CMAKE_GENERATOR`
|
| 145 |
+
- SDists are reproducible by default (UNIX, Python 3.9+, uncompressed comparison
|
| 146 |
+
recommended)
|
| 147 |
+
- Support for caching between builds (opt-in by setting `build-dir`)
|
| 148 |
+
- Support for writing out to extra wheel folders (scripts, headers, data)
|
| 149 |
+
- Support for selecting install components and build targets
|
| 150 |
+
- Dedicated entrypoints for module and prefix directories
|
| 151 |
+
- Several integrated dynamic metadata plugins (proposing standardized support
|
| 152 |
+
soon)
|
| 153 |
+
- Experimental editable mode support, with optional experimental auto rebuilds
|
| 154 |
+
on import and optional in-place mode
|
| 155 |
+
- Supports WebAssembly (Emscripten/[Pyodide](https://pyodide.org)).
|
| 156 |
+
- Supports [free-threaded Python 3.13](https://py-free-threading.github.io).
|
| 157 |
+
|
| 158 |
+
The following limitations are present compared to classic scikit-build:
|
| 159 |
+
|
| 160 |
+
- The minimum supported CMake is 3.15
|
| 161 |
+
- The minimum supported Python is 3.8 (3.7+ for 0.10.x and older)
|
| 162 |
+
|
| 163 |
+
Some known missing features that will be developed soon:
|
| 164 |
+
|
| 165 |
+
- Wheels are not fully reproducible yet (nor are they in most others systems,
|
| 166 |
+
including setuptools)
|
| 167 |
+
- Several editable mode caveats (mentioned in the docs).
|
| 168 |
+
|
| 169 |
+
Other backends are also planned:
|
| 170 |
+
|
| 171 |
+
- Setuptools integration highly experimental
|
| 172 |
+
- Hatchling plugin highly experimental
|
| 173 |
+
|
| 174 |
+
The recommended interface is the native pyproject builder. There is also a WIP
|
| 175 |
+
setuptools-based interface that is being developed to provide a transition path
|
| 176 |
+
for classic scikit-build, and a WIP Hatchling plugin. Both might be moved to
|
| 177 |
+
standalone packages in the future.
|
| 178 |
+
|
| 179 |
+
> [!WARNING]
|
| 180 |
+
>
|
| 181 |
+
> Only the pyproject-based builder should be used; the setuptools backend is
|
| 182 |
+
> experimental and likely to move to a separate package before being declared
|
| 183 |
+
> stable, and internal API is still being solidified. A future version of this
|
| 184 |
+
> package will support creating new build extensions.
|
| 185 |
+
|
| 186 |
+
## Example
|
| 187 |
+
|
| 188 |
+
To use scikit-build-core, add it to your `build-system.requires`, and specify
|
| 189 |
+
the `scikit_build_core.build` builder as your `build-system.build-backend`. You
|
| 190 |
+
do _not_ need to specify `cmake` or `ninja`; scikit-build-core will require them
|
| 191 |
+
automatically if the system versions are not sufficient.
|
| 192 |
+
|
| 193 |
+
```toml
|
| 194 |
+
[build-system]
|
| 195 |
+
requires = ["scikit-build-core"]
|
| 196 |
+
build-backend = "scikit_build_core.build"
|
| 197 |
+
|
| 198 |
+
[project]
|
| 199 |
+
name = "scikit_build_simplest"
|
| 200 |
+
version = "0.0.1"
|
| 201 |
+
```
|
| 202 |
+
|
| 203 |
+
You can (and should) specify the rest of the entries in `project`, but these are
|
| 204 |
+
the minimum to get started.
|
| 205 |
+
|
| 206 |
+
An example `CMakeLists.txt`:
|
| 207 |
+
|
| 208 |
+
```cmake
|
| 209 |
+
cmake_minimum_required(VERSION 3.15...3.30)
|
| 210 |
+
project(${SKBUILD_PROJECT_NAME} LANGUAGES C)
|
| 211 |
+
|
| 212 |
+
find_package(Python COMPONENTS Interpreter Development.Module REQUIRED)
|
| 213 |
+
|
| 214 |
+
Python_add_library(_module MODULE src/module.c WITH_SOABI)
|
| 215 |
+
install(TARGETS _module DESTINATION ${SKBUILD_PROJECT_NAME})
|
| 216 |
+
```
|
| 217 |
+
|
| 218 |
+
Scikit-build-core will backport FindPython from CMake 3.26.1 to older versions
|
| 219 |
+
of Python, and will handle PyPy for you if you are building from PyPy. You will
|
| 220 |
+
need to install everything you want into the full final path inside site-modules
|
| 221 |
+
(so you will usually prefix everything by the package name).
|
| 222 |
+
|
| 223 |
+
More examples are in the
|
| 224 |
+
[tests/packages](https://github.com/scikit-build/scikit-build-core/tree/main/tests/packages).
|
| 225 |
+
|
| 226 |
+
## Configuration
|
| 227 |
+
|
| 228 |
+
All configuration options can be placed in `pyproject.toml`, passed via
|
| 229 |
+
`-C`/`--config-setting` in build or `-C`/`--config-settings` in `pip` , or set
|
| 230 |
+
as environment variables. `tool.scikit-build` is used in toml, `skbuild.` for
|
| 231 |
+
`-C` options, or `SKBUILD_*` for environment variables.
|
| 232 |
+
|
| 233 |
+
For a full reference and explanation of the variables see the [online
|
| 234 |
+
documentation][conf-ref]
|
| 235 |
+
|
| 236 |
+
A quick summary and some defaults are listed below:
|
| 237 |
+
|
| 238 |
+
<!-- [[[cog
|
| 239 |
+
from scikit_build_core.settings.skbuild_docs_readme import mk_skbuild_docs
|
| 240 |
+
|
| 241 |
+
print("\n```toml\n[tool.scikit-build]")
|
| 242 |
+
print(mk_skbuild_docs())
|
| 243 |
+
print("```\n")
|
| 244 |
+
]]] -->
|
| 245 |
+
|
| 246 |
+
```toml
|
| 247 |
+
[tool.scikit-build]
|
| 248 |
+
# The versions of CMake to allow as a python-compatible specifier.
|
| 249 |
+
cmake.version = ""
|
| 250 |
+
|
| 251 |
+
# A list of args to pass to CMake when configuring the project.
|
| 252 |
+
cmake.args = []
|
| 253 |
+
|
| 254 |
+
# A table of defines to pass to CMake when configuring the project. Additive.
|
| 255 |
+
cmake.define = {}
|
| 256 |
+
|
| 257 |
+
# The build type to use when building the project.
|
| 258 |
+
cmake.build-type = "Release"
|
| 259 |
+
|
| 260 |
+
# The source directory to use when building the project.
|
| 261 |
+
cmake.source-dir = "."
|
| 262 |
+
|
| 263 |
+
# The versions of Ninja to allow.
|
| 264 |
+
ninja.version = ">=1.5"
|
| 265 |
+
|
| 266 |
+
# Use Make as a fallback if a suitable Ninja executable is not found.
|
| 267 |
+
ninja.make-fallback = true
|
| 268 |
+
|
| 269 |
+
# The logging level to display.
|
| 270 |
+
logging.level = "WARNING"
|
| 271 |
+
|
| 272 |
+
# Files to include in the SDist even if they are skipped by default. Supports gitignore syntax.
|
| 273 |
+
sdist.include = []
|
| 274 |
+
|
| 275 |
+
# Files to exclude from the SDist even if they are included by default. Supports gitignore syntax.
|
| 276 |
+
sdist.exclude = []
|
| 277 |
+
|
| 278 |
+
# Try to build a reproducible distribution.
|
| 279 |
+
sdist.reproducible = true
|
| 280 |
+
|
| 281 |
+
# If set to True, CMake will be run before building the SDist.
|
| 282 |
+
sdist.cmake = false
|
| 283 |
+
|
| 284 |
+
# A list of packages to auto-copy into the wheel.
|
| 285 |
+
wheel.packages = ["src/<package>", "python/<package>", "<package>"]
|
| 286 |
+
|
| 287 |
+
# The Python version tag used in the wheel file.
|
| 288 |
+
wheel.py-api = ""
|
| 289 |
+
|
| 290 |
+
# Fill out extra tags that are not required.
|
| 291 |
+
wheel.expand-macos-universal-tags = false
|
| 292 |
+
|
| 293 |
+
# The CMake install prefix relative to the platlib wheel path.
|
| 294 |
+
wheel.install-dir = ""
|
| 295 |
+
|
| 296 |
+
# A list of license files to include in the wheel. Supports glob patterns.
|
| 297 |
+
wheel.license-files = ""
|
| 298 |
+
|
| 299 |
+
# Run CMake as part of building the wheel.
|
| 300 |
+
wheel.cmake = true
|
| 301 |
+
|
| 302 |
+
# Target the platlib or the purelib.
|
| 303 |
+
wheel.platlib = ""
|
| 304 |
+
|
| 305 |
+
# A set of patterns to exclude from the wheel.
|
| 306 |
+
wheel.exclude = []
|
| 307 |
+
|
| 308 |
+
# The build tag to use for the wheel. If empty, no build tag is used.
|
| 309 |
+
wheel.build-tag = ""
|
| 310 |
+
|
| 311 |
+
# If CMake is less than this value, backport a copy of FindPython.
|
| 312 |
+
backport.find-python = "3.26.1"
|
| 313 |
+
|
| 314 |
+
# Select the editable mode to use. Can be "redirect" (default) or "inplace".
|
| 315 |
+
editable.mode = "redirect"
|
| 316 |
+
|
| 317 |
+
# Turn on verbose output for the editable mode rebuilds.
|
| 318 |
+
editable.verbose = true
|
| 319 |
+
|
| 320 |
+
# Rebuild the project when the package is imported.
|
| 321 |
+
editable.rebuild = false
|
| 322 |
+
|
| 323 |
+
# Extra args to pass directly to the builder in the build step.
|
| 324 |
+
build.tool-args = []
|
| 325 |
+
|
| 326 |
+
# The build targets to use when building the project.
|
| 327 |
+
build.targets = []
|
| 328 |
+
|
| 329 |
+
# Verbose printout when building.
|
| 330 |
+
build.verbose = false
|
| 331 |
+
|
| 332 |
+
# Additional ``build-system.requires``.
|
| 333 |
+
build.requires = []
|
| 334 |
+
|
| 335 |
+
# The components to install.
|
| 336 |
+
install.components = []
|
| 337 |
+
|
| 338 |
+
# Whether to strip the binaries.
|
| 339 |
+
install.strip = true
|
| 340 |
+
|
| 341 |
+
# The path (relative to platlib) for the file to generate.
|
| 342 |
+
generate[].path = ""
|
| 343 |
+
|
| 344 |
+
# The template string to use for the file.
|
| 345 |
+
generate[].template = ""
|
| 346 |
+
|
| 347 |
+
# The path to the template file. If empty, a template must be set.
|
| 348 |
+
generate[].template-path = ""
|
| 349 |
+
|
| 350 |
+
# The place to put the generated file.
|
| 351 |
+
generate[].location = "install"
|
| 352 |
+
|
| 353 |
+
# A message to print after a build failure.
|
| 354 |
+
messages.after-failure = ""
|
| 355 |
+
|
| 356 |
+
# A message to print after a successful build.
|
| 357 |
+
messages.after-success = ""
|
| 358 |
+
|
| 359 |
+
# Add the python build environment site_packages folder to the CMake prefix paths.
|
| 360 |
+
search.site-packages = true
|
| 361 |
+
|
| 362 |
+
# List dynamic metadata fields and hook locations in this table.
|
| 363 |
+
metadata = {}
|
| 364 |
+
|
| 365 |
+
# Strictly check all config options.
|
| 366 |
+
strict-config = true
|
| 367 |
+
|
| 368 |
+
# Enable early previews of features not finalized yet.
|
| 369 |
+
experimental = false
|
| 370 |
+
|
| 371 |
+
# If set, this will provide a method for backward compatibility.
|
| 372 |
+
minimum-version = "0.11" # current version
|
| 373 |
+
|
| 374 |
+
# The CMake build directory. Defaults to a unique temporary directory.
|
| 375 |
+
build-dir = ""
|
| 376 |
+
|
| 377 |
+
# Immediately fail the build. This is only useful in overrides.
|
| 378 |
+
fail = false
|
| 379 |
+
|
| 380 |
+
```
|
| 381 |
+
|
| 382 |
+
<!-- [[[end]]] -->
|
| 383 |
+
|
| 384 |
+
Most CMake environment variables should be supported, and `CMAKE_ARGS` can be
|
| 385 |
+
used to set extra CMake args. `ARCHFLAGS` is used to specify macOS universal2 or
|
| 386 |
+
cross-compiles, just like setuptools.
|
| 387 |
+
|
| 388 |
+
You can also specify `[[tool.scikit-build.overrides]]` to customize values for
|
| 389 |
+
different systems. See the docs for details.
|
| 390 |
+
|
| 391 |
+
## Other projects for building
|
| 392 |
+
|
| 393 |
+
Scikit-build-core is a binary build backend. There are also other binary build
|
| 394 |
+
backends:
|
| 395 |
+
|
| 396 |
+
- [py-build-cmake][]: A different attempt at a standards compliant builder for
|
| 397 |
+
CMake. Strong focus on cross-compilation. Uses Flit internals.
|
| 398 |
+
- [cmeel][]: A different attempt at a standards compliant builder for CMake.
|
| 399 |
+
Focus on building an ecosystem around a special unimportable folder in
|
| 400 |
+
site-packages (similar to scikit-build's usage of `cmake.*` entrypoints, but
|
| 401 |
+
folder-based).
|
| 402 |
+
- [meson-python][]: A meson-based build backend; has some maintainer overlap
|
| 403 |
+
with scikit-build-core.
|
| 404 |
+
- [maturin][]: A build backend for Rust projects, using Cargo.
|
| 405 |
+
- [enscons][]: A SCons based backend, not very actively developed (but it
|
| 406 |
+
predates all the others in modern standard support!)
|
| 407 |
+
|
| 408 |
+
If you don't need a binary build, you don't need to use a binary build backend!
|
| 409 |
+
There are some very good Python build backends; we recommend [hatchling][] as a
|
| 410 |
+
good balance between good defaults for beginners and good support for advanced
|
| 411 |
+
use cases. This is the tool scikit-build-core itself uses.
|
| 412 |
+
|
| 413 |
+
## Acknowledgements
|
| 414 |
+
|
| 415 |
+
Support for this work was provided by NSF grant [OAC-2209877][]. Any opinions,
|
| 416 |
+
findings, and conclusions or recommendations expressed in this material are
|
| 417 |
+
those of the author(s) and do not necessarily reflect the views of the National
|
| 418 |
+
Science Foundation.
|
| 419 |
+
|
| 420 |
+
<!-- prettier-ignore-start -->
|
| 421 |
+
[OAC-2209877]: https://www.nsf.gov/awardsearch/showAward?AWD_ID=2209877&HistoricalAwards=false
|
| 422 |
+
[actions-badge]: https://github.com/scikit-build/scikit-build-core/workflows/CI/badge.svg
|
| 423 |
+
[actions-link]: https://github.com/scikit-build/scikit-build-core/actions
|
| 424 |
+
[cmeel]: https://github.com/cmake-wheel/cmeel
|
| 425 |
+
[codecov-badge]: https://codecov.io/gh/scikit-build/scikit-build-core/branch/main/graph/badge.svg?token=ZLbQzIvyG8
|
| 426 |
+
[codecov-link]: https://codecov.io/gh/scikit-build/scikit-build-core
|
| 427 |
+
[conda-badge]: https://img.shields.io/conda/vn/conda-forge/scikit-build-core
|
| 428 |
+
[conda-link]: https://github.com/conda-forge/scikit-build-core-feedstock
|
| 429 |
+
[conf-ref]: https://scikit-build-core.readthedocs.io/en/latest/reference/configs.html
|
| 430 |
+
[discord-badge]: https://img.shields.io/discord/803025117553754132?label=Discord%20chat%20%23scikit-build
|
| 431 |
+
[discord-link]: https://discord.gg/pypa
|
| 432 |
+
[download-badge]: https://static.pepy.tech/badge/scikit-build-core/month
|
| 433 |
+
[download-link]: https://pepy.tech/project/scikit-build-core
|
| 434 |
+
[enscons]: https://pypi.org/project/enscons
|
| 435 |
+
[github-discussions-badge]: https://img.shields.io/static/v1?label=Discussions&message=Ask&color=blue&logo=github
|
| 436 |
+
[github-discussions-link]: https://github.com/orgs/scikit-build/discussions
|
| 437 |
+
[hatchling]: https://hatch.pypa.io/latest
|
| 438 |
+
[maturin]: https://www.maturin.rs
|
| 439 |
+
[meson-python]: https://mesonbuild.com/meson-python
|
| 440 |
+
[py-build-cmake]: https://tttapa.github.io/py-build-cmake
|
| 441 |
+
[pypi-link]: https://pypi.org/project/scikit-build-core/
|
| 442 |
+
[pypi-platforms]: https://img.shields.io/pypi/pyversions/scikit-build-core
|
| 443 |
+
[pypi-version]: https://badge.fury.io/py/scikit-build-core.svg
|
| 444 |
+
[rtd-badge]: https://readthedocs.org/projects/scikit-build-core/badge/?version=latest
|
| 445 |
+
[rtd-link]: https://scikit-build-core.readthedocs.io/en/latest/?badge=latest
|
| 446 |
+
<!-- prettier-ignore-end -->
|
.cache/pip/http-v2/c/c/1/3/3/cc133da5701a066bc3777b2575e0daa601596f19871db4608ca98b97
ADDED
|
Binary file (1.78 kB). View file
|
|
|
.cache/pip/http-v2/d/2/b/c/5/d2bc54a4365aeb9214dc95d9e8c9d2636f8c537f2c9e8a1e5753b8a8
ADDED
|
Binary file (1.85 kB). View file
|
|
|
.cache/pip/http-v2/d/2/b/c/5/d2bc54a4365aeb9214dc95d9e8c9d2636f8c537f2c9e8a1e5753b8a8.body
ADDED
|
Binary file (3.38 kB). View file
|
|
|
.cache/pip/http-v2/d/6/c/9/b/d6c9b0bb18a1a2203fdd091226d79bdd9c086219632c1af537a3cec4
ADDED
|
Binary file (1.17 kB). View file
|
|
|
.cache/pip/http-v2/d/6/c/9/b/d6c9b0bb18a1a2203fdd091226d79bdd9c086219632c1af537a3cec4.body
ADDED
|
@@ -0,0 +1,268 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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pascal Bachor
|
| 8 |
+
License: Apache-2.0
|
| 9 |
+
Project-URL: Changelog, https://github.com/bachorp/lazy-imports/blob/HEAD/CHANGELOG.md
|
| 10 |
+
Project-URL: Bug Tracker, https://github.com/bachorp/lazy-imports/issues
|
| 11 |
+
Project-URL: Source Code, https://github.com/bachorp/lazy-imports
|
| 12 |
+
Keywords: import imports lazy
|
| 13 |
+
Classifier: Development Status :: 5 - Production/Stable
|
| 14 |
+
Classifier: Intended Audience :: Developers
|
| 15 |
+
Classifier: Programming Language :: Python :: 3
|
| 16 |
+
Classifier: Programming Language :: Python :: 3.10
|
| 17 |
+
Classifier: Programming Language :: Python :: 3.11
|
| 18 |
+
Classifier: Programming Language :: Python :: 3.12
|
| 19 |
+
Classifier: Programming Language :: Python :: 3.13
|
| 20 |
+
Classifier: Programming Language :: Python :: 3.14
|
| 21 |
+
Classifier: Programming Language :: Python :: 3 :: Only
|
| 22 |
+
Classifier: Topic :: Software Development
|
| 23 |
+
Classifier: Topic :: Software Development :: Libraries
|
| 24 |
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
| 25 |
+
Classifier: Operating System :: OS Independent
|
| 26 |
+
Requires-Python: >=3.10
|
| 27 |
+
Description-Content-Type: text/markdown
|
| 28 |
+
License-File: LICENSE
|
| 29 |
+
Provides-Extra: checking
|
| 30 |
+
Requires-Dist: black; extra == "checking"
|
| 31 |
+
Requires-Dist: flake8; extra == "checking"
|
| 32 |
+
Requires-Dist: isort; extra == "checking"
|
| 33 |
+
Requires-Dist: mdformat; extra == "checking"
|
| 34 |
+
Requires-Dist: pydocstyle; extra == "checking"
|
| 35 |
+
Requires-Dist: mypy; extra == "checking"
|
| 36 |
+
Requires-Dist: pylint; extra == "checking"
|
| 37 |
+
Requires-Dist: pylintfileheader; extra == "checking"
|
| 38 |
+
Provides-Extra: testing
|
| 39 |
+
Requires-Dist: pytest; extra == "testing"
|
| 40 |
+
Requires-Dist: packaging; extra == "testing"
|
| 41 |
+
Provides-Extra: all
|
| 42 |
+
Requires-Dist: isort; extra == "all"
|
| 43 |
+
Requires-Dist: mypy; extra == "all"
|
| 44 |
+
Requires-Dist: flake8; extra == "all"
|
| 45 |
+
Requires-Dist: mdformat; extra == "all"
|
| 46 |
+
Requires-Dist: pytest; extra == "all"
|
| 47 |
+
Requires-Dist: pylint; extra == "all"
|
| 48 |
+
Requires-Dist: pydocstyle; extra == "all"
|
| 49 |
+
Requires-Dist: black; extra == "all"
|
| 50 |
+
Requires-Dist: pylintfileheader; extra == "all"
|
| 51 |
+
Requires-Dist: packaging; extra == "all"
|
| 52 |
+
Dynamic: author
|
| 53 |
+
Dynamic: author-email
|
| 54 |
+
Dynamic: classifier
|
| 55 |
+
Dynamic: description
|
| 56 |
+
Dynamic: description-content-type
|
| 57 |
+
Dynamic: keywords
|
| 58 |
+
Dynamic: license
|
| 59 |
+
Dynamic: license-file
|
| 60 |
+
Dynamic: maintainer
|
| 61 |
+
Dynamic: project-url
|
| 62 |
+
Dynamic: provides-extra
|
| 63 |
+
Dynamic: requires-python
|
| 64 |
+
Dynamic: summary
|
| 65 |
+
|
| 66 |
+
[](https://github.com/bachorp/lazy-imports/actions/workflows/static_checks.yml)
|
| 67 |
+
[](https://www.python.org)
|
| 68 |
+
[](https://pypi.org/project/lazy-imports/)
|
| 69 |
+
|
| 70 |
+
This python utility package helps to create *lazy modules*.
|
| 71 |
+
A lazy module defers loading (some of) its attributes until these attributes are first accessed.
|
| 72 |
+
The module's lazy attributes in turn are attributes of other modules.
|
| 73 |
+
These other modules will be imported/loaded only when (and if) associated attributes are used.
|
| 74 |
+
A lazy import strategy can drastically reduce runtime and memory consumption.
|
| 75 |
+
|
| 76 |
+
Additionally, this package provides a utility for *optional imports* with which one can import a module globally while triggering associated import errors only at use-sites (when and if a dependency is actually required, for example in the context of a specific functionality).
|
| 77 |
+
|
| 78 |
+
[`lazy-imports`](https://pypi.org/project/lazy-imports/) is available on [the Python Package Index (PyPI)](https://pypi.org/project/lazy-imports/).
|
| 79 |
+
|
| 80 |
+
> [!IMPORTANT]
|
| 81 |
+
> Python's import system is highly complex and side effects are ubiquitous.
|
| 82 |
+
> Although employing lazy imports (in a sanely structured project) is quite safe, you should keep in mind that there are necessarily subtle differences between lazy and ordinary (eager) imports/modules.
|
| 83 |
+
|
| 84 |
+
> [!TIP]
|
| 85 |
+
> Using a dedicated package such as this one means that you don't have to go through all the details yourself.
|
| 86 |
+
> Still, we recommend to become acquainted with the basic functionality of lazy modules (such as understanding the roles of `__getattr__`, `__dir__`, and `__all__`).
|
| 87 |
+
> If you'd like to talk about it, feel free to open the [discussion](https://github.com/bachorp/lazy-imports/discussions) on Github.
|
| 88 |
+
|
| 89 |
+
### Table of Contents
|
| 90 |
+
|
| 91 |
+
- [`LazyModule`](#lazymodule)
|
| 92 |
+
- [Example 1](#example-1)
|
| 93 |
+
- [Example 2](#example-2)
|
| 94 |
+
- [`try_import`](#try_import)
|
| 95 |
+
- [`LazyImporter`](#lazyimporter)
|
| 96 |
+
- [History](#history)
|
| 97 |
+
- [Licensing](#licensing)
|
| 98 |
+
|
| 99 |
+
## [`LazyModule`](./lazy_imports/lazy_module.py)
|
| 100 |
+
|
| 101 |
+
### Example 1
|
| 102 |
+
|
| 103 |
+
Type checkers cannot reason about dynamic attributes.
|
| 104 |
+
Therefore, we need a separate code path (using [`typing.TYPE_CHECKING`](https://docs.python.org/3/library/typing.html#typing.TYPE_CHECKING)) on which regular imports are used.
|
| 105 |
+
By moving the imports to a separate file and using the `module_source` utility, code duplication can be avoided.
|
| 106 |
+
|
| 107 |
+
```python
|
| 108 |
+
# _exports.py
|
| 109 |
+
from absolute.package import Class, function
|
| 110 |
+
|
| 111 |
+
from .submodule import Interface as MyInterface
|
| 112 |
+
```
|
| 113 |
+
|
| 114 |
+
> [!IMPORTANT]
|
| 115 |
+
> Lazy attributes have to be proper attributes (defined in `__init__.py`) of the module they are imported from and cannot be submodules.
|
| 116 |
+
> In this example, if `function` is a submodule of `absolute.package`, the lazy module won't (try to) load `absolute.package.function` as a module by itself; in this case, an access of the lazy module's attribute `function` might fail.
|
| 117 |
+
|
| 118 |
+
```python
|
| 119 |
+
# __init__.py
|
| 120 |
+
"""This is my great package."""
|
| 121 |
+
|
| 122 |
+
from typing import TYPE_CHECKING
|
| 123 |
+
from lazy_imports import LazyModule, as_package, load, module_source
|
| 124 |
+
|
| 125 |
+
__version__ = "0.1.0"
|
| 126 |
+
|
| 127 |
+
if TYPE_CHECKING:
|
| 128 |
+
from ._exports import *
|
| 129 |
+
else:
|
| 130 |
+
# Registers the lazy module in `sys.modules`
|
| 131 |
+
load(
|
| 132 |
+
# The constructor takes arbitrarily many attribute declarations in various forms
|
| 133 |
+
LazyModule(
|
| 134 |
+
# Attributes `__file__` and `__path__` (required for importing submodules of this module)
|
| 135 |
+
*as_package(__file__),
|
| 136 |
+
# An ordinary (eager) attribute
|
| 137 |
+
("__version__", __version__),
|
| 138 |
+
# Finds and parses the source of the submodule `_exports` (namely the file `_exports.py`)
|
| 139 |
+
module_source("._exports", __name__),
|
| 140 |
+
# Fully-qualified name of the module (required)
|
| 141 |
+
name=__name__,
|
| 142 |
+
# Docstring from the top of the module
|
| 143 |
+
doc=__doc__,
|
| 144 |
+
)
|
| 145 |
+
)
|
| 146 |
+
```
|
| 147 |
+
|
| 148 |
+
### Example 2
|
| 149 |
+
|
| 150 |
+
```python
|
| 151 |
+
# __init__.py
|
| 152 |
+
import ast as _ast
|
| 153 |
+
from typing import TYPE_CHECKING
|
| 154 |
+
from lazy_imports import LazyModule as _LazyModule
|
| 155 |
+
|
| 156 |
+
# Keep outside the `not TYPE_CHECKING` branch such that your type checker does not skip this expression
|
| 157 |
+
_mod = LazyModule(
|
| 158 |
+
*as_package(__file__),
|
| 159 |
+
# A string with arbitrarily many `from <module> import <attribute>`-statements
|
| 160 |
+
"from . import echo",
|
| 161 |
+
# Plain type from `ast`
|
| 162 |
+
ast.ImportFrom(names=[ast.alias(name="formats")], level=2),
|
| 163 |
+
ast.ImportFrom(module="filters", names=[ast.alias(name="equalizer", asname="eq")], level=2),
|
| 164 |
+
name=__name__,
|
| 165 |
+
)
|
| 166 |
+
|
| 167 |
+
if TYPE_CHECKING:
|
| 168 |
+
from . import echo
|
| 169 |
+
from .. import formats
|
| 170 |
+
from ..filters import equalizer as eq
|
| 171 |
+
else:
|
| 172 |
+
# NOTE: If you use this trick (instead of directly writing to `sys.modules`), you'll have to make
|
| 173 |
+
# sure that none of the attributes overlap with already defined variables (such as `_ast`).
|
| 174 |
+
__getattr__, __dir__, __all__ = _mod.__getattr__, _mod.__dir__, _mod.__all__
|
| 175 |
+
```
|
| 176 |
+
|
| 177 |
+
## [`try_import`](./lazy_imports/try_import.py)
|
| 178 |
+
|
| 179 |
+
`try_import` is a context manager that can wrap imports of optional packages to defer exceptions.
|
| 180 |
+
This way you don't have to import the packages every time you call a function, but you can still import the package at the top of your module.
|
| 181 |
+
The context manager defers the exceptions until you actually need to use the package.
|
| 182 |
+
You can see an example below.
|
| 183 |
+
|
| 184 |
+
```python
|
| 185 |
+
from lazy_imports import try_import
|
| 186 |
+
|
| 187 |
+
with try_import() as optional_package_import: # use `try_import` as a context manager
|
| 188 |
+
import optional_package # optional package that might not be installed
|
| 189 |
+
|
| 190 |
+
def optional_function(): # optional function that uses the optional package
|
| 191 |
+
optional_package_import.check() # check if the import was ok or raise a meaningful exception
|
| 192 |
+
optional_package.some_external_function() # use the optional package here
|
| 193 |
+
```
|
| 194 |
+
|
| 195 |
+
## [`LazyImporter`](./lazy_imports/v0/lazy_imports.py)
|
| 196 |
+
|
| 197 |
+
> [!TIP]
|
| 198 |
+
> Instead of `LazyImporter` we recommend using its successor `LazyModule`, which
|
| 199 |
+
>
|
| 200 |
+
> - allows attributes to be imported from any module (and not just submodules),
|
| 201 |
+
> - offers to specify imports as plain python code (which can then be sourced from a dedicated file),
|
| 202 |
+
> - supports `__doc__`, and
|
| 203 |
+
> - applies additional sanity checks (such as preventing cyclic imports).
|
| 204 |
+
|
| 205 |
+
Usage example taken from [`hpoflow/__init__.py`](https://github.com/telekom/HPOflow/blob/1b26f3b86cad607dd89a31fa9135256d956948cb/hpoflow/__init__.py):
|
| 206 |
+
|
| 207 |
+
```python
|
| 208 |
+
import sys
|
| 209 |
+
from typing import TYPE_CHECKING
|
| 210 |
+
|
| 211 |
+
from lazy_imports import LazyImporter
|
| 212 |
+
|
| 213 |
+
from hpoflow.version import __version__
|
| 214 |
+
|
| 215 |
+
|
| 216 |
+
_import_structure = {
|
| 217 |
+
"mlflow": [
|
| 218 |
+
"normalize_mlflow_entry_name",
|
| 219 |
+
"normalize_mlflow_entry_names_in_dict",
|
| 220 |
+
"check_repo_is_dirty",
|
| 221 |
+
],
|
| 222 |
+
"optuna": ["SignificanceRepeatedTrainingPruner"],
|
| 223 |
+
"optuna_mlflow": ["OptunaMLflow"],
|
| 224 |
+
"optuna_transformers": ["OptunaMLflowCallback"],
|
| 225 |
+
"utils": ["func_no_exception_caller"],
|
| 226 |
+
}
|
| 227 |
+
|
| 228 |
+
# Direct imports for type-checking
|
| 229 |
+
if TYPE_CHECKING:
|
| 230 |
+
from hpoflow.mlflow import ( # noqa: F401
|
| 231 |
+
check_repo_is_dirty,
|
| 232 |
+
normalize_mlflow_entry_name,
|
| 233 |
+
normalize_mlflow_entry_names_in_dict,
|
| 234 |
+
)
|
| 235 |
+
from hpoflow.optuna import SignificanceRepeatedTrainingPruner # noqa: F401
|
| 236 |
+
from hpoflow.optuna_mlflow import OptunaMLflow # noqa: F401
|
| 237 |
+
from hpoflow.optuna_transformers import OptunaMLflowCallback # noqa: F401
|
| 238 |
+
from hpoflow.utils import func_no_exception_caller # noqa: F401
|
| 239 |
+
else:
|
| 240 |
+
sys.modules[__name__] = LazyImporter(
|
| 241 |
+
__name__,
|
| 242 |
+
globals()["__file__"],
|
| 243 |
+
_import_structure,
|
| 244 |
+
extra_objects={"__version__": __version__},
|
| 245 |
+
)
|
| 246 |
+
```
|
| 247 |
+
|
| 248 |
+
## History
|
| 249 |
+
|
| 250 |
+
This project has previously been maintained by the [One Conversation](https://welove.ai/) team of [Deutsche Telekom AG](https://www.telekom.com/).
|
| 251 |
+
It is based on [`_LazyModule`](https://github.com/huggingface/transformers/blob/e218249b02465ec8b6029f201f2503b9e3b61feb/src/transformers/file_utils.py#L1945) from [HuggingFace](https://huggingface.co/) and [`try_import()`](https://github.com/optuna/optuna/blob/1f92d496b0c4656645384e31539e4ee74992ff55/optuna/_imports.py#L89) from the [Optuna framework](https://optuna.readthedocs.io/).
|
| 252 |
+
Many thanks to HuggingFace for [your consent](https://github.com/huggingface/transformers/issues/12861#issuecomment-886712209)
|
| 253 |
+
and to Optuna for [your consent](https://github.com/optuna/optuna/issues/2776#issuecomment-874614137) to publish it as a standalone package 🤗 ♥.
|
| 254 |
+
|
| 255 |
+
In December 2024 responsibility was transferred to [Pascal Bachor](https://github.com/bachorp).
|
| 256 |
+
|
| 257 |
+
## Licensing
|
| 258 |
+
|
| 259 |
+
Copyright (c) 2024-2025 Pascal Bachor<br/>
|
| 260 |
+
Copyright (c) 2021 [Philip May](https://philipmay.org/), [Deutsche Telekom AG](https://www.telekom.com/)<br/>
|
| 261 |
+
Copyright (c) 2020, 2021 [The HuggingFace Team](https://huggingface.co/)<br/>
|
| 262 |
+
Copyright (c) 2018 Preferred Networks, Inc.
|
| 263 |
+
|
| 264 |
+
Licensed under the [Apache License, Version 2.0](https://github.com/bachorp/lazy-imports/blob/HEAD/LICENSE) (the "License");
|
| 265 |
+
you may not use this file except in compliance with the License.
|
| 266 |
+
You may obtain a copy of the License at [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0).
|
| 267 |
+
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 268 |
+
See the License for the specific language governing permissions and limitations under the License.
|
.cache/pip/http-v2/d/8/e/0/9/d8e09aa7b92b4e0dca0973688684cc242bd7a4215af30cdeca5554a3
ADDED
|
Binary file (1.21 kB). View file
|
|
|
.cache/pip/http-v2/d/8/e/0/9/d8e09aa7b92b4e0dca0973688684cc242bd7a4215af30cdeca5554a3.body
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.4
|
| 2 |
+
Name: hatch-fancy-pypi-readme
|
| 3 |
+
Version: 25.1.0
|
| 4 |
+
Summary: Fancy PyPI READMEs with Hatch
|
| 5 |
+
Project-URL: Documentation, https://github.com/hynek/hatch-fancy-pypi-readme#readme
|
| 6 |
+
Project-URL: Changelog, https://github.com/hynek/hatch-fancy-pypi-readme/blob/main/CHANGELOG.md
|
| 7 |
+
Project-URL: Source Code, https://github.com/hynek/hatch-fancy-pypi-readme
|
| 8 |
+
Project-URL: Funding, https://github.com/sponsors/hynek
|
| 9 |
+
Author-email: Hynek Schlawack <hs@ox.cx>
|
| 10 |
+
License-Expression: MIT
|
| 11 |
+
License-File: LICENSE.txt
|
| 12 |
+
Keywords: documentation,hatch,pypi,readme
|
| 13 |
+
Classifier: Development Status :: 5 - Production/Stable
|
| 14 |
+
Classifier: Framework :: Hatch
|
| 15 |
+
Classifier: Operating System :: OS Independent
|
| 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: Programming Language :: Python :: 3.13
|
| 22 |
+
Classifier: Topic :: Software Development :: Build Tools
|
| 23 |
+
Requires-Python: >=3.8
|
| 24 |
+
Requires-Dist: hatchling
|
| 25 |
+
Requires-Dist: tomli; python_version < '3.11'
|
| 26 |
+
Provides-Extra: dev
|
| 27 |
+
Requires-Dist: build; extra == 'dev'
|
| 28 |
+
Requires-Dist: mypy; extra == 'dev'
|
| 29 |
+
Requires-Dist: pytest; extra == 'dev'
|
| 30 |
+
Requires-Dist: wheel; extra == 'dev'
|
| 31 |
+
Provides-Extra: tests
|
| 32 |
+
Requires-Dist: build; extra == 'tests'
|
| 33 |
+
Requires-Dist: pytest; extra == 'tests'
|
| 34 |
+
Requires-Dist: wheel; extra == 'tests'
|
| 35 |
+
Description-Content-Type: text/markdown
|
| 36 |
+
|
| 37 |
+
# Your ✨Fancy✨ Project Deserves a ✨Fancy✨ PyPI Readme!
|
| 38 |
+
|
| 39 |
+
*hatch-fancy-pypi-readme* is an MIT-licensed metadata plugin for [Hatch](https://hatch.pypa.io/) by [Hynek Schlawack](https://hynek.me/).
|
| 40 |
+
|
| 41 |
+
Its purpose is to help you to have fancy PyPI readmes – unlike *this* one you’re looking at right now.
|
| 42 |
+
|
| 43 |
+
Please check out the [documentation](https://github.com/hynek/hatch-fancy-pypi-readme#readme) to see what *hatch-fancy-pypi-readme* can do for you and your projects!
|
.cache/pip/http-v2/d/9/d/5/f/d9d5f2d642db317afc4dbf47caf66f462f28670a2eafad11d17a25d5
ADDED
|
Binary file (1.78 kB). View file
|
|
|
.cache/pip/http-v2/d/9/d/5/f/d9d5f2d642db317afc4dbf47caf66f462f28670a2eafad11d17a25d5.body
ADDED
|
Binary file (7.9 kB). View file
|
|
|
.cache/pip/http-v2/d/a/1/7/8/da1780e4b38e99fc7d98c9695282deb3a6238d5b858e1394f07be68b
ADDED
|
Binary file (1.19 kB). View file
|
|
|
.cache/pip/http-v2/d/a/1/7/8/da1780e4b38e99fc7d98c9695282deb3a6238d5b858e1394f07be68b.body
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.4
|
| 2 |
+
Name: meson
|
| 3 |
+
Version: 1.10.1
|
| 4 |
+
Summary: A high performance build system
|
| 5 |
+
Home-page: https://mesonbuild.com
|
| 6 |
+
Author: Jussi Pakkanen
|
| 7 |
+
Author-email: jpakkane@gmail.com
|
| 8 |
+
License: Apache License, Version 2.0
|
| 9 |
+
Project-URL: Source, https://github.com/mesonbuild/meson
|
| 10 |
+
Keywords: meson,mesonbuild,build system,cmake
|
| 11 |
+
Classifier: Development Status :: 5 - Production/Stable
|
| 12 |
+
Classifier: Environment :: Console
|
| 13 |
+
Classifier: Intended Audience :: Developers
|
| 14 |
+
Classifier: License :: OSI Approved :: Apache Software License
|
| 15 |
+
Classifier: Natural Language :: English
|
| 16 |
+
Classifier: Operating System :: MacOS :: MacOS X
|
| 17 |
+
Classifier: Operating System :: Microsoft :: Windows
|
| 18 |
+
Classifier: Operating System :: POSIX :: BSD
|
| 19 |
+
Classifier: Operating System :: POSIX :: Linux
|
| 20 |
+
Classifier: Programming Language :: Python :: 3 :: Only
|
| 21 |
+
Classifier: Programming Language :: Python :: 3.7
|
| 22 |
+
Classifier: Programming Language :: Python :: 3.8
|
| 23 |
+
Classifier: Programming Language :: Python :: 3.9
|
| 24 |
+
Classifier: Programming Language :: Python :: 3.10
|
| 25 |
+
Classifier: Programming Language :: Python :: 3.11
|
| 26 |
+
Classifier: Programming Language :: Python :: 3.12
|
| 27 |
+
Classifier: Programming Language :: Python :: 3.13
|
| 28 |
+
Classifier: Topic :: Software Development :: Build Tools
|
| 29 |
+
Requires-Python: >=3.7
|
| 30 |
+
License-File: COPYING
|
| 31 |
+
Provides-Extra: ninja
|
| 32 |
+
Requires-Dist: ninja>=1.8.2; extra == "ninja"
|
| 33 |
+
Provides-Extra: progress
|
| 34 |
+
Requires-Dist: tqdm; extra == "progress"
|
| 35 |
+
Provides-Extra: typing
|
| 36 |
+
Requires-Dist: mypy; extra == "typing"
|
| 37 |
+
Requires-Dist: typing_extensions; python_version < "3.8" and extra == "typing"
|
| 38 |
+
Dynamic: license-file
|
| 39 |
+
|
| 40 |
+
Meson is a cross-platform build system designed to be both as fast and as user friendly as possible. It supports many languages and compilers, including GCC, Clang, PGI, Intel, and Visual Studio. Its build definitions are written in a simple non-Turing complete DSL.
|