Skip to content

Commit

Permalink
Bump the stack level of the tiledb_ctx warning (#2788)
Browse files Browse the repository at this point in the history
Currently warnings about the deprecated `tiledb_ctx` have a not-super useful traceback:

```pytb
  /home/ubuntu/miniforge3/envs/cellxgene-census-bump-tiledbsoma/lib/python3.11/site-packages/tiledbsoma/options/_soma_tiledb_context.py:27: DeprecationWarning: tiledb_ctx is now deprecated for removal in 1.14. Use tiledb_config instead by passing SOMATileDBContext(tiledb_config=ctx.config().dict()).
    warnings.warn(
```

This change makes it a little more useful by showing the relevant callsite:

```
tests/test_get_anndata.py: 81 warnings
  /home/ubuntu/miniforge3/envs/cellxgene-census-bump-tiledbsoma/lib/python3.11/site-packages/tiledbsoma/_tdb_handles.py:333: DeprecationWarning: tiledb_ctx is now deprecated for removal in 1.14. Use tiledb_config instead by passing SOMATileDBContext(tiledb_config=ctx.config().dict()).
    ctx = context.tiledb_ctx

tests/test_get_anndata.py: 81 warnings
  /home/ubuntu/miniforge3/envs/cellxgene-census-bump-tiledbsoma/lib/python3.11/site-packages/tiledbsoma/_tdb_handles.py:334: DeprecationWarning: tiledb_ctx is now deprecated for removal in 1.14. Use tiledb_config instead by passing SOMATileDBContext(tiledb_config=ctx.config().dict()).
    cfgdict = context.tiledb_ctx.config().dict()
```
  • Loading branch information
ivirshup committed Jul 10, 2024
1 parent 05b1e31 commit b6b1cd4
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions apis/python/src/tiledbsoma/options/_soma_tiledb_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def _warn_ctx_deprecation() -> None:
"Use tiledb_config instead by passing "
"SOMATileDBContext(tiledb_config=ctx.config().dict()).",
DeprecationWarning,
stacklevel=3,
)


Expand Down

0 comments on commit b6b1cd4

Please sign in to comment.