Case Convert
raw JSON → 1.1.0 verified Fri May 01 auth: no python
A Python library for converting between string cases (snake_case, camelCase, PascalCase, kebab-case, etc.) with permissive input handling. Current version 1.1.0, no breaking changes reported yet.
pip install case-convert Common errors
error ModuleNotFoundError: No module named 'case_convert' ↓
cause PyPI package name is 'case-convert', but import uses underscore 'case_convert'.
fix
Install with 'pip install case-convert' and import as 'from case_convert import ...'.
error ImportError: cannot import name 'snake_case' from 'case_convert' ↓
cause Exported name is 'snake', not 'snake_case'.
fix
Use 'import snake from case_convert' (the function is named 'snake').
Warnings
gotcha Case Convert does not automatically split on digits; e.g., 'abc123def' treated as 'abc123def' (no separation). Use a pre-processing step if digit boundaries are needed. ↓
fix Manually insert separators or use regex to handle digit transitions.
Imports
- camel
from case_convert import camel - snake
from case_convert import snake - pascal
from case_convert import pascal - kebab
from case_convert import kebab
Quickstart
from case_convert import camel, snake, pascal, kebab
text = "hello_world_example"
print(camel(text)) # helloWorldExample
print(snake(text)) # hello_world_example
print(pascal(text)) # HelloWorldExample
print(kebab(text)) # hello-world-example