Swiss army knife pure Python library to change string casing
Project description
Basket Case
Basket case is a small, pure-Python swiss army knife for translating strings between case styles. I developed it because in my development work I often need to switch between string renderings: snake_case for Python, slug-names for document names, camelCase for a bunch of things, CONSTANT_NAMES for, well, constants, and Title Case for nice human readability.
I want to be able to move between these fluidly and reliably, and by using a single import statement.
import basket_case as bc
my_string = "a long name for a variable"
assert bc.slug(my_string) == "a-long-name-for-a-variable"
assert bc.title(my_string) == "A Long Name for a Variable"
assert bc.camel(my_string) == "aLongNameForAVariable"
assert bc.snake(my_string) == "a_long_name_for_a_variable"
assert bc.constant(my_String) == "A_LONG_NAME_FOR_A_VARIABLE"
Installation
pip install basket-case
Python 3+ only; sorry not sorry.
Usage
Dependencies
Basket case wraps titlecase and python-slugify for their respective capabilities.
Contributions
Please!
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file basket-case-0.1.4.tar.gz
.
File metadata
- Download URL: basket-case-0.1.4.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee90798bf44c780d88d96e539bf24605bb2373b5e9f3968c0b00669d48357f76 |
|
MD5 | f511df4be4e0db49a6e2fcb81b411871 |
|
BLAKE2b-256 | 3bf7bf5c9b4f8cc7ae4b125f879534a1689ea658178cbb088be17bba801ea2cf |