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.
- {src_py_lib-0.1.5 → src_py_lib-0.1.6}/AGENTS.md +4 -4
- {src_py_lib-0.1.5 → src_py_lib-0.1.6}/PKG-INFO +1 -1
- {src_py_lib-0.1.5 → src_py_lib-0.1.6}/pyproject.toml +1 -1
- {src_py_lib-0.1.5 → src_py_lib-0.1.6}/renovate.json +3 -0
- {src_py_lib-0.1.5 → src_py_lib-0.1.6}/src/src_py_lib/clients/sourcegraph.py +23 -2
- {src_py_lib-0.1.5 → src_py_lib-0.1.6}/tests/test_logging_http_clients.py +30 -1
- {src_py_lib-0.1.5 → src_py_lib-0.1.6}/uv.lock +1 -1
- {src_py_lib-0.1.5 → src_py_lib-0.1.6}/.github/workflows/ci.yml +0 -0
- {src_py_lib-0.1.5 → src_py_lib-0.1.6}/.github/workflows/release.yml +0 -0
- {src_py_lib-0.1.5 → src_py_lib-0.1.6}/.github/workflows/validate.yml +0 -0
- {src_py_lib-0.1.5 → src_py_lib-0.1.6}/.gitignore +0 -0
- {src_py_lib-0.1.5 → src_py_lib-0.1.6}/.markdownlint-cli2.yaml +0 -0
- {src_py_lib-0.1.5 → src_py_lib-0.1.6}/.python-version +0 -0
- {src_py_lib-0.1.5 → src_py_lib-0.1.6}/LICENSE +0 -0
- {src_py_lib-0.1.5 → src_py_lib-0.1.6}/README.md +0 -0
- {src_py_lib-0.1.5 → src_py_lib-0.1.6}/SECURITY.md +0 -0
- {src_py_lib-0.1.5 → src_py_lib-0.1.6}/src/src_py_lib/__init__.py +0 -0
- {src_py_lib-0.1.5 → src_py_lib-0.1.6}/src/src_py_lib/clients/__init__.py +0 -0
- {src_py_lib-0.1.5 → src_py_lib-0.1.6}/src/src_py_lib/clients/github.py +0 -0
- {src_py_lib-0.1.5 → src_py_lib-0.1.6}/src/src_py_lib/clients/google_sheets.py +0 -0
- {src_py_lib-0.1.5 → src_py_lib-0.1.6}/src/src_py_lib/clients/graphql.py +0 -0
- {src_py_lib-0.1.5 → src_py_lib-0.1.6}/src/src_py_lib/clients/linear.py +0 -0
- {src_py_lib-0.1.5 → src_py_lib-0.1.6}/src/src_py_lib/clients/one_password.py +0 -0
- {src_py_lib-0.1.5 → src_py_lib-0.1.6}/src/src_py_lib/clients/slack.py +0 -0
- {src_py_lib-0.1.5 → src_py_lib-0.1.6}/src/src_py_lib/py.typed +0 -0
- {src_py_lib-0.1.5 → src_py_lib-0.1.6}/src/src_py_lib/utils/__init__.py +0 -0
- {src_py_lib-0.1.5 → src_py_lib-0.1.6}/src/src_py_lib/utils/config.py +0 -0
- {src_py_lib-0.1.5 → src_py_lib-0.1.6}/src/src_py_lib/utils/http.py +0 -0
- {src_py_lib-0.1.5 → src_py_lib-0.1.6}/src/src_py_lib/utils/json_cache.py +0 -0
- {src_py_lib-0.1.5 → src_py_lib-0.1.6}/src/src_py_lib/utils/json_types.py +0 -0
- {src_py_lib-0.1.5 → src_py_lib-0.1.6}/src/src_py_lib/utils/logging.py +0 -0
- {src_py_lib-0.1.5 → src_py_lib-0.1.6}/src/src_py_lib/utils/tsv.py +0 -0
- {src_py_lib-0.1.5 → src_py_lib-0.1.6}/tests/test_import.py +0 -0
- {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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
|
@@ -206,8 +206,29 @@ class SourcegraphClient:
|
|
|
206
206
|
require_https=not self.allow_insecure_http,
|
|
207
207
|
)
|
|
208
208
|
|
|
209
|
-
def graphql(
|
|
210
|
-
|
|
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()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|