Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions spanner/observability/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ Python samples demonstrating Cloud Spanner OpenTelemetry client-side and end-to-
source env/bin/activate
```

2. Install dependencies:
2. Install the samples and their dependencies:

```sh
pip install -r requirements.txt
pip install -e .
```

## Running Tests
Expand Down
13 changes: 5 additions & 8 deletions spanner/observability/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,10 @@ build-backend = "setuptools.build_meta"
name = "spanner-observability-samples"
version = "0.0.0"
requires-python = ">=3.13"
dependencies = [
"google-api-core==2.44.0",
"google-cloud-spanner==3.72.0",
"opentelemetry-api==1.45.2",
"opentelemetry-exporter-gcp-trace==1.15.0",
"opentelemetry-exporter-otlp-proto-grpc==1.45.2",
"opentelemetry-sdk==1.45.2",
]
# Dependencies are pinned in requirements.txt, the single source of truth.
dynamic = ["dependencies"]
# PyPI rejects uploads with this classifier.
classifiers = ["Private :: Do Not Upload"]

[tool.setuptools.dynamic]
dependencies = {file = ["requirements.txt"]}
3 changes: 0 additions & 3 deletions spanner/observability/tests/disable_builtin_metrics_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
PROJECT_ID = "example-project-id"
INSTANCE_ID = "example-instance"
DATABASE_ID = "example-db"
DATABASE_NAME = f"projects/{PROJECT_ID}/instances/{INSTANCE_ID}/databases/{DATABASE_ID}"
SPANNER_CLIENT = "google.cloud.spanner.Client"


Expand All @@ -36,7 +35,6 @@ def test_disable_builtin_metrics_success(
database = (
mock_client_class.return_value.instance.return_value.database.return_value
)
database.name = DATABASE_NAME
snapshot = database.snapshot.return_value.__enter__.return_value
snapshot.execute_sql.return_value = [(1,)]

Expand Down Expand Up @@ -99,7 +97,6 @@ def test_disable_builtin_metrics_cli_entrypoint(
database = (
mock_client_class.return_value.instance.return_value.database.return_value
)
database.name = DATABASE_NAME
snapshot = database.snapshot.return_value.__enter__.return_value
snapshot.execute_sql.return_value = [(1,)]
monkeypatch.setattr(
Expand Down
4 changes: 2 additions & 2 deletions spanner/search_and_ai/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ Python samples demonstrating vector search (`COSINE_DISTANCE`, `APPROX_COSINE_DI
source env/bin/activate
```

2. Install dependencies:
2. Install the samples and their dependencies:

```sh
pip install -r requirements.txt
pip install -e .
```

3. Set your Google Cloud project ID and run a sample:
Expand Down
9 changes: 5 additions & 4 deletions spanner/search_and_ai/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ build-backend = "setuptools.build_meta"
name = "spanner-search-and-ai-samples"
version = "0.0.0"
requires-python = ">=3.13"
dependencies = [
"google-api-core==2.44.0",
"google-cloud-spanner==3.72.0",
]
# Dependencies are pinned in requirements.txt, the single source of truth.
dynamic = ["dependencies"]
# PyPI rejects uploads with this classifier.
classifiers = ["Private :: Do Not Upload"]

[tool.setuptools.dynamic]
dependencies = {file = ["requirements.txt"]}
8 changes: 5 additions & 3 deletions spanner/search_and_ai/tests/vector_search_knn_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
SPANNER_CLIENT = "google.cloud.spanner.Client"


@mock.patch(SPANNER_CLIENT)
@mock.patch(SPANNER_CLIENT, autospec=True)
def test_find_k_nearest_neighbors_success(
mock_client_class: mock.MagicMock, capsys: pytest.CaptureFixture[str]
) -> None:
Expand Down Expand Up @@ -68,7 +68,7 @@ def test_find_k_nearest_neighbors_success(
),
],
)
@mock.patch(SPANNER_CLIENT)
@mock.patch(SPANNER_CLIENT, autospec=True)
def test_find_k_nearest_neighbors_errors(
mock_client_class: mock.MagicMock,
capsys: pytest.CaptureFixture[str],
Expand All @@ -89,7 +89,7 @@ def test_find_k_nearest_neighbors_errors(
assert PROJECT_ID not in err


@mock.patch(SPANNER_CLIENT)
@mock.patch(SPANNER_CLIENT, autospec=True)
def test_find_k_nearest_neighbors_cli_entrypoint(
mock_client_class: mock.MagicMock,
monkeypatch: pytest.MonkeyPatch,
Expand Down Expand Up @@ -118,6 +118,8 @@ def test_find_k_nearest_neighbors_cli_entrypoint(
assert "Document ID: 101" in capsys.readouterr().out


# Live integration test: skipped unless RUN_INTEGRATION_TESTS=true is set along with
# GOOGLE_CLOUD_PROJECT, SPANNER_INSTANCE_ID, and SPANNER_DATABASE_ID.
@conftest.live_only
def test_find_k_nearest_neighbors_live(
capsys: pytest.CaptureFixture[str],
Expand Down