humps

Release v1.3.1. (Installation)

Pypi Build status Documentation Status Coverage Python Versions

humps 🐫 Convert strings (and dictionary keys) between snake case, camel case and pascal case in Python. Inspired by Humps for Node


Introducing Humps for Python! Let’s see it in action:

>>> import humps
>>> humps.decamelize('illWearYourGranddadsClothes')   # 'ill_wear_your_granddads_clothes'
>>> humps.camelize('i_look_incredible')               # 'iLookIncredible'
>>> humps.pascalize('im_in_this_big_ass_coat')        # 'ImInThisBigAssCoat'
>>> humps.decamelize('FROMThatThriftShop')            # 'from_that_thrift_shop'
>>> humps.decamelize([{'downTheRoad': True}])         # [{'down_the_road': True}]

Features

  • Convert from snake_case to camelCase and PascalCase
  • Convert from camelCase to snake_case and PascalCase
  • Convert from PascalCase to snake_case and camelCase
  • Supports recursively converting dict keys
  • Supports recursively converting lists of dictionaries
  • Gracefully handles abbrevations, acronyms, and initialisms
  • Extensively documented source code
  • No third-party dependencies

Installation

To install humps, simply use pipenv (or pip, of course):

$ pipenv install pyhumps

The API Documentation / Guide

If you are looking for information on a specific function, this part of the documentation is for you.

Indices and tables