Skip to content

cuvs: add package version retrieval function#2337

Open
QuerthDP wants to merge 1 commit into
NVIDIA:mainfrom
QuerthDP:add-version-retrieval
Open

cuvs: add package version retrieval function#2337
QuerthDP wants to merge 1 commit into
NVIDIA:mainfrom
QuerthDP:add-version-retrieval

Conversation

@QuerthDP

Copy link
Copy Markdown

Add a function that allows to retrieve the current version of a cuvs Rust package.

Also add a simple unit test for the function.

Add a function that allows to retrieve the current version
of a `cuvs` package.

Also add a simple unit test for the function.
@copy-pr-bot

copy-pr-bot Bot commented Jul 21, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@QuerthDP

Copy link
Copy Markdown
Author

I cannot assign labels myself.
I would assume the labels would be improvement (?) and non-breaking since I'm adding a new function here so this does not break any existing user code (except for wildcard imports).

@cjnolet cjnolet added improvement Improves an existing functionality non-breaking Introduces a non-breaking change labels Jul 21, 2026
@QuerthDP

Copy link
Copy Markdown
Author

@cjnolet how do we proceed with it? Would you consider such feature to be added? We want to use this library as a GPU VS POC and engine (crate) version is required in our API.

@yan-zaretskiy

Copy link
Copy Markdown
Contributor

What is the use case you're after? I don't see value in wrapping env!("CARGO_PKG_VERSION"); into a function. With that said, I do plan to expose the actual C library version getter, via ffi::cuvsVersionGet(&mut major, &mut minor, &mut patch).

Comment thread rust/cuvs/src/lib.rs
Comment on lines +31 to +33
pub fn version() -> &'static str {
env!("CARGO_PKG_VERSION")
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest instead to wrap the underlying FFI function like so.

/// Returns the cuVS library version as `(major, minor, patch)`.
pub fn version() -> Result<(u16, u16, u16), LibraryError> {
    let mut major: u16 = 0;
    let mut minor: u16 = 0;
    let mut patch: u16 = 0;

    // SAFETY:
    // - All three pointers are valid, aligned `u16` locals.
    let status = unsafe { ffi::cuvsVersionGet(&mut major, &mut minor, &mut patch) };
    check_cuvs(status)?;
    Ok((major, minor, patch))
}

@QuerthDP

Copy link
Copy Markdown
Author

What is the use case you're after?

Return engine (cuVS crate) version via the /info endpoint in our service.

@QuerthDP

Copy link
Copy Markdown
Author

I do plan to expose the actual C library version getter, via ffi::cuvsVersionGet(&mut major, &mut minor, &mut patch).

When could it be done and released?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Improves an existing functionality non-breaking Introduces a non-breaking change

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants