Install & Compatibility
Where this runs
tested against v0.5.1 · 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
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.8MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 1.7s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
camelize
✓ import inflection
inflection.camelize('device_type')
underscore
✓ import inflection
inflection.underscore('DeviceType')
pluralize
✓ import inflection
inflection.pluralize('cat')
singularize
✓ import inflection
inflection.singularize('cats')
dasherize
✓ import inflection
inflection.dasherize('puni_puni')
humanize
✓ import inflection
inflection.humanize('employee_salary')
ordinalize
✓ import inflection
inflection.ordinalize(1)
tableize
✓ import inflection
inflection.tableize('fancy_category')
titleize
✓ import inflection
inflection.titleize('man from the boondocks')
transliterate
✓ import inflection
inflection.transliterate('你好')
The quickstart demonstrates basic string transformations: `camelize` for case conversion, `pluralize` for converting singular words to their plural form, and `singularize` for converting plurals to singulars.
import inflection
# Convert a snake_case string to CamelCase
result_camel = inflection.camelize("my_variable_name")
print(f"CamelCase: {result_camel}")
# Pluralize a word
result_plural = inflection.pluralize("mouse")
print(f"Plural: {result_plural}")
# Singularize a word
result_singular = inflection.singularize("data")
print(f"Singular: {result_singular}")
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'inflection'
The 'inflection' library is not installed in your Python environment or the Python interpreter cannot find it.
fixInstall the library using pip: `pip install inflection`
AttributeError: module 'inflection' has no attribute 'pluralise'
You are trying to call a method that does not exist or is misspelled. The library uses 'pluralize' (American English spelling), not 'pluralise'.
fixCorrect the method name to the accurate spelling, e.g., `inflection.pluralize('word')` NameError: name 'inflection' is not defined
This typically occurs when you've imported specific functions from the 'inflection' module (e.g., `from inflection import pluralize`) but then try to access them via the module name as if the entire module was imported (e.g., `inflection.pluralize`).
fixEither import the entire module (`import inflection`) or call the function directly without the module prefix (`pluralize('word')` after `from inflection import pluralize`). TypeError: expected string or bytes-like object
An 'inflection' function was called with an argument of an incorrect type, such as an integer or a list, when it expected a string.
fixEnsure that the input provided to the 'inflection' function is a string, converting it if necessary: `inflection.pluralize(str(123))`
Upgrade
Version history
0.5.1latest on PyPI · released Aug 22, 2020
Audit
Dependencies
No dependency data recorded yet.