Skip to content

Commit f0d0e16

Browse files
committed
[skip ci] 📝 Add CudaCogReader class to API docs
Need to include 'cuda' feature flag to maturin on ReadtheDocs, and get libnvtiff-dev from conda-forge. Added a warning to the docstring indicating that CudaCogReader is experimental, and only available on linux-x86_64 and linux-aarch64 builds.
1 parent 4ad7078 commit f0d0e16

File tree

4 files changed

+35
-2
lines changed

4 files changed

+35
-2
lines changed

docs/.readthedocs.yaml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,19 @@ build:
99
os: "ubuntu-24.04"
1010
tools:
1111
nodejs: "23"
12-
python: "3.12"
12+
python: "mambaforge-23.11"
1313
rust: "1.86"
1414
jobs:
15+
pre_install:
16+
# Patch nvtiff.h (v0.5.0) to remove default arguments and missing enum tag
17+
- export CONDA_PREFIX="$CONDA_ENVS_PATH/$CONDA_DEFAULT_ENV";
18+
unset CONDA_DEFAULT_ENV;
19+
mamba list;
20+
sed --in-place "s/memLimit=0/memLimit/g" $CONDA_PREFIX/include/nvtiff.h;
21+
sed --in-place "s/stream=0/stream/g" $CONDA_PREFIX/include/nvtiff.h;
22+
sed --in-place "s/nvtiffTagDataType type/enum nvtiffTagDataType type/g" $CONDA_PREFIX/include/nvtiff.h;
1523
install:
16-
- pip install .[docs]
24+
- MATURIN_PEP517_ARGS="--features cuda,pyo3" pip install .[docs]
1725
# https://github.com/jupyter-book/sphinx-ext-mystmd/pull/2
1826
- pip install --ignore-installed git+https://github.com/weiji14/sphinx-ext-mystmd@e995908b3a898b9c9d5d3fec4ff1478f1f4c1ccd
1927
- pip list
@@ -29,3 +37,6 @@ build:
2937
post_build:
3038
- "mkdir --parents $READTHEDOCS_OUTPUT/html/"
3139
- "mv docs/_build/html/* $READTHEDOCS_OUTPUT/html/"
40+
41+
conda:
42+
environment: docs/environment.yml

docs/api.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ These are the Python docs for `cog3pio`, for the Rust docs, see
99
.. autoclass:: cog3pio.CogReader
1010
:members:
1111
:special-members: __dlpack__, __dlpack_device__
12+
.. autoclass:: cog3pio.CudaCogReader
13+
:members:
14+
:special-members: __dlpack__, __dlpack_device__
1215
```
1316

1417
## Xarray

docs/environment.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
name: cog3pio
2+
channels:
3+
- conda-forge
4+
- nodefaults
5+
dependencies:
6+
- python=3.12
7+
- libnvtiff-dev=0.5.0

src/python/cudacog.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ use crate::python::adapters::path_to_stream;
1313

1414
/// Python class interface to a Cloud-optimized GeoTIFF reader (nvTIFF backend).
1515
///
16+
/// Warning
17+
/// -------
18+
/// This is an experimental feature only enabled on linux-x86_64 and linux-aarch64
19+
/// wheel builds.
20+
///
1621
/// Parameters
1722
/// ----------
1823
/// path : str
@@ -23,6 +28,13 @@ use crate::python::adapters::path_to_stream;
2328
/// reader : cog3pio.CudaCogReader
2429
/// A new CudaCogReader instance for decoding GeoTIFF files.
2530
///
31+
/// Raises
32+
/// ------
33+
/// ImportError
34+
/// If ``nvTIFF`` is not installed. Please install it (e.g. via
35+
/// ``apt install nvtiff-cuda-12`` or ``dnf install nvtiff-cuda-12``) before using
36+
/// this class.
37+
///
2638
/// Examples
2739
/// --------
2840
/// Read a GeoTIFF from a HTTP url into a DLPack tensor:

0 commit comments

Comments
 (0)