For those who want the full story, read the docs. For everyone else, here's the gist.
It's a computer vision library. You write Python, because you're not a masochist. But when your code inevitably becomes a bottleneck, you need speed. That's where this library can help.
The philosophy is simple:
Write Python. When it's slow, make it fast with C++.
Yes. Here's a Non-Maximum Suppression (NMS) benchmark. We pitted our C++ implementation against a standard NumPy version.
import time
import numpy as np
from nextcv.postprocessing import nms_cpp, nms_np
# A respectable amount of data
N = 10000
rng = np.random.default_rng(42)
bboxes = rng.uniform(0, 100, (N, 4)).astype(np.float32)
scores = rng.uniform(0.1, 1, N).astype(np.float32)
# Time the C++ version
start_time = time.perf_counter()
result_cpp = nms_cpp(bboxes, scores, 0.5)
cpp_time = time.perf_counter() - start_time
# Time the NumPy version
start_time = time.perf_counter()
result_np = nms_np(bboxes, scores, 0.5)
np_time = time.perf_counter() - start_time
print("NMS Timing Comparison:")
print(f" Dataset: {len(bboxes)} bounding boxes")
print(f" nms_cpp(): {len(result_cpp)} boxes kept in {cpp_time * 1000:.2f}ms")
print(f" nms_np(): {len(result_np)} boxes kept in {np_time * 1000:.2f}ms")Fingers' crossed, the C++ version is significantly faster. π―
# Ubuntu/Debian
sudo apt-get install libeigen3-dev cmake
# MacOS
brew install eigen cmakepip install nextcv
# or from git
pip install git+https://github.com/kevinconka/nextcv.git
# uv
uv add nextcvuv run python -c "import nextcv; print(nextcv.__version__)"This project uses a dual-configuration approach to support both modern development and legacy compatibility:
- Modern builds (Python 3.9+): Uses
scikit-build-corewithpyproject.toml - Legacy builds (Python 3.6...3.8): Uses
scikit-buildwithpyproject.legacy.toml+setup.py
For development:
# create a virtual environment
python -m venv .venv
source .venv/bin/activate
pip install -e .
# or let uv handle it for you
uv syncFor legacy builds (Python 3.6...3.8):
# Copy legacy config and build
cp pyproject.legacy.toml pyproject.toml
pip install -e .If you think you can make this better, feel free. Just don't break anything.
-
Fork it.
-
Create a branch. (
git checkout -b my-brilliant-idea) -
Install UV (if you don't have it yet).
curl -LsSf https://astral.sh/uv/install.sh | sh -
Install C++ tools.
# macOS brew install clang-format llvm # Add LLVM to PATH (add to ~/.zshrc or ~/.bash_profile) echo 'export PATH="/usr/local/opt/llvm/bin:$PATH"' >> ~/.zshrc # Ubuntu/Debian sudo apt-get install clang-format clang-tidy
-
Set up the environment.
uv sync uvx pre-commit install
-
Write code. And tests. Don't forget the tests.
-
Run the checks.
uv run pytest uvx pre-commit run --all-files
-
Open a pull request. Make it a good one.
That's it. Now you know. π