Repository navigation
Cargo features so builds can leave drivers out - #154
Conversation
Every driver stays on by default. With default-features = false, terrio keeps GeoTIFF/COG, the plain raster and vector formats, the CRS engine and the operations; parquet, remote, avif, netcdf-hdf5, osm, lzma, flatgeobuf, jp2, lerc, pointcloud, tiles, zarr and sqlite add the rest. geotiff is an empty feature naming the core. Disabled drivers stay in RasterDriver and VectorDriver, listed as neither read nor written, and fail with "built without the `...` feature". Shared helpers move out of the gated drivers (CF grid mappings, date conversions, coordinate counts, the AVIF signature), the tile archives move to tiles/archive.rs so that the tile options stay, and a build script sets cfg(remote) for the remote feature on native targets. A CI job checks each feature alone and none, the core for wasm32-unknown-unknown, and that a geotiff build pulls none of the optional codecs. Part of #139.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 12 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Code reviewI read about 3,300 of the 4,256 diff lines. I did not read the rest of Bugs
Security
Performance
Quality
CLAUDE.md
|
Code reviewI read the first ~2,950 of the 4,256 diff lines. That covers the CI job, Cargo features, BugsNo correctness bugs found in the reviewed portion.
SecurityNothing found. The changes only narrow what is compiled in, and the new CI step reads nothing outside the repository. PerformanceNothing found. Optional dependencies are now actually optional, which is the point of the PR. Quality
CLAUDE.mdI found no CLAUDE.md guideline violations in the files I reviewed. |
Code reviewI read the whole diff and the surrounding source, but I couldn't build or run anything here. The feature gating looks sound and I found no correctness bugs. That is from reading the code, so I can't rule out a combination that fails to compile. Two inline comments are posted. Bugs
Security
Performance
Quality
CLAUDE.md
Checked and fine
|
Closes #139.
Every driver is still on by default, so today's behaviour and the tests are unchanged, and the CLI, Python and JS crates keep depending on terrio with default features. A consumer can now use
default-features = falseand turn on only what it needs:Features
geotiffparquetarrowmodule, Arrow streams (arrow, parquet,wbvector/geoparquet)remotecfg(remote)set by a build script)netcdf-hdf5sqlitetilessqlite)aviftiles)zarr,jp2,flatgeobuf,osm,pointcloud,lerc,lzmagdalThe core without features: GeoTIFF/COG (deflate, LZW, PackBits, ZSTD, WebP, JPEG, JPEG XL), the raw and ASCII rasters, PNG, JPEG, VRT, STAC, GeoJSON, TopoJSON, Shapefile, KML/KMZ, GML, GPX, CSV, MapInfo, the CRS engine, the operations and the streams.
Public API
RasterDriver/VectorDrivervariant stays in every build. A driver a build leaves out hasread/writefalse in itsDriverInfo, and opening or writing its files returnsError::Unsupported("built without thezarrfeature")(checked by extension and by signature, also formemory::open_bytes,GPKG:/NETCDF:/HDF5:/ZARR:names, URLs withoutremote, LERC/LZMA TIFFs).doc(cfg):arrow,pointcloud,http,s3,stream::ArrowStream,vector::{FlatGeobufInfo, RowGroupInfo}and the sparse readers,tiles::TileArchiveand the archive functions,LazyRaster::from_tile_archive,info::Info::PointCloud,vfs::Location::remote.tilesstays as a module in every build so thatTileOpenOptions/TileWriteOptions(fields ofVectorOpenOptions/VectorWriteOptions) keep existing; the archive code moved unchanged totiles/archive.rs.Untangling
cf_crsmoved fromdrivers/netcdf.rstodrivers/cf.rs(shared by netCDF, HDF5 and Zarr).geoparquet/arrowthatprofile.rsandgeopackage.rsused moved todrivers/vector/datetime.rs;geometry_dimsand FlatGeobuf'scoord_countmoved tocrate::vector.sparse.rs's parquetChunkReaderimpl is behindparquet;is_avifmoved next toTileFormat.cog.rs,dataset.rs,info.rs,memory.rs,drivers/mod.rs,drivers/vector/mod.rs,stream/andvfs.rsdispatch has a cfg per arm; HTTP sites that werenot(wasm32)are nowcfg(remote).dead_codecrate-wide (helpers only the left-out drivers use); the default build still denies it.NullSafeAllocatorand--allow-undefineddocs now say they are only forjp2.Dependencies (unique crates in
cargo tree -e normal, native)--no-default-features --features geotiff--no-default-featuresThe geotiff build has no arrow, parquet, hdf5, netcdf, openjp2, av1, lzma, lerc, laz, e57, flatgeobuf, osmpbfreader or ureq crates. It still has the jxl crates (
jxl-oxide,zune-jpegxl):wbrasterpulls them throughwbgeotiff, which has no features to turn them off, so that part of the acceptance can't be met inside terrio.CI
New
Cargo featuresjob:cargo hack check -p terrio --each-feature --no-dev-deps --exclude-features gdalwith-D warnings,cargo build -p terrio --no-default-features --features geotiff --target wasm32-unknown-unknown, and acargo treecheck that the geotiff build pulls none of the optional codecs.Docs
README and
docs/rust.md(Features table, WebAssembly) describe the features; the crate docs list them too.Follow-up
wbgeotiff's JPEG XL and WebP codecs optional and expose that throughwbraster(not filed; needs a go-ahead since it is another project's repository).