Registry / serialization / case-conversion

case-conversion

JSON →
library3.0.2pypypi✓ verified 24d ago

The `case-conversion` library for Python, currently at version 3.0.2, provides a robust, dependency-free solution for converting strings between various case styles such as camelCase, PascalCase, snake_case, kebab-case, and more. It offers automatic case detection, advanced acronym handling, and full Unicode support, making non-ASCII characters first-class citizens. The library is actively maintained and supports Python 3.10 and newer.

pip install case-conversion
INSTALL
IMPORT
SIG · CASE-CONVERSION
C
case-conversion
serializationpythonv3.0.2
Install
2.0s avg
Import
45ms
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v3.0.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.034s · 17.9MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.0s · import 0.038s · 18MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Converter
from case_conversion import Converter
Import the main Converter class for object-oriented usage.
Top-level functions (e.g., camel, snake)
import case_conversion case_conversion.camel("some string")
Individual case conversion functions are available directly from the package for convenience.

This quickstart demonstrates both the `Converter` class and the convenience functions for various case conversions, including basic usage, custom acronym handling, and Unicode support.

from case_conversion import Converter # Using the Converter class converter = Converter() camel_case_string = converter.camel("FOO_BAR_STRING") pascal_case_string = converter.pascal("another string") print(f"Camel Case: {camel_case_string}") print(f"Pascal Case: {pascal_case_string}") # Using top-level convenience functions import case_conversion snake_case_string = case_conversion.snake("Hello World Example") kebab_case_string = case_conversion.kebab("http header case") print(f"Snake Case: {snake_case_string}") print(f"Kebab Case: {kebab_case_string}") # Custom acronym handling custom_acronym_converter = Converter(acronyms=["BAD", "HTTP"]) custom_acronym_snake = custom_acronym_converter.snake("fooBADHTTPError") print(f"Custom Acronym Snake Case: {custom_acronym_snake}") # Unicode support unicode_snake = case_conversion.snake("fóó-bar-string") print(f"Unicode Snake Case: {unicode_snake}")
Debug
Known issues
breakingThe library explicitly requires Python 3.10 or higher. Users on older Python 3 versions (e.g., 3.9 or earlier) will encounter installation or runtime errors.
fix
Upgrade your Python environment to 3.10 or newer.
affects: <3.10
gotchaWhile the library features automatic acronym detection, for complex or unusual sequences of capital letters (e.g., 'fooBADHTTPError'), the default behavior might not split them as desired. Custom acronyms can be provided during initialization to ensure correct parsing.
fix
When initializing the `Converter` class or calling a top-level function, provide a list of expected acronyms (e.g., `Converter(acronyms=['BAD', 'HTTP'])`).
affects: All
gotchaThe library offers 'auto-detection' of the input case, which is a powerful feature. However, for highly ambiguous or unconventional input strings, the detected word boundaries might not perfectly align with every user's specific interpretation. Always verify the output for edge cases.
fix
Test with diverse input strings, especially those with mixed cases, numbers, or unusual separators, to ensure the output matches expectations. Adjust input or use explicit tokenization if available (though not explicitly exposed in the API).
affects: All
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'case_conversion'
The 'case-conversion' library is not installed in the current Python environment.
fix
pip install case-conversion
AttributeError: module 'case_conversion' has no attribute 'pascalcase'
Case conversion methods like `pascalcase` are not directly available on the `case_conversion` module. They are methods of an instantiated `Converter` object, and the method name is `pascal` (not `pascalcase`).
fix
from case_conversion import Converter
converter = Converter()
result = converter.pascal("my_string")
TypeError: 'str' object is not callable
A variable named 'str' has been defined, inadvertently overwriting the built-in `str()` function, and then an attempt is made to call `str` as a function.
fix
Rename the variable that is conflicting with the built-in `str` function to avoid shadowing it. For example, use `my_string` instead of `str`.
Upgrade
Version history
3.0.2latest on PyPI · released Aug 27, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
12 hits · last 30 days
node
10
OpenAI (training)
1
Resources
case-conversion — pip install case-conversion · libregistry