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_cu11_stubs-0.5.0.13.4-py3-none-any.whl.

File metadata

File hashes

Hashes for nvidia_nvimgcodec_cu11_stubs-0.5.0.13.4-py3-none-any.whl
Algorithm Hash digest
SHA256 7eaac1745a1048b4f30eda01bf2172139e2d5c08eb5d7972a9eb8d7cd1c55045
MD5 b6ede7978e2b801c53036fdaa76aa8c3
BLAKE2b-256 fae74db14ddef25a3745794484f0ca493013d7831ccaa2786daaf0f82f414801

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