Skip to main content

Type stubs for NVIDIA NVIMGCODEC CUDA 12 bindings

Project description

nvidia-nvimgcodec-stubs

Type stubs for NVIDIA nvimgcodec Python API.

Description

This project provides type stubs for the NVIDIA nvimgcodec Python API. It enables static type checking and IDE autocompletion for nvimgcodec in Python projects.

Features

  • Support for both CUDA 11 and CUDA 12
  • Includes type stubs for the following NVIDIA libraries:
    • nvidia.nvcomp - Data compression library
    • nvidia.nvimgcodec - Image encoding/decoding library
    • nvidia.nvjpeg - JPEG processing library
    • nvidia.nvjpeg2k - JPEG 2000 processing library
    • nvidia.nvtiff - TIFF processing library

Installation

CUDA 12 version

pip install nvidia-nvimgcodec-cu12-stubs

CUDA 11 version

pip install nvidia-nvimgcodec-cu11-stubs

Usage

After installation, your IDE and type checkers (like mypy, pyright, etc.) will automatically use these stubs when you import nvimgcodec:

import nvidia.nvimgcodec as nvimgcodec

# Your IDE will now provide autocompletion and type checking for nvimgcodec
decoder = nvimgcodec.Decoder()

Requirements

  • Python >= 3.10
  • nvidia-nvimgcodec-cu12[all] == 0.5.0.13 (for CUDA 12 version)
  • nvidia-nvimgcodec-cu11[all] == 0.5.0.13 (for CUDA 11 version)

Development

Build Environment Setup

This project uses uv for building:

# uv will be automatically installed if not present
./build.sh

Build Process

The build.sh script automatically performs the following:

  1. Generates stubs for both CUDA 11 and CUDA 12 versions
  2. Creates project configuration from template files
  3. Auto-generates type stubs using pybind11-stubgen
  4. Builds the packages

Manual Stub Generation

# Create and activate virtual environment
uv python pin 3.12
uv sync --extra dev
source .venv/bin/activate  # Linux/macOS
# or .venv\Scripts\activate  # Windows

# Generate stubs
python -m pybind11_stubgen nvidia --ignore-all-errors --output-dir src
python -m pybind11_stubgen nvidia.nvcomp --ignore-all-errors --output-dir src
python -m pybind11_stubgen nvidia.nvimgcodec --ignore-all-errors --output-dir src
python -m pybind11_stubgen nvidia.nvjpeg --ignore-all-errors --output-dir src
python -m pybind11_stubgen nvidia.nvjpeg2k --ignore-all-errors --output-dir src
python -m pybind11_stubgen nvidia.nvtiff --ignore-all-errors --output-dir src

# Build package
uv build

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Related Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file nvidia_nvimgcodec_cu12_stubs-0.5.0.13.4-py3-none-any.whl.

File metadata

File hashes

Hashes for nvidia_nvimgcodec_cu12_stubs-0.5.0.13.4-py3-none-any.whl
Algorithm Hash digest
SHA256 1fe8e3a8f657851fe26f417d96dff6743a09c52806f6489fa17702664d35dadd
MD5 99c79b008d58b70bfa1721d8c9385ced
BLAKE2b-256 0c8c068d2dad6f4462f4eb1243eebe6798c6669c350ac39eaab61ad6c9dc226d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page