Registry / serialization / stringcase

stringcase

JSON →
library1.2.0pypypi✓ verified 25d ago

Stringcase is a lightweight Python library providing functions to convert strings between various common casing conventions, such as camelCase, snake_case, PascalCase, kebab-case, and more. It is a stable, single-purpose utility with no external dependencies, currently at version 1.2.0, and typically sees infrequent updates unless new casing styles or critical bug fixes are required.

pip install stringcase
INSTALL
IMPORT
SIG · STRINGCASE
S
stringcase
serializationpythonv1.2.0
Install
2.4s avg
Import
Disk
17MB
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.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 19.2MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.4s · import 0.000s · 20MB
17MB installed
● package 17MB
Code
Verified usage

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

camelcase
from stringcase import camelcase
snakecase
from stringcase import snakecase
stringcase
import stringcase
Imports the module, functions are then accessed via `stringcase.camelcase()`

Demonstrates basic usage of `stringcase` to convert between camelCase, snake_case, kebab-case, and PascalCase using the module-level functions.

import stringcase # Convert to camelCase camel = stringcase.camelcase('hello_world') print(f"camelcase: {camel}") # Expected: helloWorld # Convert to snake_case snake = stringcase.snakecase('HelloWorld') print(f"snakecase: {snake}") # Expected: hello_world # Convert to kebab-case kebab = stringcase.kebabcase('helloWorld') print(f"kebabcase: {kebab}") # Expected: hello-world # Convert to PascalCase pascal = stringcase.pascalcase('hello-world') print(f"pascalcase: {pascal}") # Expected: HelloWorld
Debug
Known issues
gotchaThe `uppercamelcase` function is an explicit alias for `pascalcase`. If you expect a distinction between the two, be aware that they perform the same conversion.
fix
Use `pascalcase` directly or be aware that `uppercamelcase` behaves identically to `pascalcase`.
affects: All versions
gotchaAll `stringcase` functions expect a string as input. Providing non-string types (e.g., `None`, integers, lists) will typically result in a `TypeError` or `AttributeError`.
fix
Ensure inputs are always strings. If inputs might be non-string, pre-process them (e.g., `str(value)` or check `isinstance(value, str)`).
affects: All versions
gotchaThe library primarily focuses on common English-based casing conventions and may not handle complex Unicode characters or non-Latin scripts as expected for all casing transformations. Test thoroughly with internationalized strings.
fix
Validate output with non-ASCII or complex Unicode strings if your application requires global character support. Consider character normalization if specific Unicode behaviors are needed.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'stringcase'
The `stringcase` library is not installed in the current Python environment.
fix
pip install stringcase
AttributeError: module 'stringcase' has no attribute 'snake_case'
The user attempted to call a function using snake_case for the function name itself (e.g., `snake_case`) instead of the library's convention where function names are lowercase (e.g., `snakecase`).
fix
import stringcase
stringcase.snakecase('hello world')
AttributeError: 'int' object has no attribute 'replace'
A `stringcase` function was called with a non-string input (e.g., an integer or None), leading to internal string manipulation methods being called on an object that does not support them.
fix
Ensure the input to any `stringcase` function is a string: `stringcase.camelcase(str(123))` or `stringcase.snakecase('my input string')`.
Upgrade
Version history
1.2.0latest on PyPI · released Aug 6, 2017
Audit
Dependencies

No dependency data recorded yet.

Agent activity
15 hits · last 30 days
node
12
OpenAI (training)
1
Resources
stringcase — pip install stringcase · libregistry