| Crates.io | cargo-duckdb-ext-tools |
| lib.rs | cargo-duckdb-ext-tools |
| version | 0.4.0 |
| created_at | 2025-12-01 00:29:36.899162+00 |
| updated_at | 2025-12-01 06:36:12.301433+00 |
| description | A cargo subcommand that packages DuckDB extensions by appending the required extension metadata to a compiled dynamic library. |
| homepage | |
| repository | https://github.com/redraiment/cargo-duckdb-ext-tools |
| max_upload_size | |
| id | 1959039 |
| size | 45,098 |
A Rust-based toolkit for building and packaging DuckDB extensions without Python dependencies. Provides two cargo subcommands that streamline the development workflow for Rust-based DuckDB extensions.
DuckDB extensions are dynamic libraries (.dylib/.so/.dll) with a 534-byte metadata footer appended to the file. The official DuckDB Rust extension template relies on a Python script (append_extension_metadata.py) to add this metadata, requiring developers to maintain both Rust and Python environments.
This project eliminates the Python dependency by providing native Rust tooling that integrates seamlessly with cargo workflows.
cargo-duckdb-ext-packA lower-level tool that appends DuckDB extension metadata to an existing dynamic library file. This is a direct replacement for the Python append_extension_metadata.py script.
-i, --library-path: Input dynamic library path-o, --extension-path: Output extension file path-v, --extension-version: Extension version (e.g., v1.0.0)-p, --duckdb-platform: Target platform (e.g., osx_arm64, linux_amd64)-d, --duckdb-version: DuckDB version (e.g., v1.4.2)-a, --abi-type: ABI type (default: C_STRUCT_UNSTABLE)-q, --quiet: Suppress outputcargo duckdb-ext-pack \
-i target/release/librusty_sheet.dylib \
-o rusty_sheet.duckdb_extension \
-v v0.4.0 \
-p osx_arm64 \
-d v1.4.2
cargo-duckdb-ext-buildA high-level tool that combines building and packaging in one step with intelligent defaults.
-m, --manifest-path: Path to Cargo.toml-o, --extension-path: Output extension file path-v, --extension-version: Extension version-p, --duckdb-platform: Target platform-d, --duckdb-version: DuckDB version-a, --abi-type: ABI type (default: C_STRUCT_UNSTABLE)-q, --quiet: Suppress output--: Passed to cargo buildThe tool automatically extracts build information using cargo build --message-format=json and derives:
cdylib target kind<project-name>.duckdb_extension in the same directory as the libraryCargo.toml version fieldduckdb or libduckdb-sys dependency versioncargo duckdb-ext-build -- --release --target x86_64-unknown-linux-gnu
This executes:
cargo build --release --target x86_64-unknown-linux-gnucargo duckdb-ext-pack with auto-detected parametersOutput: target/x86_64-unknown-linux-gnu/release/<project-name>.duckdb_extension
cargo install cargo-duckdb-ext-tools
Simply use:
cargo duckdb-ext-build -- --release
cargo duckdb-ext-build -- --release --target aarch64-unknown-linux-gnu
Override defaults when needed:
cargo duckdb-ext-build \
-v v2.0.0 \
-p linux_amd64_gcc4 \
-- --release
Tested on:
The tool automatically maps Rust target triples to DuckDB platform identifiers:
| Rust Target Triple | DuckDB Platform |
|---|---|
x86_64-apple-darwin |
osx_amd64 |
aarch64-apple-darwin |
osx_arm64 |
x86_64-unknown-linux-gnu |
linux_amd64 |
aarch64-unknown-linux-gnu |
linux_arm64 |
x86_64-pc-windows-msvc |
windows_amd64 |
For questions or issues:
MIT License - see LICENSE file for full license text.