Skip to content

Repository files navigation

string-utils

High-performance Python string utilities powered by nanobind.

Built with the modern 2025/2026 C++ toolchain:

  • uv — Rust-powered Python project/dependency manager
  • scikit-build-core — PEP 517/660 build backend for CMake projects
  • nanobind — lightweight C++17 binding library (sub-30ns invocation, ~10x smaller binaries vs pybind11)
  • cibuildwheel — multi-platform wheel generation in CI

Layout

string-utils/
├── CMakeLists.txt
├── pyproject.toml
├── python/string_utils/
│   ├── __init__.py
│   ├── _core.pyi
│   └── py.typed
├── src/
│   ├── bindings.cpp
│   ├── string_ops.cpp
│   └── string_ops.hpp
└── tests/
    └── test_string_utils.py

Development

uv sync --extra test
uv run pytest
uv run python -c "
import string_utils
print(string_utils.word_count('Fast native Python extensions using nanobind and uv.'))
print(string_utils.reverse('nanobind'))
"

The distribution is named string-utils, but it is imported as string_utils (Python replaces hyphens with underscores for import names).

Notes

The string operations work on individual bytes and are only fully correct for ASCII input. Multi-byte UTF-8 text (e.g. accented characters) is not reversed or case-folded as logical characters.

About

A demo project showcasing the use of scikit-build-core with nanobind.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages