Registry / serialization / case-converter

case-converter

JSON →
library1.2.0pypypi✓ verified 86d ago

A robust Python package (v1.2.0) for transforming string cases such as "Hello, world!" into "helloWorld" (camelCase). It offers various conversion types including camelCase, snake_case, kebab-case, macro_case, pascalCase, cobol-case, flatcase, and titlecase. The library is actively maintained with regular updates, and designed to be lightweight with no external dependencies.

pip install case-converter
INSTALL
IMPORT
SIG · CASE-CONVERTER
C
case-converter
serializationpythonv1.2.0
Install
1.5s avg
Import
23ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.2.0 · 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.920 runs
installs and imports cleanly · install 0.0s · import 0.025s · 18MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 1.5s · import 0.022s · 18MB
16MB installed
● package 16MB
Code
Verified usage

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

camelcase
from caseconverter import camelcase
snakecase
from caseconverter import snakecase
* (all converters)
import caseconverter as cc # or from caseconverter import *

Demonstrates basic string case conversion using various functions, including options for preserving punctuation and using custom delimiters.

import caseconverter as cc text = "Hello, beautiful World!" # Convert to camelCase camel_text = cc.camelcase(text) print(f"Original: '{text}' -> CamelCase: '{camel_text}'") # Convert to snake_case snake_text = cc.snakecase(text) print(f"Original: '{text}' -> SnakeCase: '{snake_text}'") # Convert to MACRO_CASE and keep punctuation macro_text_with_punc = cc.macrocase("Hello, world! How are you?", strip_punctuation=False) print(f"Original: 'Hello, world! How are you?' -> MacroCase (with punc): '{macro_text_with_punc}'") # Convert to kebab-case using custom delimiters kebab_custom_delims = cc.kebabcase("first_part-second part", delims=['_', ' ']) print(f"Original: 'first_part-second part' -> KebabCase (custom delims): '{kebab_custom_delims}'")
case-converter --version
Debug
Known issues
gotchaBy default, punctuation is stripped during string conversion. If you need to retain punctuation, you must explicitly pass `strip_punctuation=False` to the conversion function.
fix
Pass `strip_punctuation=False` as an argument to the conversion function (e.g., `camelcase("text!", strip_punctuation=False)`).
affects: All versions
gotchaThe library uses a default set of delimiters (' ', '-', '_') to identify word boundaries. If your input string uses other characters as delimiters that you want to be treated as such, you need to specify them using the `delims` argument.
fix
Provide a list or string of custom delimiters using the `delims` argument (e.g., `snakecase("text|with|pipes", delims=['|'])`).
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'case_converter'
The `case-converter` package is installed via pip with a hyphen in its name, but Python import statements for this library should use `caseconverter` (without a hyphen).
fix
Change the import statement to `from caseconverter import [function_name]` (e.g., `from caseconverter import camelcase`).
AttributeError: module 'caseconverter' has no attribute 'camelCase'
The conversion functions in the `case-converter` library use lowercase names (e.g., `camelcase`, `snakecase`), but the user attempted to call them using PascalCase or camelCase naming conventions for the function itself.
fix
Use the correct lowercase function name as imported: `from caseconverter import camelcase`, then call `camelcase('hello world')`.
TypeError: expected string or bytes-like object
The `case-converter` functions are designed to operate on string inputs, but a non-string type (e.g., integer, list, None) was passed as an argument.
fix
Ensure that the input provided to any `caseconverter` function is always a string. Convert non-string data to a string first if necessary.
Upgrade
Version history
1.2.0latest on PyPI · released Feb 19, 2025
Audit
Dependencies

No dependency data recorded yet.

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