src-py-lib 0.1.5__tar.gz → 0.1.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. {src_py_lib-0.1.5 → src_py_lib-0.1.6}/AGENTS.md +4 -4
  2. {src_py_lib-0.1.5 → src_py_lib-0.1.6}/PKG-INFO +1 -1
  3. {src_py_lib-0.1.5 → src_py_lib-0.1.6}/pyproject.toml +1 -1
  4. {src_py_lib-0.1.5 → src_py_lib-0.1.6}/renovate.json +3 -0
  5. {src_py_lib-0.1.5 → src_py_lib-0.1.6}/src/src_py_lib/clients/sourcegraph.py +23 -2
  6. {src_py_lib-0.1.5 → src_py_lib-0.1.6}/tests/test_logging_http_clients.py +30 -1
  7. {src_py_lib-0.1.5 → src_py_lib-0.1.6}/uv.lock +1 -1
  8. {src_py_lib-0.1.5 → src_py_lib-0.1.6}/.github/workflows/ci.yml +0 -0
  9. {src_py_lib-0.1.5 → src_py_lib-0.1.6}/.github/workflows/release.yml +0 -0
  10. {src_py_lib-0.1.5 → src_py_lib-0.1.6}/.github/workflows/validate.yml +0 -0
  11. {src_py_lib-0.1.5 → src_py_lib-0.1.6}/.gitignore +0 -0
  12. {src_py_lib-0.1.5 → src_py_lib-0.1.6}/.markdownlint-cli2.yaml +0 -0
  13. {src_py_lib-0.1.5 → src_py_lib-0.1.6}/.python-version +0 -0
  14. {src_py_lib-0.1.5 → src_py_lib-0.1.6}/LICENSE +0 -0
  15. {src_py_lib-0.1.5 → src_py_lib-0.1.6}/README.md +0 -0
  16. {src_py_lib-0.1.5 → src_py_lib-0.1.6}/SECURITY.md +0 -0
  17. {src_py_lib-0.1.5 → src_py_lib-0.1.6}/src/src_py_lib/__init__.py +0 -0
  18. {src_py_lib-0.1.5 → src_py_lib-0.1.6}/src/src_py_lib/clients/__init__.py +0 -0
  19. {src_py_lib-0.1.5 → src_py_lib-0.1.6}/src/src_py_lib/clients/github.py +0 -0
  20. {src_py_lib-0.1.5 → src_py_lib-0.1.6}/src/src_py_lib/clients/google_sheets.py +0 -0
  21. {src_py_lib-0.1.5 → src_py_lib-0.1.6}/src/src_py_lib/clients/graphql.py +0 -0
  22. {src_py_lib-0.1.5 → src_py_lib-0.1.6}/src/src_py_lib/clients/linear.py +0 -0
  23. {src_py_lib-0.1.5 → src_py_lib-0.1.6}/src/src_py_lib/clients/one_password.py +0 -0
  24. {src_py_lib-0.1.5 → src_py_lib-0.1.6}/src/src_py_lib/clients/slack.py +0 -0
  25. {src_py_lib-0.1.5 → src_py_lib-0.1.6}/src/src_py_lib/py.typed +0 -0
  26. {src_py_lib-0.1.5 → src_py_lib-0.1.6}/src/src_py_lib/utils/__init__.py +0 -0
  27. {src_py_lib-0.1.5 → src_py_lib-0.1.6}/src/src_py_lib/utils/config.py +0 -0
  28. {src_py_lib-0.1.5 → src_py_lib-0.1.6}/src/src_py_lib/utils/http.py +0 -0
  29. {src_py_lib-0.1.5 → src_py_lib-0.1.6}/src/src_py_lib/utils/json_cache.py +0 -0
  30. {src_py_lib-0.1.5 → src_py_lib-0.1.6}/src/src_py_lib/utils/json_types.py +0 -0
  31. {src_py_lib-0.1.5 → src_py_lib-0.1.6}/src/src_py_lib/utils/logging.py +0 -0
  32. {src_py_lib-0.1.5 → src_py_lib-0.1.6}/src/src_py_lib/utils/tsv.py +0 -0
  33. {src_py_lib-0.1.5 → src_py_lib-0.1.6}/tests/test_import.py +0 -0
  34. {src_py_lib-0.1.5 → src_py_lib-0.1.6}/tests/test_tsv.py +0 -0
@@ -64,7 +64,7 @@ uv run python -m unittest discover -s tests
64
64
  ```sh
65
65
  set -euo pipefail
66
66
 
67
- VERSION=0.1.4
67
+ VERSION=0.1.6
68
68
  BRANCH="release-v${VERSION}"
69
69
 
70
70
  git fetch origin --tags --prune
@@ -116,7 +116,7 @@ rm -rf /tmp/src-py-lib-release-check
116
116
  ```sh
117
117
  set -euo pipefail
118
118
 
119
- VERSION=0.1.4
119
+ VERSION=0.1.6
120
120
  BRANCH="release-v${VERSION}"
121
121
  GH_REPO="sourcegraph/src-py-lib"
122
122
 
@@ -140,7 +140,7 @@ gh pr merge "${BRANCH}" --repo "${GH_REPO}" --squash --delete-branch
140
140
  ```sh
141
141
  set -euo pipefail
142
142
 
143
- VERSION=0.1.4
143
+ VERSION=0.1.6
144
144
 
145
145
  git fetch origin --tags --prune
146
146
  git switch main
@@ -154,7 +154,7 @@ git push origin "v${VERSION}"
154
154
  ```sh
155
155
  set -euo pipefail
156
156
 
157
- VERSION=0.1.4
157
+ VERSION=0.1.6
158
158
  GH_REPO="sourcegraph/src-py-lib"
159
159
 
160
160
  RUN_ID="$(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: src-py-lib
3
- Version: 0.1.5
3
+ Version: 0.1.6
4
4
  Summary: Reusable libraries for Sourcegraph projects
5
5
  Project-URL: Homepage, https://github.com/sourcegraph/src-py-lib
6
6
  Project-URL: Issues, https://github.com/sourcegraph/src-py-lib/issues
@@ -10,7 +10,7 @@ dev = [
10
10
 
11
11
  [project]
12
12
  name = "src-py-lib"
13
- version = "0.1.5"
13
+ version = "0.1.6"
14
14
  description = "Reusable libraries for Sourcegraph projects"
15
15
  readme = "README.md"
16
16
  requires-python = ">=3.11"
@@ -10,5 +10,8 @@
10
10
  ],
11
11
  "allowedVersions": "<3.12"
12
12
  }
13
+ ],
14
+ "schedule": [
15
+ "at any time"
13
16
  ]
14
17
  }
@@ -206,8 +206,29 @@ class SourcegraphClient:
206
206
  require_https=not self.allow_insecure_http,
207
207
  )
208
208
 
209
- def graphql(self, query: str, variables: Mapping[str, JSONValue] | None = None) -> JSONDict:
210
- return self._client().execute(query, variables)
209
+ def graphql(
210
+ self,
211
+ query: str,
212
+ variables: Mapping[str, JSONValue] | None = None,
213
+ *,
214
+ follow_pages: bool = True,
215
+ page_size: int | None = None,
216
+ first_variable: str = "first",
217
+ after_variable: str = "after",
218
+ ) -> JSONDict:
219
+ """Execute one Sourcegraph GraphQL operation.
220
+
221
+ Set `follow_pages=False` when the caller owns pagination, such as
222
+ aliased queries with one cursor per alias.
223
+ """
224
+ return self._client().execute(
225
+ query,
226
+ variables,
227
+ follow_pages=follow_pages,
228
+ page_size=page_size,
229
+ first_variable=first_variable,
230
+ after_variable=after_variable,
231
+ )
211
232
 
212
233
  def stream_connection_nodes(
213
234
  self,
@@ -1424,6 +1424,35 @@ class ClientTest(unittest.TestCase):
1424
1424
  self.assertEqual(http.calls[0]["url"], "https://sourcegraph.example.com/.api/graphql")
1425
1425
  self.assertEqual(http.calls[0]["headers"], {"Authorization": "token token"})
1426
1426
 
1427
+ def test_sourcegraph_client_graphql_can_disable_auto_pagination(self) -> None:
1428
+ http = RecordingHTTP(
1429
+ [
1430
+ {
1431
+ "data": {
1432
+ "users": {
1433
+ "nodes": [{"username": "alice"}],
1434
+ "pageInfo": {"hasNextPage": True, "endCursor": "cursor-1"},
1435
+ }
1436
+ }
1437
+ }
1438
+ ]
1439
+ )
1440
+ client = SourcegraphClient("https://sourcegraph.example.com", "token", http=http)
1441
+ query = """
1442
+ query Users($first: Int!, $after: String) {
1443
+ users(first: $first, after: $after) {
1444
+ nodes { username }
1445
+ pageInfo { hasNextPage endCursor }
1446
+ }
1447
+ }
1448
+ """
1449
+
1450
+ data = client.graphql(query, page_size=1, follow_pages=False)
1451
+
1452
+ self.assertEqual(json_dict(data.get("users"))["nodes"], [{"username": "alice"}])
1453
+ self.assertEqual(len(http.calls), 1)
1454
+ self.assertEqual(http.calls[0]["json_body"]["variables"], {"first": 1})
1455
+
1427
1456
  def test_sourcegraph_client_rejects_http_endpoint_by_default(self) -> None:
1428
1457
  with self.assertRaisesRegex(ValueError, "https:// URL"):
1429
1458
  SourcegraphClient("http://sourcegraph.example.com", "token")
@@ -1536,7 +1565,7 @@ class ClientTest(unittest.TestCase):
1536
1565
 
1537
1566
  with src.trace_context(root_context):
1538
1567
  self.assertEqual(
1539
- client.graphql("query Viewer { currentUser { username } }"),
1568
+ client.graphql("query Viewer { currentUser { username } }", follow_pages=False),
1540
1569
  {"currentUser": {"username": "alice"}},
1541
1570
  )
1542
1571
  traces = client.drain_traces()
@@ -254,7 +254,7 @@ wheels = [
254
254
 
255
255
  [[package]]
256
256
  name = "src-py-lib"
257
- version = "0.1.5"
257
+ version = "0.1.6"
258
258
  source = { editable = "." }
259
259
  dependencies = [
260
260
  { name = "httpx" },
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes